XNA Spritebatch sorting by texture vs depth

Posted by Motig on Game Development See other posts from Game Development or by Motig
Published on 2012-06-21T16:49:22Z Indexed on 2012/06/22 15:26 UTC
Read the original article Hit count: 216

Filed under:
|

I am refining my 2D game engine, and I want to look in to sorting sprite batches by texture (because I'm quite often using the same textures repeatedly).

However, I also want to retain a few 'layers' of depth (i.e. ground < buildings < units < GUI etc).

My question is, which of the following is the best approach (in terms of performance)?

  1. Create multiple SpriteBatches and Begin() and End() them in order; or...
  2. Create a single SpriteBatch and call Begin() and End() multiple times, once for each layer (in order)?

© Game Development or respective owner

Related posts about c#

Related posts about XNA