20,741
edits
Line 263: | Line 263: | ||
camera->attach(osg::Camera::COLOR_BUFFER, shot); | camera->attach(osg::Camera::COLOR_BUFFER, shot); | ||
osgDB::writeImageFile(*shot,"canvasImage.png"); | osgDB::writeImageFile(*shot,"canvasImage.png"); | ||
</syntaxhighlight> | |||
In Canvas space, we can directly access the _texture, e.g.: | |||
<syntaxhighlight lang="cpp"> | |||
osg::ref_ptr<osg::Image> image = getTexture()->getImage(); | |||
osgDB::writeImageFile( *image, "canvasImage.png" ); | |||
</syntaxhighlight> | </syntaxhighlight> | ||