Archived

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

FPS question

This topic is 5791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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];
LARGE_INTEGER qwTicksPerSec;
LARGE_INTEGER qwTime;
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