Hi, I have a scene graph that contains a (pre-render) camera that renders to an FBO with an attached image. Similar to this:
Code: cam = new osg::Camera; cam->setRenderOrder(osg::Camera::PRE_RENDER); cam->setRenderTargetImplementation(DsTOsgCamera::FRAME_BUFFER_OBJECT); cam->attach(osg::Camera::COLOR_BUFFER, m_RenderTarget, 0, 0, false, 1, 0); Now I want to read the pixel data of that image back to the CPU each frame. I tried using a DrawCall back: Code: class ImageReader : public osg::Camera::DrawCallback { public: virtual void operator() (osg::RenderInfo& renderInfo) const { osg::ref_ptr<osg::Camera> camera = renderInfo.getCurrentCamera(); int x, y, width, height; x = camera->getViewport()->x(); y = camera->getViewport()->y(); width = camera->getViewport()->width(); height = camera->getViewport()->height(); osg::ref_ptr<osg::Image> image = new osg::Image; image->readPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE); osgDB::writeImageFile(*image,"image.png"); } } and adding it to the camera: Code: cam->setFinalDrawCallback(new ImageReader()); What happens is that not the rendered image of that camera is captured, but instead the output of the whole scene graph. How can I correctly access the rendering result of an FBO camera? Thank you! Cheers, Marius ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69901#69901 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org