开发者

3d icons on top representation with direct x 9 in c++

I'm doing a simulator visual where I have a lot of 2D icons representing elements of the simulation and I have a 3D (.x made with Blender) icon which represents another and more important element.

I need to make this one on top of the other 2d icons (.tga) but I cannot find the way to make this. Is it possible for Direct x to draw a 3d icon over the rest of the 2d icons?. At this moment, the 2D icons apear on top of the 3D, always.

开发者_开发问答

Could please someone help me with this. I'm programming in C++ Thanks very much in advance.


Disable Z-writes when you render the 2D icons. When you then render the 3D icons with Z-writes enabled it will render OVER the 2D icons.

Your problem at present is that when you render the 2D icons you are doing so with a z value which is the front of the z-buffer (most probably 0). You may also find you can set the z-value to 1 (again this is probably, it entirely depends on how you've set up your 2D rendering) to force the 2d icons to render at the back of the z buffer.

No entry in the Z-buffer is equivalent to it being at the back of the Z-order.


Assuming you have depth buffering enabled, you need to ensure that the Z value of your icons is further from your camera than your model. If you are using ID3DXSprite, you should be able to specify the Z position when you call the Draw function, or by using the ID3DXSprite::SetTransform() function.

Note that ID3DXSprite may draw your sprites with a different projection matrix than your model, depending on the flags you pass to ID3DXSprite::Begin(). You might want to use the D3DXSPRITE_OBJECTSPACE flag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜