• Advertisement

Archived

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

how to get framerate

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

is there some sort of formula to use that can determine your current framerate? i''m using a timer to render at 60FPS but i want to check and see if it actually goes at that speed and if it ever slows down thanks NiNo

Share this post


Link to post
Share on other sites
Advertisement
Keep a variable that has the time elapsed since the last frame was drawn. Then divide 1 by this variable and you''ll have you''re framerate.



"We are the music makers, and we are the dreamers of the dreams."
- Willy Wonka

Share this post


Link to post
Share on other sites
thanks but i''m not sure i understand what you mean could you be more specific?

thanks
NiNo

Share this post


Link to post
Share on other sites
nino,

Have a read about timers - you can find out about them in the docs of your compiler.

If you check the timer before you draw a frame, then check the timer after the frame you get a start and end time for one frame. Subtract the start time from the end time to get the time elapsed. Divide the time elasped (usually in ms) into 1000ms or 1 second to get the number of frames which will be drawn in a second. You may want to average this a little so it is less eratic.

Alternatively, you can get the start time for a particular frame, then each time you draw a frame add 1 to a frames counter, and get another timer (end time). Do this until the end time = start time + 1000ms.

Is that clearer?
Paulcoz.

Share this post


Link to post
Share on other sites
you find the starting time for the loop via timeGetTime, or QueeryPerformanceCounter, or whatever. Then you find the ending time of that same loop. You convert milliseconds to seconds. you take 1/end-start and walla.

JoeMont001@aol.com www.polarisoft.n3.net

Share this post


Link to post
Share on other sites
i wrote a small function/tutorial to do this which uses nehe's timer function from lesson 21

it displays the fps as a bar at the bottom of the screen (which i find easier to read than a constantly changing number)

alistair

Edited by - alistair b on November 3, 2000 6:06:38 PM

Share this post


Link to post
Share on other sites

  • Advertisement