问题
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