Use a PostDrawCallback. During the callback the OpenGL context is still
current in all multithreading settings.
You can do something like:
class ScreenShotCallback: public osg::Camera::DrawCallback
{
...
void operator() (const osg::Camera &camera) const
{
// x, y, width and height may be some class members of
ScreenShotCallback
osg::Image *image = new osg::Image;
image->readPixels(x, y, width, height, GL_RGB,
GL_UNSIGNED_BYTE);
osgDB::writeImageFile(*image, "capture.bmp");
}
};
viewer.getCamera()->setPostDrawCallback( new ScreenShotCallback() );
Eduardo Gutiérrez Sanmartín schrieb:
> Thanks Richard, but I put
>
> viewer.setThreadingModel( osgViewer::ViewerBase::SingleThreaded );
>
> and the capture is black again.
>
> I'm using Windows XP in a Pentium IV with a GeForce 6600.
>
> Another idea?
>
> Edu
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org