Jump to content
  • Advertisement
Sign in to follow this  

Is ID3DXFont slow or fast?

This topic is 4414 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

Is ID3DXFont slow now? The reason I am asking is because in the numerious books/papers I have read they have ALL said it was slow and do your own bitmapped font. I have been using ID3DXFont for all of my projects so far and have recently started to write a bitmapped font loader + renderer (and had a problem with making small text look like the output I have from ID3DXFont). While looking for a solution to the problem, I found this page in neXe. Just wanted to know if it was better to go for it over a bitmapped font, where either would do good in places where no formatting/special fonts are needed. Are the books that say it is too slow because it invokes gdi incorrect now?

Share this post


Link to post
Share on other sites
Advertisement
From what I've seen, the speed was increased quite a bit with DX 9. I personally use it for debug info, but for actually ingame text I find a bitmapped font better: gives you a lot more possibilities visually.

Matt

Share this post


Link to post
Share on other sites
Before DX8, ID3DXFont was slow, yes. It's been sped up a lot more now and should be fine for most use. If you're rendering a lot of text at once, then most of it won't be changing every frame, so you can cache it (render to texture for example).

The main advantage of bitmap fonts is that you can have more detail in them. TrueType Fonts can only have one uniform colour. The advantage of TTFs is that they look good all various sizes, but then games tend to use fixed font sizes anyway.

Share this post


Link to post
Share on other sites
Apparently, if you supply your ID3DXFont object with your ID3DXSprite interface, you will see a substantial increase in performance.

Bitmapped fonts generally look nicer as well, since you can perform anti-aliasing with an alpha channel. However, they are more of a pain to author and implement.

Share this post


Link to post
Share on other sites
Another advantage of using bitmapped font's, and drawing them manually to screen is that if you work your vertex/pixel shaders just right, you can change the color of the font by merely setting one of the floating point constant registers as the color you want to be displayed.

You could do this by coloring the character on the bitmap as white on black, multiplying each pixel by the desired color in the register, and use additive blending.

I'm not sure if you can do this with ID3DXFont, as I haven't really tried, but a better question is if you could do it easily. Doing it manually would give you more freedom to implement this, and it's not overly complicated to do.

Share this post


Link to post
Share on other sites
One advantage of D3DX font is tha it handles all sorts of foreign characters and special layout rules for some of those languages. So if you need that sort of stuff it may be worth sticking with D3DXFont rather than implementing it all yourself.

Share this post


Link to post
Share on other sites
I normally use GDI+ to generate a bitmap character set (either runtime or beforehand) and render the string either into a cache bitmap (if it's a loong string) or use separate sprites for each character.

With the GDI+ mode I can easily use multiple outline styles/colors and fillmodes simultaneously for more interesting designs, and change them in realtime.

I feel I've got pretty much the ideal solution, but I haven't looked much at D3DXFont so I might be missing out on some cool features. Am I?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!