4
$\begingroup$

glReadBuffer(...)/glDrawBuffer(...)/glDrawBuffers(...) access part of a framebuffer's state.

For reading the default framebuffer, this is GL_FRONT or GL_BACK. However, the documentation doesn't say what it is for FBOs. The only thing I found was an offhand comment here stating that the default is GL_COLOR_ATTACHMENT0 (which is what I would guess). Can I rely on that?

For writing, I didn't immediately find any claims what what color buffers are enabled.

$\endgroup$

1 Answer 1

3
$\begingroup$

You can usually track down the answer for such questions in the OpenGL specification. Assuming the value you care about is consistent across OpenGL versions (often the case for initial values, seldom the case for minimum values).

In this case, in the GL 4.5 specification, check out the following:

  • glReadBuffer(...) initial value: (default framebuffer: GL_FRONT iff single-buffered, GL_BACK iff double-buffered) (FBO: GL_COLOR_ATTACHMENT0) (see page 506)
  • glDrawBuffer(...) initial value: (see glDrawBuffers(...))
  • glDrawBuffers(...) initial value: (default framebuffer: fragment color 0 goes to GL_FRONT iff single-buffered, GL_BACK iff double-buffered) (FBO: fragment color 0 goes to GL_COLOR_ATTACHMENT0) (both: fragment colors other than 0 go to GL_NONE) (see page 497)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.