Jump to content
  • Advertisement
Sign in to follow this  
Outtey

Frames per Second display

This topic is 3055 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'm new to DirectX so please bear with me. I'm working on a simple program and I need to display the FPS. What's the easiest way to do this? Does DirectX have a built-in timer?

Share this post


Link to post
Share on other sites
Advertisement
Unfortunately, DirectX doesn't have a built-in timer. You'll have to calculate fps yourself. There are a lot of discussions about just how to do that here on gamedev. Search for "frames per second" in the search box in the upper right-hand corner of this gamedev screen and take a look at the discussions.

Share this post


Link to post
Share on other sites
The by far easiest way is to use the SetTimer() Windows API function with 1000ms, increment an integer after each buffer swap, and upon receiving a WM_TIMER, save the counter's value and reset it to zero.

Share this post


Link to post
Share on other sites
I really do not recommend using WINAPI stil...

Is really easy to make your own timer, just get the actual tima minus the last time, that's your time differential between (dt) frames, as Buckeye says, there is
a lot of way to do it, you can add your dt every frame until you pass one second, then you can count how many frames your application can render on one second.

Is cheaper than use FRAPS (wich will slow down your app about 2-3 fps).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!