Any ideas how to limit DX9 FPS?

Started by
35 comments, last by Ilankt 20 years ago
can I just set the FullScreen_RefreshRateInHz?
How appropriate, you fight like a cow!
Advertisement
Sleep(1000/yourDesiredFrameRate); //put in your main loop
Get the time at the start of the frame (starttime), render the frame and wait until starttime+(1000/desiredfps)>=currenttime and then start over again.

[edited by - Randy187 on March 29, 2004 9:02:56 AM]
You probably want to set the presentinterval in the presentationparams you give to DX when creating a device. You probably want it set to D3DPRESENT_INTERVAL_ONE, ie: Page flip at vsync.
The big question is: Why would you like to do that?
fractoid:
Thanks, that did the job :-)

VolkerG:
I like that the movment and all that stuff on my game are fixed.
How appropriate, you fight like a cow!
Use time based everything ( distance traveled = timePassed * velocity for example ) What happens if the computer is slower than your framerate? And if it is faster than you lose FPS ( bad )
quote:Original post by VolkerG
The big question is: Why would you like to do that?


If you don''t limit FPS, your app basically dominates the system, taking all of the CPU''s spare time (watching task manager will show your app running at 98+% CPU usage). If all the user is doing is running your app, this is probably OK. But if you can free up some of that CPU usage without degrading your visuals, why not? The human eye can''t see any difference between 200fps and 100fps. Heck anything over about 40 or 50 fps is going to appear "smooth". Even television is 24 fps (digital is 30, I think).

If you can keep your FPS down, you free up the CPU for other things if needed.
Brianmiserere nostri Domine miserere nostri
quote:Original post by BriTeg
quote:Original post by VolkerG
The big question is: Why would you like to do that?


If you don''t limit FPS, your app basically dominates the system, taking all of the CPU''s spare time (watching task manager will show your app running at 98+% CPU usage). If all the user is doing is running your app, this is probably OK. But if you can free up some of that CPU usage without degrading your visuals, why not? The human eye can''t see any difference between 200fps and 100fps. Heck anything over about 40 or 50 fps is going to appear "smooth". Even television is 24 fps (digital is 30, I think).

If you can keep your FPS down, you free up the CPU for other things if needed.


well, I just realized that the Sleep thing is not good, because it''s not delay just the graphics, it''s delaying all the damn computer...
How appropriate, you fight like a cow!
Are we talking about a game running in fullscreen (no need to give too much CPU to ather processes) or about a windowed application ("more" intelligent sharing of the CPU time)?

This topic is closed to new replies.

Advertisement