FBO vector - pushback doesn't copy correctly - what am I missing?

I’ve run into this problem a few times in the past and I usually end up using an array of FBO’s instead of a vector.

What is the proper way to push back an FBO into a vector? I imagine there is some GL stuff going on that’s overwriting the memory I’m pushing back and it’s not a true copy.

I’ve also tried doing like:

tempTexture = fbo.getTextureReference();

but when I do that, on each push, all the images in the vector become the same image (they become the newest one).

gl objects in OF don’t make deep copies as any other c++ object usually behaves. when you copy something like a texture it actually becames a reference to the original so if you modify one of them the other will be mofidied too. that’s probably what’s going on when you push_back a texture.

pushing fbo’s in a vector should work though just remember that you need to create a new instance of the fbo each time you push it in the fbo

Ah…that does it…nice

I’m doing this now and it seems to be working correctly…not sure how efficient it’s being…just playing right now

//in a loop
ofFbo tempFbo



yes that’s it, i wouldn’t do that in draw, every frame. if you are doing it in setup is ok though. if you want to do it every frame better create a vector of fbo’s that way in setup and then in draw update them instead of allocating them every time