Should I scrap ID3DX Sprite?!?!

Started by
-1 comments, last by stevenmarky 22 years, 2 months ago
I am currently designing the code for an isometric-tiled game (using diagonal shaped tiles), since there will be a LOT of objects being drawn on different layers and at different times I thought it would be usefull if I could specify a Z-order for each of my sprites, unfortunatly I have not found a way to do this using ID3DXSprite - even though one of its functions (DrawTransform) takes a Matrix parameter - I can use it to change anything (scaling, translation, rotation) BUT the Z-order (translation in Z direction), maybe I am just doing something wrong in my code? I was especially let down after reading this article on gamasutra, that has a passage which states that it is possible to do Z-ordering using ID3DXSprite: http://www.gamasutra.com/features/20010629/geczy_01.htm Finally, for those wishing to go one step further, and maybe even dip your toes into 3D waters, the ID3DXSprite interfaces offer an alternate version of the Draw() function, called DrawTransform(). Instead of taking scaling, rotation, and translation (positioning) information, the DrawTransform() function takes a transformation matrix, which defines the geometrical transformations for every pixel using a 4x4 matrix. Using this you gain access to effects involving the Z-axis, meaning distances closer to or farther from the viewer. A popular effect is perspective, which would give your image the impression of receding into the distance. The use of transformation matrices is far beyond the scope of this article, but for those interested you can start with "About 3-D Transformations" in the DirectX 8 SDK and go from there. Be prepared to dig out your old math textbooks. So I made a little program which draws 2 sprites, and I used the DrawTransform parameter to pass in a matrix on the second sprite that has a 'lower' z order that the first - No result! The last drawn sprite is still drawn over the top!! ARGhhh. So my question is this: has anyone used Z-ordering with ID3DXSprite, or knows how to do it? Otherwise I think I will have to write my own primitive-2d rendering system that can do Z-ordering, (as well as because of the scaling bug ID3DXSprite has (1 pixel off)) Please Help! Thanks, Steven.R Edited by - stevenmarky on February 2, 2002 11:22:03 AM

This topic is closed to new replies.

Advertisement