[osg-users] Read frame buffer back into main memory
Antoine Rennuit
antoinerennuit at hotmail.com
Tue Mar 6 09:44:27 PST 2018
Hello Robert,
And thanks for you message. I am trying to write the image to a file using
Code:
class ReadPixelsCallback : public osg::Camera::DrawCallback
{
public:
virtual void operator()( osg::RenderInfo& renderInfo ) const
{
osg::GraphicsContext* gc = renderInfo.getState()->getGraphicsContext();
int width = gc->getTraits()->width;
int height = gc->getTraits()->height;
osg::ref_ptr<osg::Image> image = new osg::Image;
image->readPixels(0, 0, gc->getTraits()->width, gc->getTraits()->height, GL_RGB, GL_UNSIGNED_BYTE);
bool retValBmp = osgDB::writeImageFile(*image, "/home/enjyi/testImage.bmp");
bool retValJpg = osgDB::writeImageFile(*image, "/home/enjyi/testImage.jpg");
}
};
but all I get is
Code:
Error writing file /home/arennuit/testImage.bmp: Warning: Could not find plugin to write image to file "/home/arennuit/testImage.bmp".
Error writing file /home/arennuit/testImage.jpg: Warning: Could not find plugin to write image to file "/home/arennuit/testImage.jpg".
Any idea why OSG cannot my plugins?
Regards,
Antoine.[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73025#73025
More information about the osg-users
mailing list