• Advertisement
Sign in to follow this  

How to Preserve Contents of Backbuffer when switiching RenderTarget2Ds

This topic is 2684 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My problem is conceptually simple but I can't figure out how to implement the solution. I have read Hargreaves' blog on the topic.

I want to:

1. Draw some world screen to the BackBuffer
2. When start button pressed, display a menu over what's drawn on the screen.
3. I create a RenderTarget2D, set the device to the RenderTarget, and I draw the menu to the rendertarget.
4. I then Switch RenderTarget back to the device, and draw my menu.

Result:

Menu drawn perfectly, but backbuffer contents are cleared and cornflower blue.

Hargreaves says that what I have to do to PreserveContents on the backbuffer is:

Quote:
To change it for the backbuffer, use the GraphicsDeviceManager.PreparingDeviceSettings event to alter GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage


So my questions is: what does that mean and how do I do it. I don't know much about event handling and I'm not sure how to set up the code to do it. Please help.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement