Frame Per Second in OpenGL

Started by
2 comments, last by MarkS_ 10 years, 9 months ago

I'm not entirely sure what the frames per second is in my opengl game. My main() goes like this:


int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(windowWidth, windowHeight);
glewInit();
GLenum err = glewInit();
if(GLEW_OK != err) {
cout << "glewInit error." << endl;
}
initRendering();
glutSetCursor(GLUT_CURSOR_NONE); 
glutDisplayFunc();
glutMouseFunc();
glutMotionFunc();
glutPassiveMotionFunc();
glutKeyboardFunc();
glutKeyboardUpFunc();
glutTimerFunc(FPS, update, 0);
glutMainLoop();
system("pause");
return 0;
}

So since if FPS=60, does that mean the fps is locked at 60 and never changes, except in the case lag?

Advertisement

Googling "glutTimerFunc" says that the first parameter is in milliseconds, not in fps. You probably want to use 1000/FPS instead.

Derp

Thanks!

You probably want to use 1000/FPS instead.

1000 / FPS is actually frame time (ms per frame) and not FPS, of which I am sure that Sponji is aware. This is a much better profiling metric than frames per second.

Read: http://www.mvps.org/directx/articles/fps_versus_frame_time.htm

This topic is closed to new replies.

Advertisement