Depending on our hardware, the viewer may run in multithreaded mode, which 
means you can't access the openGL context everytime everywhere. Try setting 
your viewer into singlethreaded mode with ViewerBase::setThreadingModel( ... ) 
. The context should be available all the time now...

 

Richard

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eduardo 
Gutiérrez Sanmartín
Sent: Friday, November 16, 2007 1:47 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Taking screenshots using OSG 2.2

 

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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to