PDA

View Full Version : glDrawBuffer/glReadBuffer framebuffer state



RealtimeSlave
03-09-2014, 10:23 AM
Hello,

are changes made with glDrawBuffer or glDrawBuffers stored in the state of current GL_DRAW_FRAMEBUFFER
and changes made with glReadBuffer stored in the state of current GL_READ_FRAMEBUFFER?

So for example this code

glBindFramebuffer(GL_READ_FRAMEBUFFER, BufferA);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, BufferB);
glReadBuffer(GL_FRONT);
would only change the state of BufferA?

Thanks!

Osbios
03-10-2014, 09:39 AM
glWriteBuffer/glWriteBuffers/glReadBuffer are global states and are not bound to framebuffer objects.

arekkusu
03-10-2014, 12:13 PM
glWriteBuffer/glWriteBuffers/glReadBuffer are global states and are not bound to framebuffer objects.
This is incorrect.

glDrawBuffer/glReadBuffer state is tracked in framebuffer objects. Open your spec and check the state table near the end. Look at the "Framebuffer (state per framebuffer object)" table.




are changes made with glDrawBuffer or glDrawBuffers stored in the state of current GL_DRAW_FRAMEBUFFER
and changes made with glReadBuffer stored in the state of current GL_READ_FRAMEBUFFER?
Correct.

You can quickly verify this, binding different frame buffers, changing state, and introspecting with glGetIntegerv.

RealtimeSlave
03-11-2014, 12:26 PM
Thanks for the clarification!