This topic is now archived and is closed to further replies.


fastest way to get text in D3D

Recommended Posts

Is ID3DXText or whatever it''s called just a wrapped version of CD3DFont? Which is faster? I''ve no experiance of CD3DFont, is it easy or do you have to manually detelete all the bits and stuff?
Read about my game, project #1 NEW (13th August): A new screenshot is up, plus diaries for week #3
John 3:16

Share this post

Link to post
Share on other sites
It''s ID3DXFont... and no it''s not a wrapper around CD3DFont. I''ve used both, and ID3DXFont is mega slow. I wouldn''t recommend it for anything but simple demo apps.

CD3DFont works by creating a bitmap in memory, creating the requested font, and then blitting each letter of the alphabet onto the bitmap. It then copies the bitmap to a texture. When you want to draw text to the screen you just pass the string to the CD3DFont.DrawText() function and it creates a plane and figures out what texture coordinates to use for each letter in the string. When you are done with the font at the end of your program just delete the class, and it''s all cleaned up for you.

I''m not sure what the internals of ID3DXFont are, but I know it''s much slower than CD3DFont. I got a 300% increase in frame rate when I switched to CD3DFont.

Hope this helps.


Share this post

Link to post
Share on other sites

D3DXFont renders each string out to a texture using GDI, and then renders a quad using the texture. So it''s very pretty, but horribly slow.

D3DFont is a lot faster and it''s easy to use.
Here are some benchmarks I did comparing D3DXFont and D3DFont to my own text engine:

And here''s a link to my D3DFont mini-tutorial:

As you can see from the source, it''s incredibly simple to set up.

Stay Casual,

Drunken Hyena

Share this post

Link to post
Share on other sites