Jump to content

Image of the Day

Everything is fine. 

#screenshotsaturday #indiedev #gamedev https://t.co/98BAKUInyo
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Frame Per Second in OpenGL

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 Shawn619   Members   

342
Like
0Likes
Like

Posted 30 June 2013 - 05:21 PM

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?


Edited by Shawn619, 30 June 2013 - 05:33 PM.


#2 Sponji   Members   

2358
Like
2Likes
Like

Posted 01 July 2013 - 01:11 AM

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


Derp

#3 Shawn619   Members   

342
Like
0Likes
Like

Posted 01 July 2013 - 05:32 PM

Thanks!



#4 MarkS   Members   

3347
Like
0Likes
Like

Posted 02 July 2013 - 12:47 PM

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






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.