Sign in to follow this  
BloodLust666

Sprite drawing priority

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this