Texture zorder
Hi All,
I am using a sprite to draw 2 textures on the screen one above another. the bottom texture gets drawn first and then the above one.
Is there a property / method I can set or call by which i can specify which texture is supposed to get drawn above which like a zorder? so that which ever is drawn first the order of the textures always remain the same.
regards
Abhishek
This is where the Z buffer comes in handy [smile]
I've not tried it, but you might be able to use ID3DXSprite::SetTransform() to modify the Z value (1.0 for furthest away and 0.0 for closest), but failing that you might have to ditch the sprite interface.
D3DX's implementation isn't too hard to copy - just look into pre-transformed vertex data. This is either defined using D3DFVF_XYZRHW or the POSITIONT semantic and basically says that you skip the vertex shader stage of the pipeline. A bit of googling should pull up plenty of examples.
hth
Jack
I've not tried it, but you might be able to use ID3DXSprite::SetTransform() to modify the Z value (1.0 for furthest away and 0.0 for closest), but failing that you might have to ditch the sprite interface.
D3DX's implementation isn't too hard to copy - just look into pre-transformed vertex data. This is either defined using D3DFVF_XYZRHW or the POSITIONT semantic and basically says that you skip the vertex shader stage of the pipeline. A bit of googling should pull up plenty of examples.
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement