Jump to content
  • Advertisement
Sign in to follow this  
utilae

Order ID3DXFont Drawing with Texture Drawing

This topic is 4940 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!