PDA

View Full Version : Need help rendering 3D texture using GS gl_Layer



BrianDFS
05-18-2010, 01:41 PM
I'm having no luck attempting to rendering to a 3D texture using instancing and a geometry shader with gl_Layer.

glGetError is coming back clean everywhere. All three stages of the shader program compile and link successfully.

I'm using:
glFramebufferTexture( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, VolumeTextureID, 0 );
to attach the 3D texture to the FBO. glCheckFramebufferStatus indicates the FBO is complete.

If I attempt to render this texture at the top of the frame with a simple pass-through geometry shader, something goes wrong. None of the objects rendered to another FBO afterwards get drawn. It's as if something has borked GL for the rest of the frame.

However, I'm inclined to believe this has nothing to do with the FBO + 3D texture setup and everything to do with the shader program that uses the GS. Because if I render to the FBO + 3D texture with a non-geometry shader program, the rest of the frame renders correctly.

I've tested this on both ATI and NVidia cards, and the behavior is the same. So it's likely something I'm doing wrong.

I guess I'll get to the layer selection part of the help after I get this blank screen issue sorted out first.

Or, does anyone have any working sample code doing just that? Rendering to a 3D texture using instancing and gl_Layer in the GS?

Any tips, suggestions, ideas? Thanks.