Jump to content
  • Advertisement


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


help with framerate

This topic is 5450 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 was wondering what exactly framerate was especially in respect to an isographic 2d map. How do you determine frame rate.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
There''s a tutorial on www.gametutorials.com about displaying the framerate in OpenGL.

Share this post

Link to post
Share on other sites
Framerate is the number of frames rendered per unit of time. Every time you draw a frame, you increment a count of the number of frames drawn. Then you let some new quantity equal the number of frames drawn divided by how long the program has been running for.

However, if you do it that way, you only get the average framerate over the entire run of the program, which means it is generally slower than the instantaneous framerate because it includes the time spent loading resources. For a more practical way to determine framerate, you should reset your counters every three seconds or so. That way, you can get information about framerate drops or increases when they actually happen.

Here''s an example with C++ code:

// Updates the timer.

void UpdateTimer(void)
static DWORD previousTime = GetTickCount();
static DWORD recentTime = 0.0;
static int recentFrames = 0;

elapsedTime = GetTickCount() - previousTime;
timeRatio = Ratio((float)elapsedTime, timeRate);
previousTime = GetTickCount();
recentTime += (double)elapsedTime;
totalTime += (elapsedTime / 1000.0);

// Reset the frames-per-second display every three seconds.

if(recentTime > 3000.0)
currentFPS = recentFrames / (recentTime / 1000.0);
recentTime = 0.0;
recentFrames = 0.0;


"Last time, I asked: ''What does mathematics mean to you?'' And some people answered: ''The manipulation of numbers, the manipulation of structures.'' And if I had asked what music means to you, would you have answered: ''The manipulation of notes?''" - S. Lang

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!