Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

robotarcade

ID3DXSprite Z Order

This topic is 5223 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 am using ID3DXSprite (DX9 Summer Update) with a D3DXVECTOR3 to specify the x, y, and z coordinates. D3DXVECTOR3 myVector; myVector.x = 500; myVector.y = 350; myVector.z = .1; I have three sprites, and three vectors, each using the same ID3DXSprite interface. I am having a problem with the "z" coordinate. No matter what I set the sprites' z-coordinates to, the z order of the three sprites seems to only be determined by the order in which the draw() methods are called. The front-most sprite always seems to be the sprite who's draw() method is called last: // The background here will appear behind everything else, because its draw() method is called first. mySprite->Draw(backgroundTexture, NULL, NULL, &backgroundVector, 0xFFFFFFFF); // The space ship here will appear in the middle. mySprite->Draw(shipTexture, NULL, NULL, &shipVector, 0xFFFFFFFF); // The asteroid here will appear in front of everything else, because its draw() method is called last. mySprite->Draw(roidTexture, NULL, NULL, &roidVector, 0xFFFFFFFF); But what if I wish to switch around the z-order in-game? For instance, If I were to make an isometric game, the z-orders would have to be switched very often. Is there another way to determine z-order? I've also been forced to create a D3DXMATRIX, because this is apparently needed to rotate a sprite via setTransform(). Is this matrix the key to z-order? [edited by - robotarcade on May 31, 2004 12:05:40 AM]

Share this post


Link to post
Share on other sites
Advertisement
the ID3DXSprite interface uses orthographic projection and textured quads as far as i know - which means that it basically ignores the Z coordinate and uses the x and y coordinates as screen coordinates...

the only way to change the z order is to change the rendering order - which means implementing your system to manage the order of draw calls...

as far as i know anyway

Share this post


Link to post
Share on other sites
If you''re using the summer update, then there are special flags
in ->Begin(), two of them being: 3DXSPRITE_SORT_DEPTH_FRONTTOBACK and D3DXSPRITE_SORT_DEPTH_BACKTOFRONT.
That should do it.


--------------
"We cannot all be masters." - William Shakespeare

Share this post


Link to post
Share on other sites

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