Thank you Paul. The reason why I need to render in background is this: I need to save an image of my model with a different camera position and orientation than that currently visible to the user on the screen (i.e. in the front buffer). So, I thought that I could draw my model from a different point of view in the back buffer, without swapping. Then get it by reading pixels from the back buffer, and saving the pixmap in an image file. Finally, restore the camera position and orientation, and resume in swapping back and front buffers after drawing. So, the complete operation would be completely hidden to the user. I always did it using standard OpenGL calls (glDrawBuffers(...), glReadPixels(...), etc...) since I could control whether and when swapping the buffers or not. I wondered why OSG does not allow such an operation, I thought it is a limitation. But now you're saying that OSG provides a better way to do that. Could anyone give me some more tips and suggestions (I'm still a newbie to OSG)?
Thanks in advance Gianluca -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Paul Martz Sent: mercoledì 27 gennaio 2010 19.25 To: OpenSceneGraph Users Subject: Re: [osg-users] drawing in back buffer without swapping? From a little code digging, there doesn't appear to be a way to turn this off. ViewerBase::startThreading always adds a SwapBuffersOperation per render thread, and SwapBuffersOperation::operator() always calls swapBUffersImplementation and clear. Maybe there's a way to delete that Operation and add your own. Or you could derive your own GraphicsContext that allows you to make swapBuffersImplementation a no-op, I guess. Or you could set up the Viewer embedded, in which case creating the context and swapping is up to you and no longer managed by osgViewer. But I guess I'd wonder why you need to do this in the first place. If you need to partially render, then do some app code, then render some more before swapping, OSG has many facilities for this already. So can you explain why you think you need to render into the back buffer but not swap? -Paul Gianluca Natale wrote: > > > Hi all. > I have an osg::viewer and its associated graphics context, that is a > double buffered context. > > I need to draw in the back buffer without swapping the back and front > after rendering traversal. > > How can I do that? > > I cannot find a way to disable the swapping after drawing in > osgViewer::Viewer and in osg::GraphicsContext. > > > > Thanks in advance > > Gianluca > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > 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 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

