Jump to content
  • Advertisement
Sign in to follow this  
ddn3

Odd Framerate variance for windowed DX applicaiton

This topic is 3795 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 making a fast paced action game for windows. It runs in both windowed and full screen mode. I'm noticing an odd descripenacy between the framerates for windowed vs fullscreen. When running in fullscreen mode, the framerate has very little variance ( differnce between frames ) maybe 1-2 ms, i'm aimming for 60fps sustained. When running in windowed however the variance is quite large, anywhere from 20-30 ms variance but these hick ups occure sporadically throughout and they cause an anoying stutter to the motion. The application does sleep when nessecary to achive a 60fps rate. I've tried both with and without sleep and the same windowed behavior occurs. The odd thing is when i move or lose and regain focus of the window, the variance drops by half down to 15-20 ms. I've profiled the winproc message loop there isn't any more messaged being send between state 1 ( inital state ) and state 2 ( state after being refocues or moved ). Additional note, when i put in debugging code into the windows message processing loop, specificly the function OutputDebugString, the variance drops by 1/2 as if the windowed move/refocus as stated above. However running without the debugger attached, even with that function being called doesn't have any affect on the window paint variance. What could be causing the window to draw more stablely after being moved or refocused? Has anyone ever encountered anything like this before? Thanks again! -ddn

Share this post


Link to post
Share on other sites
Advertisement
How are you measuring frame rate? If you're using GetTickCount, don't - it's nowhere near accurate enough. Try something like QueryPerformanceCounter.
And do you ahve vsync on? If not, turnign it on should lock your app to 60FPS (Or whatever the monitor refresh rate is).

Share this post


Link to post
Share on other sites
Quote:
Original post by ddn3

The application does sleep when nessecary to achive a 60fps rate. I've tried both with and without sleep and the same windowed behavior occurs.



You shouldn't Sleep to lock your frame rate. D3D provides VSYNC for exactly this purpose. Sleep doesn't guarantee that your thread goes to bed for that exact amount of time, it only guarantees that it sleeps for at least that much time. Obviously this is bad when you're trying to have precise timing.

Share this post


Link to post
Share on other sites
Just wanted to give an update, just in case anyone else experience the same problems. Finally tracked it down to the the audio library. It creates 3 time critical threads which was intreacting with the application in an unsual fashion. BTW the audio library is OpenAL so, u might want to be careful if your using it too.

-ddn

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!