So I'm working on a project, where I have a 3d cube-based world. I got all of that to work, and I'm starting the user interface, and the moment I start using spritebatch to draw a cursor texture I have, I discovered that XNA doesn't layer all the models correctly, some of the models that are further away will be drawn first, instead of behind a model. When I take out all the spritebatch code, which is just this:
spriteBatch.Begin();
cursor.draw(spriteBatch);
spriteBatch.End();
I find that the problem is fixed immediately. The cursor is an object, the draw method is just using spriteBatch.draw()
;
The way I see it, there are two solutions, I could find a way to draw my cursor and other interfaces without using SpriteBatch, or maybe there is a parameter in spriteBatch.Begin()
that I could plug in to fix the issue? I'm not sure how to do either of these, anyone else encounter this problem and know how to fix it?
Thanks in advance.