OSG常⽤快捷键(全屏、查看帧数、截屏)⼀、全屏
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osgGA/GUIEventAdapter>
#include <osgViewer/ViewerEventHandlers>
int main()
{
osg::ref_ptr<osgViewer::Viewer> view = new osgViewer::Viewer;
osg::ref_ptr<osg::Node> node = new osg::Node;
//node = osgDB::readNodeFile("glider.osg");
node = osgDB::readNodeFile("cow.osg");
view->addEventHandler(new osgViewer::WindowSizeHandler);//全屏快捷键f
view->setSceneData(node);
return view->run();
}
⼆、查看帧数
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osgGA/GUIEventAdapter>
#include <osgViewer/ViewerEventHandlers>
int main()
{
osg::ref_ptr<osgViewer::Viewer> view = new osgViewer::Viewer;
osg::ref_ptr<osg::Node> node = new osg::Node;
//node = osgDB::readNodeFile("glider.osg");
node = osgDB::readNodeFile("cow.osg");
//⽅法⼀
// view->addEventHandler(new osgViewer::StatsHandler);//查看帧数 s
//⽅法⼆
osgViewer::StatsHandler* pStatsHandler = new osgViewer::StatsHandler;
pStatsHandler->setKeyEventTogglesOnScreenStats(osgGA::GUIEventAdapter::KEY_F11);
view->addEventHandler(pStatsHandler);
view->setSceneData(node);
return view->run();
}
三、截图
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osgGA/GUIEventAdapter>
#include <osgViewer/ViewerEventHandlers>
全屏快捷键int main()
{
osg::ref_ptr<osgViewer::Viewer> view = new osgViewer::Viewer;
osg::ref_ptr<osg::Node> node = new osg::Node;
/
/node = osgDB::readNodeFile("glider.osg");
node = osgDB::readNodeFile("cow.osg");
view->addEventHandler(new osgViewer::ScreenCaptureHandler);//截图快捷键 c
view->setSceneData(node);
return view->run();
}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论