Cómo no actualizar el RenderTarget después de cada cuadro en XNA
-
28-10-2019 - |
Pregunta
Tomemos, por ejemplo, dibujo un círculo en (10,10) y luego en el siguiente cuadro otro en (20,20). El círculo en (10,10) ya no es visible.
No estoy llamando a GraphicsDevice.Clear.
¿Hay alguna manera de hacer que los gráficos previamente dibujados no se borren?
Los estoy dibujando en un RenderTarget seconario para poder usarlo como fondo.
¿Algunas ideas?
Solución
Cuando inicializas el RenderTarget2D
necesitas usar RenderTargetUsage.PreserveContents
.
// Disregard the arguments up to RenderTargetUsage
RenderTarget2D r = new RenderTarget2D(GraphicsDevice,
graphics.PreferredBackBufferWidth,
graphics.PreferredBackBufferHeight,
false,
RenderTargetUsage.PreserveContents);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow