XNA performance on WP7

白昼怎懂夜的黑 提交于 2019-12-20 03:55:09

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/9687009/xna-performance-on-wp7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!