|
发表于 2017-4-9 19:57:20
|
显示全部楼层
osg::Timer* timer= new osg::Timer;
osg::Timer_t start_T=0,start_T2=0, end_T=0,end_T2=0;
int count = 0;
while (!viewer->done())
{
if (count == 0)
{
start_T2 = timer->tick();
}
start_T = timer->tick();
viewer->frame();
end_T = timer->tick();
std::cout << "即时帧率为: " << 1 / timer->delta_s(start_T, end_T) << std::endl;
count++;
if (count == 5)
{
end_T2 = timer->tick();
std::cout << "平均帧率为: " << 5 / timer->delta_s(start_T2, end_T2) << std::endl;
count = 0;
}
} |
|