Hi everyone! I'm trying to retrieve data from the color buffer at each rendered frame. I'm new on OSG and everything I tried didn't work as expected. I use a composite viewer, and my example is about to retrieve the color buffer from the first view of this composite viewer.
The first thing I tried is to bind the color buffer to an osg image and to save it as a bmp. Code: osgViewer::CompositeViewer viewer; ... viewer.stopThreading(); osg::ref_ptr<osg::Camera> camera = viewer.getView(0)->getCamera(); osg::ref_ptr<osg::Image> color_buffer= new osg::Image; color_buffer->allocateImage(1024, 768, 1, GL_RGBA, GL_UNSIGNED_BYTE); camera->attach(osg::Camera::COLOR_BUFFER, color_buffer.get()); view->getViewerBase()->frame(); osgDB::writeImageFile(*color_buffer.get(),"color_cmp_"+ss.str()+".bmp"); viewer.startThreading(); It works well, but only for the first frame. I mean color_0.bmp is the image I want, and color_1.bmp (color_2, etc.) are black images. Any ideas why it only works for the first frame? The second thing I tried is to use a ScreenCaptureHandler. What I did worked for each frame, but the image is directly stored as an image on the hard drive. Is it possible to save it as an osg::Image? I heard about Camera Callbacks but nothing I did with it worked. Thank you! Cheers, Nicolas[/code] ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47671#47671 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

