Jump to content
  • Advertisement
Sign in to follow this  
protemus

Frame rate stuck at a mere 85

This topic is 5035 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 have been creating an engine over the last few months, with all kinds of nifty features. ( in D3D9 ) My tests have been running fine, and seem to be displaying motion with no jittering, so I wasn't all that concerned with frame rate until now. I finally got to adding a frame rate display, and I noticed my frame rate is stuck at 85 frames per second. (in fact it vascillates back and forth displaying 85.333333 and 84.363636) about once every second. I thought at first that that the FPS math was screwy, so I added a display that shows the current frame index on the screen every frame and reset to 0 when I perform the FPS calculation. Indeed, the counter counts up to 85 and then resets to 0 about once per second. So I know I am actually only displaying 85 frames in a second. I also know that this exact FPS does not vary even slightly, no matter what I do. I set the resolution down to 640X480, and still I get the same FPS. Then, I removed ALL objects and left only the FPS display, and STILL I get the same frame rate. Then, I removed ALL my logging (which shouldn't eat up to much processing time anyway, because I was careful to write a ring buffer with no memory allocation). Still, 85 FPS. Then, I removed the timer code, thinking that maybe the code checking the timer was causing the program to halt for some event that happened on a repeating interval, but still, the FPS is the same. I am at a loss, because I am basically not displaying anything.... does anyone have any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Your monitor's refresh rate is probably set to 85hz. If vsync is enabled, this will cap your frame rate ~85fps.

wowo

Share this post


Link to post
Share on other sites
yep that is it. I figured it out shortly after I posted this message.

However, it says in the docs that disabling that setting can cause visual tearing. How bad is the tearing I can expect? Do commercial games typically leave this enabled? If not, how can I make sure that the display does not show visual artifacts due to screen refresh while this is enabled?

Share this post


Link to post
Share on other sites
Many games have vsync as a configuration option. Whether or not the tearing is "bad" is a thing of personal preference. Personally, I don't usually even notice it.

Share this post


Link to post
Share on other sites
The tearing isn't usually noticable, but you can always re-enable it if you do find its interfering. Better yet you could set it as an option somewhere so you can toggle it!

For testing purposes its nice to know the true framerate of a game, especially when trying to profile pieces of your code so when your doing that i suggest you disable it. For the final product though it'd be fine either way, although hardcore gamers will probably want it uncapped! I set it as a toggle somewhere then default it to on in release builds, that way you get no tears but if anyone wants to turn it on its there.

Share this post


Link to post
Share on other sites
Make the user choose to enable vsync or not. Usually things look much smoother with vsync on, but the drawback is that you have to render frames fast enough to meet the refresh rate. If you don't finish rendering before the next update, you will have to wait until the next. So if your refresh rate is set to 85Hz, and you can only render 80 frames a second, your framerate will drop to ~42Hz. Hope this clears things up.

BTW the tearing WILL be quite visible under certain circumstances. Especially 2D scrolling is horrible without vsync (or strafing across a wall, for that matter). As always, it depends on what you're doing.

Share this post


Link to post
Share on other sites
Thanks guys! You were a great help.

I'll progress post here, and soon I'll have an alpha for people to play with... not that anyone would want to....



Share this post


Link to post
Share on other sites
I had the same problem. My app caped at 85 FPS and another demo I saw reached 500 FPS.

The fix is:

D3DPRESENT_PARAMETERS d3dpp;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
pdevice->CreateDevice(...,d3dpp,...);

Share this post


Link to post
Share on other sites
I know this is a DirectX forum but since this is an active topic.. does anyone know how to enable/disable the vsync in opengl in C++, or can anyone point me in the right direction?

Cheers! :)

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.

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!