Hi Frederic, I've reviewed the changes and the route you've taken looks to be the most sensible solution - it is API comatible, and doesn't also doesn't affect the IO at all so it just slots in as an extension to the present functionality.
Changes and now merged and checked into svn/trunk. Cheers, Robert. On Fri, May 21, 2010 at 8:15 AM, Frederic Bouvier <[email protected]> wrote: > Hi Robert, > > here is my proposal. It is supposed to be used like this : > > osg::Camera* c = createCamera(); > c->attach( osg::Camera::COLOR_BUFFER0, texture3d, 0, > osg::Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER ); > > it works also for cubemap textures and 2d texture arrays > > Regards, > -Fred > > Le 20/05/2010 08:56, Frederic Bouvier a écrit : >> 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. > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
