I have a framebuffer object in which I use Multi Target Rendering on N textures binded to it. At a certain time, I want to clear the content of some of those textures, but not all of them. If I call
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
every texture binded to the FBO is going to be cleared (am I right?). Is there a way to do this on specific draw buffers/textures?
The GL_COLOR_BUFFER_BIT
in the glClear
call will clear all of the active draw color buffers, as specified via glDrawBuffers
. So you could change the draw buffers before executing a clear.
But that's needless state changing. You can simply call glClearBuffer
, which will clear a particular buffer.
It will be all buffers. You can mask out buffers for clear with glColorMask though. http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With