Yes, that’s what I’m going to do.
Before using RenderTargets this was the way I used to draw sprites
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
// Everyting is drawn here
spriteBatch.End();
}
This is the method Game1.Draw() the main Draw method. But I realized that using RenderTargets I need to call spriteBatch.Begin(); after calling graphicsDevice.SetRenderTarget(…); otherwise the sprites aren’t drawn in the RenderTarget, they are drawn in the back buffer. Before RenderTargets I had only one spriteBatch.Begin(); and one spriteBatch.End(); but now I’ll have much more calls to these methods.
Is there a way to use the same SpriteBatch.Begin() to draw in every RenderTarget?
How can I measure the time needed to call SpriteBatch.Begin()?