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)
中調用此函數?如何計算OpenGL中的FPS?
或者它沒有任何區別?
什麼是'play(void)'?請注意,由於GPU是不可預知的,因此情況會更復雜一點:http://stackoverflow.com/questions/8779936/correct-way-to-calculate-the-fps – 2016-03-17 08:16:49