Archived

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

frame rates

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

Well, I use timeGetTime to determine the fps and I have heard that alot of other ppl use it to. So I include a snippet of a fps counter

#include
#include // timeGetTime() is in this on

// ...

static DWORD flNewElapsedTime;
static DWORD flOldElapsedTime = 1;
static int flFrameRate = 0;


// In the main game loop (before the render/calc/AI):

flNewElapsedTime = timeGetTime();

// and when all the stuff is done:

flFrameRate = (int)(1000/(flNewElapsedTime - flOldElapsedTime));
flOldElapsedTime = flNewElapsedTime;
flNewElapsedTime = timeGetTime();

// And there it is

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You could also use the Performance timer. Which to me, seems more to be a more accurate timer.

QueryPerformanceCounter and QueryPerformanceFrequency should be the only two functions you need.

Share this post


Link to post
Share on other sites
This has probably been covered before but I couldn't find any previous posts on it..

how to determine the fps in a directX app. do you just have a static counter in your game loop and use windows' timer functions to determine when a second passes, then show the value and reset it to zero? are windows' timer functions very accurate? or how could you accomplish this using GetTickCount() ?

Thanks

------------------

"can't waste the day when the night brings a hearse"

Share this post


Link to post
Share on other sites
When you see link errors like this, just do a search in the online help for the function to see what import lib you need. In this case, you''ll find (amoungst other things)


Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.


Thanks,


Notwen

Share this post


Link to post
Share on other sites