Jump to content
  • Advertisement
Sign in to follow this  
robert_p

z order based on drawing order for 2d

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm porting a dd7 game to d3d8 that uses heavy vector rasterizing, this makes everything pretty easy because i just want d3d to draw lines point and tris. My question is though with batching how do I use the drawing order to draw things on top of eachother. I thought of using something like g_Z+=0.001, but this seems kinda hacky to me. Is there a way that this is supposed to be done or is it just hard because of the 3d api?? Anyways thanks for any help Robert.

Share this post


Link to post
Share on other sites
Advertisement
On the 2D games that I have done in d3d I have done it that way with no problems. To give better layering options I will let every sprite/actor/whatever define a "layer number" that they wish to be drawn in. I then split up the z range of [0,1] into as many layers as I need, (usually no more than 6) and use the base z for that layer, then increment the base z like you have above. (eg. layer 0 from 0.0f to 0.17f) This way I don't have to sort everything that will be on the screen into z order. Depending on how you inc/dec the z, things will still be drawn on top of the others based on draw order, but only within each layer (which usually simplifies the problem).

Hope this helps, not sure if this is what you were looking for. I don't think there is any other way to do it. :(

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!