Hi Michael, A Texture attached to an osg::Camera for RTT will not have an osg::Image assigned to it, it's assigned to a frame buffer object instead.
What you need to do is attach a final draw callback on the RTT Camera that does a osg::Image::readPixels(..) or osg::Image::readImageFromCurrentTexture(..). You could leave this callback attached all the time and just have a flag in it that toggles on/off whether the read to image needs to be done or not. Robert. On 19 May 2015 at 14:24, michael kapelko <[email protected]> wrote: > Hi. > I have osg::Texture that is attached to camera, it contains a rendered scene > (deferred rendering). I want to save it to a PNG file. > I tried to use osg::Texture::getImage(), but the resulting osg::Image seems > to be invalid, because osgDB::writeImageFile() crashes with it. > What's the correct way to convert Texture to Image? > Thanks. > > _______________________________________________ > 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

