Added screen capture handler to present3D, with the PrtScn button used for a single frame capture and 'm' for continuous frame capture.
The --screenshot filename command line option can be used to configure the name of the screen capture.
This commit is contained in:
parent
215512647c
commit
76396d0c12
@ -646,6 +646,17 @@ int main( int argc, char **argv )
|
|||||||
PointsEventHandler* peh = new PointsEventHandler;
|
PointsEventHandler* peh = new PointsEventHandler;
|
||||||
viewer.addEventHandler(peh);
|
viewer.addEventHandler(peh);
|
||||||
|
|
||||||
|
// add the screen capture handler
|
||||||
|
std::string screenCaptureFilename = "screen_short.jpg";
|
||||||
|
while(arguments.read("--screenshot", screenCaptureFilename)) {}
|
||||||
|
osg::ref_ptr<osgViewer::ScreenCaptureHandler::WriteToFile> writeFile = new osgViewer::ScreenCaptureHandler::WriteToFile(
|
||||||
|
osgDB::getNameLessExtension(screenCaptureFilename),
|
||||||
|
osgDB::getFileExtension(screenCaptureFilename) );
|
||||||
|
osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler = new osgViewer::ScreenCaptureHandler(writeFile.get());
|
||||||
|
screenCaptureHandler->setKeyEventTakeScreenShot(osgGA::GUIEventAdapter::KEY_Print);
|
||||||
|
screenCaptureHandler->setKeyEventToggleContinuousCapture('m');
|
||||||
|
viewer.addEventHandler(screenCaptureHandler.get());
|
||||||
|
|
||||||
// osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false);
|
// osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false);
|
||||||
|
|
||||||
float width = osg::DisplaySettings::instance()->getScreenWidth();
|
float width = osg::DisplaySettings::instance()->getScreenWidth();
|
||||||
|
Loading…
Reference in New Issue
Block a user