Hi Edurado,
The osgViewer::Viewer can will run multi-threaded by default in you
have enough CPU cores available, and can open up multiple windows in
you have multiple screens, both these issues mean that the thread that
runs the main frame loop will not always have a valid graphics context
current so its not sensible to do OpenGL calls from the frame loop.
The way to do it is to add a post draw camera callback, this is called
after render of the camera contents.
Robert.
On Nov 16, 2007 12:46 PM, Eduardo Gutiérrez Sanmartín
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> While using OSG version 1.20, I was taking screenshots with the following
> code:
>
> while( !viewer.done() )
> {
> viewer.frame();
>
> // Here I get x, y, width and height.
>
> osg::Image *image = new osg::Image;
> image->readPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE);
> osgDB::writeImageFile(*image, "capture.bmp");
> }
>
> The obtained image was correct - however, with OSG 2.2 it is not.
> I am obtaining a totally black image (and it seems that x, y, width and
> height are the right values).
>
> Is there something wrong here? How do I take a screenshot of my application?
>
> Thx!
>
> Edu
>
>
> _______________________________________________
> 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