Jump to content
  • Advertisement
Sign in to follow this  
neeker

Rendering text without D3DX

This topic is 2147 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'm trying to figure out how to render text to a D3D9 scene without using D3DXFont or any other extensions.  Unfortunately, all of the googleverse examples seem to rely on that.  What would be a good strategy for doing so?

 

I thought about rendering to a texture with DrawText, but that seems a little clunky.  Not sure if there is something better.

Share this post


Link to post
Share on other sites
Advertisement

The basic process that you need to use is:

 

1. In an offline tool generate a texture which holds every character you need from the font, along with some metadata to tell you where each character is in the texture. You may also want other details like kerning pair data if the font is not monospaced. The texture can be single channel - D3DFMT_A8 for example as you can apply a colour at runtime. GetGlyphOutline(..., GGO_GRAY8_BITMAP, ...) will extract the data from a Windows font. A quick search should also find tools that will do this step for you.

 

2. At runtime go through the string building up a vertex buffer one character at at time, and then render it. This is essentially the same process as drawing a bunch of sprites from a sprite sheet. You'll also need special case handling of whitespace characters, and you'll probably need to handle word wrapping.

Share this post


Link to post
Share on other sites

i discovered that d3dxfonts are SLOOOOW!   so i implemented my own fonts using d3dx sprites. works great, runs fast.

 

i also use the font textures to texture 3d quads to make 3d text in the game world.

 

this is all done using dx9 fixed function pipeline.

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!