Jump to content
  • Advertisement


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


FPS counter going nuts!

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

Hi! I have an FPS counter based on the QueryPerformanceXXX() method. The only problem is, when I run my program in full-screen or windowed, the counter goes nuts and displays the numbers all too fast! Even though I have set it to 2.1f it displays like a three-digit number. I have disabled VSync. I render the numbers like this: sprintf(buffer, "%2.1f", D3DGetFPS()); WhateverPrintFunc(buffer, X, Y, ...); I can see I''m in between 3000-5000.. My question in essence; how to I slow it down so that you actually can READ the numbers!? Thanks /Sandman

Share this post

Link to post
Share on other sites
Simply put, don''t try to update your fps every frame. Update it every few seconds - by taking the average number of frames over the elapsed time.

if( timeElapsedSinceLastUpdate > 3 seconds )
fps = totalFramesAccumulated/3.0

You can make the interval whatever you wish though.

Chris Z.
ZeroFX Interactive

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!