Hello,

The context:
----------------
Using GL_EXT_gpu_shader4 extension.
Using GL_ARB_geometry_shader4 extension.
OpenGL context is 2.0

The problem:
------------------
I am sending a single draw call (point primitive) using a program that has a vertex, geometry and pixel shader. The render target is a 3D texture. The geometry shader generate a point primitive and use gl_Layer to redirect it to the proper layer. That is, each point in the original primitive ends up in a single voxel. Layer 0 is fine but all the others never get rendered into. I also noticed glClear() does not clear all the layers even if GL_ARB_geometry_shader4 says it should.

The 3D texture is a osg::Texture3D. The FBO counter part is a class of my own (since osg::FrameBufferObject does not support glFramebufferTexture()). Basically, this class derives from osg::StateAttribute and I overrid compare(), apply(), compileGLObjects() and releaseGLObjects() methods.

The fbo is created with:
    glGenFramebuffers(1, &fbo)
    glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo)
glFramebufferTexture(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, 3dTextureId, 0); // 3dTextureId gotten from osg::Texture::TextureObject and made sure it is not 0

It is used afterward with:
    glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo)

I also disabled the depth test, alpha test, scissor test, the culling and set the viewport to the size of the 3D texture.

Extensive use of gDebugger has not shown any error/warning.


The question:
------------------
Any pointer as to what is going wrong? Does someone has any experience with layered rendering (that is, using gl_Layer and only 1 draw call)? A very simple sample will be greatly appreciated.

Thanks.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to