Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

Sprite drawing priority

This topic is 4830 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 have an array of textures 0-5. it just happens that the last one is my background, so i set that to be at Z=1 and everything else i want to be infront of the background at Z=0. the array is drawn in order but for some reason, only the background is showing up...

Share this post


Link to post
Share on other sites
Advertisement
forgot to mention, i have an ortho projection with a min of 0 and a max of 5. (but also for some reason, when i put the background at anything greater than 1 like 3 or something, it doesn't show up at all...)

Share this post


Link to post
Share on other sites
First off sprites are drawn in screen space unless you specify otherwise (see sprte flags) so the projection is probably not doing anything. If you are not using a z-buffer things will appear in the order that they are drawn regardless of z-position so drawing your background last will cover up everything else you have drawn. Sprite will sort the textures for you either front-to-back or back-to-front. If you are using alpha you usualy want to turn off the z buffer and sort back-to-front, if you are not using alpha you usualy want to turn the z buffer on and sort front-to-back.

Share this post


Link to post
Share on other sites
You're drawing in order from back to front, i.e. background first? If you're using the ID3DXSprite, it doesn't matter what your z value is unless you pass D3DXSPRITE_SORT_DEPTH_FRONTTOBACK in as the parameter to the Begin function. Otherwise, you will need to draw them in the proper order (background first).

EDIT: Doh, turnpast beat me to 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!