【发布时间】:2011-04-11 21:30:47
【问题描述】:
void CalculateFrameRate()
{
static float framesPerSecond = 0.0f; // This will store our fps
static float lastTime = 0.0f; // This will hold the time from the last frame
float currentTime = GetTickCount() * 0.001f;
++framesPerSecond;
if( currentTime - lastTime > 1.0f )
{
lastTime = currentTime;
if(SHOW_FPS == 1) fprintf(stderr, "\nCurrent Frames Per Second: %d\n\n", (int)framesPerSecond);
framesPerSecond = 0;
}
}
我应该在void play(void) 或void display(void) 中调用这个函数吗?
还是没有区别?
【问题讨论】:
-
什么是
play(void)?请注意,由于 GPU 是不可预测的,所以事情有点复杂:stackoverflow.com/questions/8779936/…