• Advertisement

Archived

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

fps counter

This topic is 6066 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

Advertisement
You have to count the number of frames you draw in a static int for example


static int frames = 0;
static DWORD lastTimeFPS = 0; //time when the last calculation took place
DWORD curTime = timeGetTime();
++frames;

// Update the scene stats once per second
if( curTime - lastTimeFPS > 1000 )
{
curFPS = 1000 * frames / (float)(curTime - lastTimeFPS);
lastTimeFPS = curTime;
frames = 0;
}


You must call this code every time you have finished to redraw a frame, then it will update "curFPS" every second. This you could printf or draw to the screen. The core of the code is the timeGetTime(); You must therefore #include "mmsystem.h" and link with winmm.lib

Sorry for my extraordinary bad english

Edited by - cha Mithrandir on September 8, 2001 11:31:05 AM

Share this post


Link to post
Share on other sites
quote:
Original post by EddieCai
that''s to say, you must manage your fps counter all by yourself, right?



Yes.

Share this post


Link to post
Share on other sites

  • Advertisement