How to set GraphicsDevice.GraphicsProfile

风格不统一 提交于 2019-12-25 05:28:52

问题


In a classic XNA application this value is set through the application properties.

By default this value is set to HiDef, at least on the machine I am currently using. But it has to be set to Reach to run.

My problem is that I did not find any way to effectively change this value using monogame. The property window is obviously not the same as with XNA and I did not find any config values.

Changing the value in the code, in the Game constructor or the LoadContent method does not solve my problem.


PS: My original problem, which I think is caused by this GraphicsDevice.GraphicsProfile, is https://stackoverflow.com/questions/11900957/monogame-draw2d-sample-accessviolation-exception


回答1:


In constructor metod, create new event handler for your GraphicsDeviceManager:

graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs (graphics_PreparingDeviceSettings);

(default handler is created by doubletapping Tab after +=)

then in event handler add folowing code

void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
e.GraphicsDeviceInformation.GraphicsProfile = GraphicsProfile.Reach;
}


来源:https://stackoverflow.com/questions/11903016/how-to-set-graphicsdevice-graphicsprofile

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