Skip to main content
GameDev.net gamedev.net
🔒 Locked

Frames per Second display

Started by Outtey Feb 7, 2010 at 8:28 AM 3 replies 950+ views
Original Post
Outtey
Outtey
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?
Buckeye
Buckeye
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.
Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly. You don't forget how to play when you grow old; you grow old when you forget how to play.
Adir
Adir
I use Fraps ^_^
eldano
eldano
Try FRAPS.
You just run it with your game and dont need to change anything in your code.
samoth
samoth
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.
_Camus_
_Camus_
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).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.