/* SWWViewer An OpenSceneGraph viewer for pyVolution SWW files. copyright (C) 2004-2005 Geoscience Australia */ #include #include #include #include #include bool saveImage(unsigned int playback_index, CustomViewer viewer, std::string moviedir) { int x, y; unsigned int width, height; viewer.getCamera(0)->getProjectionRectangle(x, y, width, height); osg::ref_ptr image = new osg::Image; image->readPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE); if ( osgDB::writeImageFile(*image, "image.jpg") ) { std::cout << "Saved image " << playback_index << std::endl; return true; } return false; }