fastest way to get text in D3D

Started by
1 comment, last by d000hg 21 years, 8 months ago
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
Advertisement
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.


DLains
DLains

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:
http://www.drunkenhyena.com/docs/dhFastFont.phtml

And here''s a link to my D3DFont mini-tutorial:
http://www.drunkenhyena.com/docs/d3d_tutorial.phtml#CD3DFont

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


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement