Jump to content
  • Advertisement

Archived

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

WebsiteWill

D3DXFonts appear blurry

This topic is 5319 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''m using a 12-14 size font for my interface and at that size the letters appear kind of blurry. I''ve played with the D3DXFONT_DESC members but nothing I change gets rid of the blurryness. I know it''s the font because if I create a texture with the same size font then display it on the screen with a quad of suitable size it''s crystal clear. But not with D3DXFont. I''m certain that there is something I am doing incorrect as I have seen this used before with crystal clear results. Heres the relevant code.
//The objects

ID3DXSprite*                 m_pD3DSprite;
ID3DXFont*                   m_pD3DFont;
D3DXFONT_DESC                m_lf;

//The initialization

ZeroMemory(&m_lf, sizeof(D3DXFONT_DESC ));
	strcpy(m_lf.FaceName, sFontName.c_str());
m_lf.Height = iFontSize;
//I''ve played with the m_lf parameters but nothing seems to work

D3DXCreateSprite(pd3dDisplayDevice, &m_pD3DSprite);
D3DXCreateFontIndirect(pd3dDisplayDevice,&m_lf, &m_pD3DFont);

//The usage

m_pD3DSprite->Begin(D3DXSPRITE_OBJECTSPACE);
m_pD3DFont->DrawText(m_pD3DSprite, m_sText.c_str(), 
                     m_sText.size(), &m_rText,
    		     DT_CENTER|DT_VCENTER,
                     D3DCOLOR_ARGB(255,255,255,255));
m_pD3DSprite->Flush();
m_pD3DSprite->End();
Thanks for any help, Webby

Share this post


Link to post
Share on other sites
Advertisement
What quality level are you using (the Quality member of your D3DXFONT_DESC)? Right now, it''s set to zero (so it''s at the default, whatever that is). Usually, I use ANTIALIASED_QUALITY, and it works very well for me (not blurry at all).


Dustin Franklin
Mircrosoft DirectX MVP

Share this post


Link to post
Share on other sites
Additionally, the docs say this:
D3DXSPRITE_ALPHABLEND - ID3DXFont expects this flag to be set when drawing text.

So I'd give that a try.

Also, as the docs note, End() calls Flush() so you don't need to do it there.


Stay Casual,

Ken
Drunken Hyena

[edited by - DrunkenHyena on February 29, 2004 8:16:50 PM]

Share this post


Link to post
Share on other sites
Yuo, that did it. Well, sorta. Turns out that the flag
D3DXSPRITE_OBJECTSPACE in my Begin statement is what''s really causing the blurryness. The ALPHA flag helped immensely. It allowed the text to be transparent to the background instead of taking on the background that happens to be under the top left corner of the rect.

Not entirely sure why the OBJECTSPACE flag will do this and not having it will mean having to redo my calculations for the rects but it''s something I can live with.

Funny thing is, I had actually read over the documents on sprites (including the very page you mention) and I just never caught that part of it. Go figure.

Thanks for the help,
Webby

Share this post


Link to post
Share on other sites
OBJECTSPACE means that your sprite is processed by the various transforms (View, Projection, World), so possibly in one or more of those the coordinates are getting scaled slightly which accounts for the blurring.

Without OBJECTSPACE it will just use screen coordinates.


Stay Casual,

Ken
Drunken Hyena

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!