How to use multiple sprite batches?

Put your problem here if it does not fit any of the other categories.

How to use multiple sprite batches?

Postby hellhound » Thu Nov 01, 2012 3:43 pm

I want to implement an small isometric example. For my scene I've different sprite batches (player, tiles, obstacles ect.). On flat 2D applications no problem, i could simple call render on each batch and everything is fine. But how I handle differend depth values (z-Index) on isometric view?

Any batch will render any registered sprite at once. But in isometric view this will cause in Problems, while the zIndex between those objects in different buffers is not regard. I.e. I've a buffer for the player, and another for different barrels placed somewhere in the map. The rendering order must be back to front. I've the player is in front of a barrel this could be a problem, if the barrel batch is rendered at last ...

In this case easy to solve, but in maps with many elements and many buffers it's nearly impossible to decide wich has rendered first.

Normally I would expect a huge SpriteBatch conains all sprites, render them once after sort them from back to front. But this is not possible, because a SpriteBatch is limited to the texture reference. So only sprites with same reference could be added to a batch ...

Any ideas?
Thanks for any help!
Once Poster
Once Poster
Posts: 1
Joined: Thu Nov 01, 2012 3:32 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 7 guests