Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


[D3D9] making D3DXFont resolution independent


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 angelmu88   Members   -  Reputation: 228

Like
0Likes
Like

Posted 09 May 2012 - 02:05 AM

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!

Sponsor:

#2 Nik02   Crossbones+   -  Reputation: 2870

Like
1Likes
Like

Posted 09 May 2012 - 04:14 AM

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, 09 May 2012 - 04:18 AM.

Niko Suni


#3 angelmu88   Members   -  Reputation: 228

Like
0Likes
Like

Posted 09 May 2012 - 05:37 AM

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?

#4 Nik02   Crossbones+   -  Reputation: 2870

Like
1Likes
Like

Posted 09 May 2012 - 05:54 AM

Yes.

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

Niko Suni


#5 angelmu88   Members   -  Reputation: 228

Like
0Likes
Like

Posted 09 May 2012 - 07:07 AM

Yes.

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


OK.
Thanks!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS