Sign in to follow this  

[D3D9] making D3DXFont resolution independent

This topic is 2045 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 have a game that supports different resolutions and I want the text to be the same size in every resolution. So far I've been using D3DXFont, but using this class you have to pass the text size to the class constructor, is there a way of making my text resolution indepent?
I thought of create again my D3DXFont object every time I change resolution, but maybe there is a better way.
Thanks!

Share this post


Link to post
Share on other sites
The D3DX font works by rendering the glyphs to a texture (during initialization), and rendering quads with that texture when you draw some text with it. This is basically the same strategy that Win32 font system uses under the hood, for small text sizes.

It is possible to render vector fonts by using purpose-built shaders, but D3DX does not have a helper class for this.

The performance tends to be better if you use a bitmap cache. However, newer hardware tends to have more arithmetic headroom (because texture memory bandwidth does not increase very fast), so direct vector rendering is becoming relatively faster. Edited by Nik02

Share this post


Link to post
Share on other sites
[quote name='Nik02' timestamp='1336558481' post='4938625']
The D3DX font works by rendering the glyphs to a texture (during initialization), and rendering quads with that texture when you draw some text with it. This is basically the same strategy that Win32 font system uses under the hood, for small text sizes.

It is possible to render vector fonts by using purpose-built shaders, but D3DX does not have a helper class for this.

The performance tends to be better if you use a bitmap cache. However, newer hardware tends to have more arithmetic headroom (because texture memory bandwidth does not increase very fast), so direct vector rendering is becoming relatively faster.
[/quote]

What if I don't want to use vector fonts? Then I have to recreate the D3DX font with a new font size after resizing the screen, isn't it true?

Share this post


Link to post
Share on other sites
[quote name='Nik02' timestamp='1336564463' post='4938642']
Yes.

Bitmap cache (D3DX & texture approach) is intrinsically fixed to the size it was created in.
[/quote]

OK.
Thanks!

Share this post


Link to post
Share on other sites

This topic is 2045 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this