PDA

View Full Version : FBO 2nd & 3rd render targets not drawing



BrianDFS
04-04-2010, 02:24 PM
My search-fu isn't the best so apologies if this has already been clearly covered somewhere.

I'm trying to get multiple render targets working. As the title indicates, I'm having no luck getting anything written to the 2nd or 3rd COLOR_ATTACHMENTs.

A few quick questions, when answered will probably help me out:

1. Is it necessary to call glBindFragDataLocation? If so, should it be called before or after linking the shader program?

2. Is it necessary to call glDrawBuffers? If so, is there a prescribed point at which it should be called? e.g. before of or after the call to glBindFramebuffer?

3. Is it necessary to call glDrawBuffer( GL_BACK ) when preparing to render to the default window's back buffer? If so, like #2 should it be called before or after glBindFrameBuffer( GL_FRAMEBUFFER, 0 )?

4. The 3.1 spec indicates that GL_FRAMEBUFFER and GL_DRAW_FRAMEBUFFER are to be treated the same. Should one be preferred over the other?

Thanks.

Alfonse Reinheart
04-04-2010, 02:52 PM
Is it necessary to call glBindFragDataLocation? If so, should it be called before or after linking the shader program?

See Here. (http://www.opengl.org/wiki/GLSL_Object#Program_linking)


Is it necessary to call glDrawBuffers? If so, is there a prescribed point at which it should be called? e.g. before of or after the call to glBindFramebuffer?

See Here. (http://www.opengl.org/wiki/Framebuffer_Objects#Multiple_Render_Targets)


The 3.1 spec indicates that GL_FRAMEBUFFER and GL_DRAW_FRAMEBUFFER are to be treated the same. Should one be preferred over the other?

I prefer to be more specific. GL_FRAMEBUFFER is a legacy enumerator, and to be honest, I wish they hadn't used it in the ARB_framebuffer_objects extension/core functionality.