XNA: How to get the BackBuffer RenderTarget

半城伤御伤魂 提交于 2019-12-13 01:40:05

问题


in XNA, I need to get a reference to the RenderTarget(2D) of the BackBuffer in order to draw it to a texture or change its Usage to Usage.PreserveContents, is there any method which allows me to do that?


回答1:


Check out this blog post about what happened to ResolveBackBuffer in XNA 4.0.

Basically, you should just use render targets.

If you really need the back-buffer, you can use GetBackBufferData. But it only works on the HiDef profile.

If you need to change the RenderTargetUsage of the back-buffer, you need to respond to PreparingDeviceSettings and modify GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage. (This was explained in this blog post.)

Note that changing this away from the default is not recommended. The correct solution is to fix the order in which you set and draw to your render targets.



来源:https://stackoverflow.com/questions/8464120/xna-how-to-get-the-backbuffer-rendertarget

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