You most likely do not have a valid Opengl Context as you doing this in the main Application thread You will need to make you application single threaded if you want to do it this way Or the traditional way would be with a post draw call back ( there are many examples floating around )
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carlos Sanches Sent: Friday, June 27, 2008 2:07 PM To: OpenSceneGraph Users Subject: Re: [osg-users] How to take a picture of my scene? My code : osg::Image *Ximage; osg::Camera* cam = new osg::Camera; cam->setProjectionMatrixAsPerspective(20,1,20,1000000); cam->setViewport(0,0,640,180); cam->setClearColor(osg::Vec4(0.7,0.7,1,1)); osgViewer::Viewer viewer; viewer.setSceneData( root ); viewer.setCameraManipulator(new osgGA::TrackballManipulator); // viewer.setCamera(cam); viewer.addEventHandler( new myKeyboardEventHandler ); viewer.realize(); while( !viewer.done() ) { cam->setViewMatrixAsLookAt( osg::Vec3(posx,posy,posz), osg::Vec3(tposx,tposy,tposz), osg::Vec3(0,0,1) ); Ximage->readPixels(100,100,640,480, GL_RGBA, GL_UNSIGNED_BYTE); osgDB::writeImageFile(*Ximage,"teste.bmp"); viewer.frame(); } The image teste.bmp is black . I m trying the example osgScreenCapture but some errors is appearing . <http://www.somarmeteorologia.com.br>
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org