Hi Rick -- That's a piece of code I've looked at, and scratched my head a little, but I think it's right.
Adding the xy to the width and height makes sense. OSG is trying to compute the total space required for rendering. If your viewport is (200,50,800,600), then the total number of pixels you need in that buffer is: ( (200+800) * (50+600) ) pixels. If you fail to add in the xy values, the resulting buffer will not be big enough. I'm curious if you have small reproducer code that shows this is really an issue? Because what I hear you saying is: * You render to a texture (presumable with the default viewport) * Then you render that texture in a scene with xy viewport offsets. So in that case, there would be two render stages: * In the first stage, all the buffer attachments would be the size of your destination texture, which presumably uses the default viewport with (0,0) xy offsets. * Only the second stage would need buffer attachments whose size incorporates the non-zero xy viewport offsets. The two sets of buffers should be consistent within each render stage and you should not get an OpenGL error. Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com +1 303 859 9466 -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Rick Appleton Sent: Monday, April 06, 2009 8:39 AM To: [email protected] Subject: [osg-users] RTT and viewport offset Hi, I've encountered an issue with rendering to texture and then displaying that texture with a viewport that doesn't start at 0,0. I'm using osgPPU for this, but I believe the issue is in OSG. In osgUtil/RenderStage.cpp, in RenderStage::runCameraSetUp the width and height are calculated as: int width = static_cast<int>(_viewport->x() + _viewport->width()); int height = static_cast<int>(_viewport->y() + _viewport->height()); This width and height is then used to create RenderBuffers for the missing attachments. If the viewport starts at non-zero values, this means the created RenderBuffers will not have dimensions (vp->width, vp->height) whereas the attached texture likely will have those dimenstions. Thus the FBO will then generate FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT error. Removing the additions of _viewport->x()/y() fixes my issue. I was wondering if there was a good reason for doing it the way it's done. Kind regards, Rick ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9797#9797 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

