I’m thinking about reducing number of FBOs, and for that I have to use first 5 texture (texture A) outputs for first 3 draw passes that happen for several objects, and then using another texture (texture B) to save the results.
I would like to know whether it would be possible to clear the texture A, without clearing texture B. I know that the glClear function clears all (active?) textures attached to the FBO. However, if all the textures I use are already attached to the FBO, I would need to make sure that texture B is not touched when I need to clear texture A.
Is there a way to diactivate a texture output so that it’s not affected by glClear when needed?
I guess, one way to solve this problem would be to detach/attach texture B, so that it’s not affected by glClear. But I believe that would defeat the purpose, since the FBO would have to be re-verified after I do that, which is time consuming. (I’ve read that somewhere). Is this correct?
Would calling glDrawBuffers to activate specific attachments before calling glClear do the trick?
So something like:
glDrawBuffers(texture A attachment number) glClear(----) . . . . glDrawBuffers(texture B attachment number) glClear(----)