[D3D9] making D3DXFont resolution independent

Started by
3 comments, last by angelmu88 12 years ago
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!
My 3D graphic engine: http://graphicprogramming.wordpress.com/rebirthengine/
My blog: http://graphicprogramming.wordpress.com/
Advertisement
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.

Niko Suni


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.


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?
My 3D graphic engine: http://graphicprogramming.wordpress.com/rebirthengine/
My blog: http://graphicprogramming.wordpress.com/
Yes.

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

Niko Suni


Yes.

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


OK.
Thanks!
My 3D graphic engine: http://graphicprogramming.wordpress.com/rebirthengine/
My blog: http://graphicprogramming.wordpress.com/

This topic is closed to new replies.

Advertisement