Domanda

Prendi ad esempio disegno un cerchio a (10,10), quindi sul frame successivo un altro a (20,20). Il cerchio a (10,10) non è più visibile.

Non sto chiamando GraphicsDevice.Clear.

C'è un modo per rendere la grafica precedentemente disegnata non essere cancellata?

Li sto attirando in un rendertarget seconario in modo da poterlo usare come sfondo.

Qualche idea?

È stato utile?

Soluzione

Quando inizializzi il RenderTarget2D devi usare RenderTargetUsage.PreserveContents.

// Disregard the arguments up to RenderTargetUsage
RenderTarget2D r = new RenderTarget2D(GraphicsDevice,
                                      graphics.PreferredBackBufferWidth,
                                      graphics.PreferredBackBufferHeight,
                                      false,
                                      RenderTargetUsage.PreserveContents);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top