Reputation: 415
I'm trying to get the frame rate of my XNA game on WP7 up to 60 fps. It appears to be locked at around the 30fps mark. I've tried the change of but makes little difference.
PresentationParameters.PresentationInterval = PresentInterval.One
Any thoughts?
Upvotes: 1
Views: 510
Reputation: 2894
You can change the fixed time step that XNA defaults to:
// 166666 ticks is 16.6ms, which is 60hz
game.TargetElapsedTime = new TimeSpan(166666) // 'game' refers to your instance of XNA.Game
Here's documentation on the feature: http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game.targetelapsedtime.aspx
Or, if you just want to turn off the fixed timestep, try setting fixed time step to false:
game.IsFixedTimeStep = false // 'game' refers to your instance of XNA.Game
Here's documentation on the feature: http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game.isfixedtimestep.aspx
This is set to true by default in XNA, so you will see a fixed time-step until you set it otherwise.
Of course there is also the chance that performance problems are keeping you around 30 fps. You could be seeing V-sync holding up the frame to sync with the phone's display, either the display may be limited to 30 fps (not likely), or if your game is taking longer than 16.6ms per frame, the V-sync might be holding it to 30 fps to keep it in sync with the display. At 30 fps your game would render every other frame that the display refreshes. But if V-sync was disabled and your game was running at something like 50 fps, your game would only partially be done rendering by the time the display refreshed, and you'd end up with screen tearing.
Upvotes: 5