if you add that line of code to the example project josh uploaded, then zoom in on your screen you can absolutely tell the difference between setting up with samples. The way its drawing is getting the pixels from the fbo then drawing them as glVerts, so the actual drawing to the screen is in the context of the main draw loop’s multisampled buffer…if you bind the fbo as a texture and draw that as well, you can see that the glVert method gives you slightly better AA, perhaps because of the rendering order you mentioned. However, comment out the multisampled glut display string and you can see both methods are significantly more jagged. Even when doing something like myOfImage.setFromPixels(fbo.getPixels()…), myOfImage.saveImage(“test.png”) you can see alpha edges when enabling the glut string and none without.

I think this is to be expected…as for workarounds, haven’t found one in particular yet…maybe blendFunc? maybe GL_ENABLE(GL_SAMPLE_ALPHA_TO_MASK_SGIS) or something like that? Will try some stuff out…

i’m trying the last version and i think there’s a problem in bindAsTexture, this:

void ofxFBOTexture::bindAsTexture(){  
	glBindTexture(GL_TEXTURE_2D, (GLuint)&texData.textureID);  

shouldn’t be?

void ofxFBOTexture::bindAsTexture(){  
	glBindTexture(GL_TEXTURE_2D, (GLuint)texData.textureID);  

note the & in the second parameter.

additionally, what’s the difference between this and bind() in ofTexture?

this one:

void ofxFBOTexture::bindAsTexture(){  
	glBindTexture(GL_TEXTURE_2D, (GLuint)texData.textureID);  

assumes GL_TEXTURE_2D, but in the bin in ofTexture it takes the texture target to bind (so the ARB stuff is ok). Seems like a bug? I got funky results using this, but good results with the ofTexture bind() that ofFBOTexture inherits since I was using an ARB texture.

take care,

sorry gents, that was legacy that we didn’t catch…were focused more on initial debug and getting pixels properly.

I think ofxFBOTexture::bindAsTexture() should indeed read as follows:

void ofxFBOTexture::bindAsTexture(){  
	glBindTexture(texData.textureTarget, (GLuint)texData.textureID);  

note to people new to this: this removal of the ampersand is only for glBindTexture. glGenTextures on line 160 still requires it in 0.061. in fact, the proper procedure together is seen on 160 + 161:

glGenTextures(1, (GLuint *)&texData.textureID);    
glBindTexture(texData.textureTarget, (GLuint)texData.textureID);  

this said, I agree Zach, there’s not much need for the bindAsTexture() f’n. In fact, that’s why we didn’t catch it when doing the initial fixes…I always just used fbo.bind(). Everyone kosher with removing it?


p.s. do we have any plans to get this up on github somewhere, or just continue with changes via forum?

I have a problem with the updated version for 061 (but also with the last good ofxFBO for 0.06, always with the correct FAT xcode pack).

bindtotexture doesnt work. I try to use it with a simple exmaple from Nehe in order to be sure that I do things correctly. If I use a jpg loaded to an ofImage I have no problems.

expesially for the updated 061 version getPixels returns void?!?! :S

Am I stupid or not?! maybe it is because Im in front of the screen all day…


Hello Guys,

I’ve started to have some linking errors os XCode out of no were, related with ofxFBOTexture.
They are:

“_pglBindRenderbufferEXT” reference from
_pgBindRenderbufferEXT$non_lazy_ptr in ofxFBOTexture.o

ando so on.

I’ve remade my project from the empty Project and still have the same errors.
Am I missing some frameworks? What are the depencies of ofxFBOTexture?

Thanks for any help


Cheers to everyone’s great work on ofxFBOTexture… it has come a long way!

I noticed that binding an ofxFBOTexture as a texture was not working when using normal texture coordinates going from 0 to 1 (ofDisableArbTex()).

I made a couple changes and things are working fine now.

one line 111 and 123

if (GLEE_ARB_texture_rectangle){  


if (ofGetUsingArbTex() && GLEE_ARB_texture_rectangle){  

Am I the only one with a strong dislike for texture coordinates that aren’t 0 -> 1?

Am I the only one with a strong dislike for texture coordinates that aren’t 0 -> 1?

Definitely agree, but I do have two issues with 0…1 UV’s:

  1. Any shaders dealing with kernels (blur, erode, dilate etc) need to operate on a pixel basis, so you need to pass in the texture dimensions as a uniform (actually an opengl extension supports textureSize2D(), but I’m not sure how widespread that extension is)

  2. using 0…1 UV coordinates with non-power of 2 textures screws up. More on that here http://forum.openframeworks.cc/t/3d-video-texture/3547/2

P.S. thx for the fix

I am getting the following undeclared error on iPhone with this function in getPixels() (probably because after searching I think this function doesn’t exist in GLES…)


I was gonna ignore this because FBO is a texture, and I need to copy it to either an ofImage or an ofTexture (that is not an FBO…) but whenever I try this, i get operator overload errors from OF…doesn’t seem to want me to do this, I think it doesn’t trust me to allocate properly :wink:

Any advice?

-Steve Varga

I’m trying to compile a project for the iphone using ofxFBOTexture and get
30 errors all related to GLEE or GL, all of them saing xxx was not declared in this scope.

Been trying to find the answer to this for a while, and the closest I came was on this e-mail list:
Pretty old, and might not have any relevance.

I got no missing libraries and it compiles fine when the target is Mac OS.

I’ve tried using the ofxFBOTexture floating around on this forum and found one version that only throws two errors related to the getPixels() function (mentioned in this thread too).

Anyone experienced the same problem? solutions?

Appreciate any help!

. Rikard

Anybody knows if it is possiple to use the ofxFBOTexture to render a movie with alpha channel as texture on iphone - or any other way of doing it?


at the top of this thread memo says the addon can do “custom Field-of-view”.

how would i do that.

i have an fbo that is 3840 x 1080 large and would like to separate views one for the first 1920x1080 and one for the next 1920x180.

any ideas/


ok. i searched around the forum and put this together from some great code snippets out there.

//top left  
	float px0 = xLeft;  
	float py0 = screenHeight-yTop;  
	float tx0 = xLeft;  
	float ty0 = yTop;  
	//top right  
	float px1 = xRight;  
	float py1 = screenHeight-yTop;  
	float tx1 = xRight;  
	float ty1 = yTop;  
	//bottom right  
	float px2 = xRight;  
	float py2 = screenHeight;  
	float tx2 = xRight;  
	float ty2 = 0;  
	//bottom left  
	float px3 = xLeft;  
	float py3 = screenHeight;  
	float tx3 = xLeft;  
	float ty3 = 0;  
	ofTranslate(offsetX, offsetY, 0);  
	glTexCoord2f(tx0, ty0); glVertex2f(px0, py0);  
	glTexCoord2f(tx1, ty1); glVertex2f(px1, py1);  
	glTexCoord2f(tx2, ty2); glVertex2f(px2, py2);  
	glTexCoord2f(tx3, ty3); glVertex2f(px3, py3);  

I’ve been trying to get ofxFBOTexture to work, but have been getting some pretty odd behavior. This is my result from a demo app I found on the boards here:

The top left view is from the camera, the bottom and right views are using ofxFBOTexture. So it looks like the ofxFBOTexture is loading, but just not rendering correctly.

I’m beginning to wonder if there is another option for me? My app needs to draw to off-screen buffers before adding them all together to make a composite image. Is there another option I should look into? In Processing, I used the PGraphics object to achieve this.

make sure you allocate your fbo to the right size.
do you just say fbo.draw() or do you use set pixels.
if you use pixels make sure to clear the pixel array, or image you copy the pixels in to.

maybe post come code of yours.

good luck,

[quote author=“stephanschulz”]
do you just say fbo.draw() or do you use set pixels.[/quote]
I actually fixed it using http://forum.openframeworks.cc/t/fbo-gt;-ofimage-gt;-save-to-file/3019/10. It looks like someImage.grabScreen() doesn’t play nicely with FBO, so using setPixels is the way to go (then you have to flip the image using ofxImage.mirror()).


I went through the post and Im trying to get FBO working on iPhone but got stuck in getPixels()


‘GL_COLOR_ATTACHMENT0_EXT’ was not declared in this scope
‘glReadBuffer’ was not declared in this scope

any ideas?

I’m running into the exact same thing. Anybody able to figure this out? It also looks like memo’s ofxFBOTexture addon is now incorporated into “core” (or so a build note says), but i can’t seem to find it.


@dskill, me too— can anyone explain where the FBO object went, what it’s called now, etc?

thanks! new version looks awesome, just need a map. :slight_smile:

it’s ofFbo


some great slides on what is new in 007 here: