Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


ID3DXFont questions

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

I looked up ID3DXFont on MSDN, and it is incredibly vague about some things. If someone could explain these things I''d appreciate it. First of all, what exactly should I give to PreloadCharacters? I''m going to be using most letters, so should I just call it like this: pFont->PreloadCharacters(''0'', ''9''); pFont->PreloadCharacters(''A'', ''Z''); pFont->PreloadCharacters(''a'', ''z''); Also, how exactly does PreloadText work? Does it only speed things up if I have EXACTLY that text and does nothing if I have the same text plus one more character? For example, say I do this: // After the font has been created pFont->PreloadText("Kills: ", 7); // in Render() char szBuf[20]; sprintf(szBuf, "Kills: %i", m_iKills); pFont->DrawText(NULL, szBuff, /*other stuff*/); Will the PreloadText make a difference or not? MSDN isn''t very specific.

Share this post

Link to post
Share on other sites
I am wondering this too, because I am seeing no performance increase by preloading text that never changes once it''s loaded. It may only be an improvement means for a common set of strings that will be used over time.

Text1 = "Text1";
Text2 = "Text2";
Text3 = "Text3";

PreloadText(Text1, Text1.Length());
PreloadText(Text2, Text2.Length());
PreloadText(Text3, Text3.Length());

Then, every frame, you switch which text is displayed. Since all 3 are preloaded, the font object has already rendered the text to memory and just displays it, instead of having to re-render it.

I believe that the font object checks it''s current call to the previous call, and if it is the same text as the previous call, displays the previously rendered text. That is why using PreloadText for text that doesn''t change is pointless.

Again, this is my observation, the MSDN doesn''t say much.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!