This topic is now archived and is closed to further replies.


FPS question

Recommended Posts

taliesin8    122
I have this small ogl application I''m working for. So far, I only have the window, directinput and fonts done, and I''m currently working/learning on a particle engine (or whatever its called). Anyway, I wanted to print the FPS on my application. I used 2 methods. The opengl game programming one and the method I thought was intuitive. The first method never give me more than 85 fps, while I can get as high as 280 with the second one. I have a althon 1.2, with a GeForce2. Which one of these 2 counts (85 and 260) is more accurate? Also, where can I learn more about how to calculate fps in an application?

Share this post

Link to post
Share on other sites
Anozireth    122
Well, first off, if you got different numbers in your two routines, then at least one of them has a problem. As for how to do it, here is a snippet of code that I use (it's for windows)
// Do FPS Calculations.

CHAR strFps[50];
double fTime;
double fDifference;

QueryPerformanceFrequency( &qwTicksPerSec );
QueryPerformanceCounter( &qwTime );
fTime = qwTime.QuadPart;
fFps = (FLOAT) qwTicksPerSec.QuadPart / (fTime - dwTimer);
dwTimer = fTime;
sprintf(strFps, "%3.2f", fFps);

hope that helps...

edit: formatting code to look right...
edit2: my new sig seems to mess up the page so I deleted it.

Edited by - Anozireth on January 29, 2002 2:28:54 AM

Edited by - Anozireth on January 29, 2002 2:35:46 AM

Share this post

Link to post
Share on other sites