Order ID3DXFont Drawing with Texture Drawing

Started by
1 comment, last by utilae 18 years, 10 months ago
Hi, I am using C++ and Direct3D9. I am using ID3DX DrawText() to draw some text on the screen. However I am also drawing textures on the screen. I know that if I call DrawText() after Drawprimitive() the font will appear on top of the texture, but when I am doing multiple textures, and wanting fonts to appear at multiple z levels it becomes impractical to call drawpimitive before each drawtext(). Is there a way to order font drawing in with texture drawing, via a z value eg: 0=front >0 is back z=0.9 Font Text z=1 Texture z=1.9 Font Text z=2 Texture z=2.9 Font Text z=3 Texture [Edited by - utilae on June 8, 2005 2:22:10 AM]

HTML5, iOS and Android Game Development using Corona SDK and moai SDK

Advertisement
Sorry, I don't completely understand what you're doing because I've never used D3DX_DrawText, but you could draw your text to separate textures first, and then render everything at once using primitives. You'll need to sort the primitives yourself to avoid alpha-blending artifacts.

GDNet+. It's only $5 a month. You know you want it.

Right now primitives are sorted by z value, so there are no alpha blending artifacts. But what I am doing is that some primitives have part A of a texture, while other primitives have part B of a texture. If I am trying to draw a texture, then some text on top of that, then the mouse on top of the text, the only way to do it is like so:

add vertices for texture
drawprimitive
drawtext
add vertices for mouse
drawprimitive

This is impractical, because if I have to call drawprimitive before each font drawing, then it results in too many draw primitives being called. This would be way too slow.

Has anyone used D3DXFont and figured out a way around this problem?

HTML5, iOS and Android Game Development using Corona SDK and moai SDK

This topic is closed to new replies.

Advertisement