#include #include #include #include #include #include #include using namespace std; using namespace chrono; auto lastFT = system_clock::now(); auto FT = system_clock::now(); int main(int argc, char** argv) { // 创建一个OSG Viewer对象 osgViewer::Viewer viewer; viewer.setUpViewInWindow(50, 50, 800, 600); viewer.getCamera()->setClearColor(osg::Vec4(0.2, 0.2, 0.2, 1.0)); viewer.setCameraManipulator(new osgGA::TrackballManipulator); viewer.addEventHandler(new osgViewer::StatsHandler);//查看帧数 s // 创建一个OSG Node对象,并加载OSG模型 osg::ref_ptr model = osgDB::readNodeFile("clock.osgt"); // 将Node对象添加到OSG Viewer中 viewer.setSceneData(model); // 启动OSG Viewer循环 while (!viewer.done()) { auto thisFT = system_clock::now(); auto FT = duration_cast(thisFT - lastFT); lastFT = thisFT; viewer.frame(); } return 0; }