Hi Carlos, You code will only work when running the viewer in SingleThreaded. Please use a camera final/post draw callback for your glReadPixel calls, as suggested.
Robert. On Fri, Jun 27, 2008 at 7:06 PM, Carlos Sanches <[EMAIL PROTECTED]> wrote: > 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 . > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org