Hi Forest, You can only do OpenGL calls from a thread with a valid graphics context current, event handlers will not have a graphics context current unless you are running the OSG single threaded.
Use a Camera post or final draw callback to capture the screen image. Robert. On Mon, Jan 11, 2010 at 10:53 AM, forest <[email protected]> wrote: > hi all, > I want to capture the screen ,what I have done is to add a eventhandler in > which I add code like this > > osg::ref_ptr<osg::Image> image = new osg::Image; > image->readPixels(0,0,m_iWidth,m_iHeight, GL_RGB,GL_UNSIGNED_BYTE); > osgDB::writeImageFile(*image,"D:\\abc.bmp"); > > what I get is blank image. > I googled that maybe I should do this in DrawCallBack. I eagerly want to > know why my code doesn't work. Is pixel in FBO erased before EventTraverse ? > > Thanks for any hint > best regards > forest > _______________________________________________ > 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

