Jump to content
  • Advertisement


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


How to calculate and print FPS?

This topic is 6382 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 how a person would go about calculating the FPS and then printing them in a Direct3d application for dx8. My program doesn''t use the class that all the sample programs use, so it makes it difficult for me. I am having a lot of trouble with this. Any help would be appreciated. ~Wave

Share this post

Link to post
Share on other sites
To calculate your framerate you have to count the time that passed while rendering your scene. Just store the current time (TimeGetTime()) at the beginning of each frame and at the end of the frame. Now take the difference. Because the values are so small and change a lot there is another possibilty.
You store your time. Now at the end of the frame you check if there is one second gone since the time you stored your value. If not, just increase a frame counter (just an integer). If there is one second gone just look at your frame counter. Now you have the number of frames drawn in one second. This is your fps.
Now to the drawing problem.
I would suggest using DrawText for debugging issues. I would not recommend using it in the final product(just to slow), but for debug it is ok. You have to create a font handle (look at the help file). And then just call DrawText from your Direct3DDevice.


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!