calculating frame rate and displaying it

Started by
3 comments, last by opendep 16 years, 2 months ago
hello, can anyone tell me how to calculate frame rate in open gl and display it.. my program (VC++ WIN32 project) displays 1000 cubes by calling the display function in nested for loops creating a grid like structure... using the regular text display techniques here causes a win32 exception. thank you very much
Advertisement
What exception are you getting?
if you do not require the FPS display built into your program, just use fraps
www.fraps.com (i think )
This is how I do it in Opengl. It does not print it on the game screen but rather on the Run screen. I believe it works very good.



int startTime, endTime;

startTime = glutGet(GLUT_ELAPSED_TIME);
endTime = glutGet(GLUT_ELAPSED_TIME);


printf("Speed %.3f frames/sec (%d ms)\n", 1000.0/(endTime-startTime), endTime-startTime);
Thank you...

This topic is closed to new replies.

Advertisement