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
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)?
- Create multiple SpriteBatches and Begin() and End() them in order; or...
- Create a single SpriteBatch and call Begin() and End() multiple times, once for each layer (in order)?
© Game Development or respective owner