Question

Take for example I draw a circle at (10,10) then on the next frame another at (20,20). the circle at (10,10) is no longer visible.

I am not calling graphicsdevice.clear.

is there a way to make the previously drawn graphics not be cleared?

I am drawing these into a seconary rendertarget so I can use it as a background.

Any Ideas?

Was it helpful?

Solution

When you initialize the RenderTarget2D you need to use RenderTargetUsage.PreserveContents.

// Disregard the arguments up to RenderTargetUsage
RenderTarget2D r = new RenderTarget2D(GraphicsDevice,
                                      graphics.PreferredBackBufferWidth,
                                      graphics.PreferredBackBufferHeight,
                                      false,
                                      RenderTargetUsage.PreserveContents);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top