0
votes

I have code in c# XNA in Draw metod.

spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, CameraMatrix());
spriteBatch.Draw... (1)
spriteBatch.Draw... (2)
spriteBatch.End();
base.Draw(gameTime);

I want split up my Draw metod. Because I have in spriteBatch.begin Matrix and have fear of performance -> counting with math. I want code something like that.

spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, CameraMatrix());
spriteBatch.Draw... (1)
spriteBatch.End();

spriteBatch.Begin();
spriteBatch.Draw... (2)
spriteBatch.End();

base.Draw(gameTime);

... but it's not drawing. Can anybody help me?

1

1 Answers

0
votes

I split my spriteBatch in the exact method you describe and it works fine. Are you making sure to adjust draw call positions in the second set to account for the changed origin? With no arguments for spriteBatch.Begin(), only sprites inside the Viewport rectangle (or portions of them) will be drawn.