Recommended Posts

hi!
i am creating 2d game with ID3DXSprite , but for giving zooming and 3d particle effects i wanted to use 3d space by initializing view projection and world matrix .....so i tried this but it doesnt working, and my world transformation not givig any effect over 2d ID3DXSprite ....is there anyway to communicate them as the way i want???
thanks

0

Share this post

Link to post

Share on other sites

Nope*. ID3DXSprite is designed to be 2D. It uses state blocks to make sure that all the render states it needs are set, and it used post-transformed vertices. You can use the SetTransform() method to change the scale of the sprite though.

* You could derive your own IDirect3DDevice9 class, and pass that to D3DXCreateSprite, and then do whatever is nessecary when the sprite draws itself (e.g. converting the sprites DrawPrimitive() into a DrawPrimitive() on the real device). However, I think that's just being silly :P

0

Share this post

Link to post

Share on other sites

IIRC, you can render sprites in object space (and you can billboard, too). To render in object space, call Begin() with D3DXSPRITE_OBJECTSPACE. To billboard sprites, call Begin() with D3DXSPRITE_BILLBOARD. If you want to enable billboarding, you have to call SetWorldView*H() first.