diff --git a/applications/present3D/present3D.cpp b/applications/present3D/present3D.cpp index 5cd4c819c..629fb8b9f 100644 --- a/applications/present3D/present3D.cpp +++ b/applications/present3D/present3D.cpp @@ -645,7 +645,18 @@ int main( int argc, char **argv ) // register the handler for modifying the point size PointsEventHandler* peh = new PointsEventHandler; viewer.addEventHandler(peh); - + + // add the screen capture handler + std::string screenCaptureFilename = "screen_short.jpg"; + while(arguments.read("--screenshot", screenCaptureFilename)) {} + osg::ref_ptr writeFile = new osgViewer::ScreenCaptureHandler::WriteToFile( + osgDB::getNameLessExtension(screenCaptureFilename), + osgDB::getFileExtension(screenCaptureFilename) ); + osg::ref_ptr screenCaptureHandler = new osgViewer::ScreenCaptureHandler(writeFile.get()); + screenCaptureHandler->setKeyEventTakeScreenShot(osgGA::GUIEventAdapter::KEY_Print); + screenCaptureHandler->setKeyEventToggleContinuousCapture('m'); + viewer.addEventHandler(screenCaptureHandler.get()); + // osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false); float width = osg::DisplaySettings::instance()->getScreenWidth();