Hi Robert,

----- "Robert Osfield" a écrit :

> HI Fred,
> 
> > I would like to use the glFramebufferTextureEXT function introduced
> in the EXT_geometry_shader4 extension. My need is to control the layer
> of the 3D texture target with the gl_Layer variable present in
> geometry shaders. For the moment, I hacked the FrameBufferObject
> sources to replace the call to glFramebufferTexture3D (which needs a
> fixed zoffset) by a call to glFramebufferTexture that rely on
> gl_Layer.
> >
> > I volunteer to propose something cleaner but I would like to read
> some implementations tips or ideas on how to do this.
> 
> I'm not familiar with this extension yet, so can't provide an tips
> off the cuff.  I'll need to learn about the extension and how it's used.
> 
> I could happily use your modifications as means of learning how it's
> used and then give you feedback ;-)

The change I made is straightforward :

Original code, FrameBufferObject.cpp, line 536 :
    case Pimpl::TEXTURE3D:
        ext->glFramebufferTexture3D(target, attachment_point, GL_TEXTURE_3D, 
tobj->id(), _ximpl->level, _ximpl->zoffset);
        break;

New code :
    case Pimpl::TEXTURE3D:
        ext->glFramebufferTexture(target, attachment_point, tobj->id(), 
_ximpl->level);
        break;

plus the initialising code to get the glFramebufferTexture pointer.

The EXT_geometry_shader4 extension says that you can control the zoffset 
parameter in the original code by setting the gl_Layer inside the geometry 
shader. That way you can draw to the whole 3D texture target, instead of having 
to draw layer by layer. This is also useful when rendering to a cube map 
texture because you can control the targeted face. Same with 2D texture arrays.

BTW, I didn't see how to control the zoffset parameter in the original code.

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

Reply via email to