Archived

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

Performance issues with D3DXFont.

This topic is 5797 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I''m using D3DXFont in a game I''m writing, and it works great except for the fact that it''s taking a very long time to draw. I can usually get my entire tilemap drawn to a 1440x1080 screen in about half the time it takes to draw a 50 character or so string. What''s going on here? Below is the code used to draw the font.
  	// where to display

RECT lineSize;

// find the size of the rect needed

if( !m_pTextHandler->DrawText(pText, -1, &lineSize, DT_CALCRECT, 0) )
{
Trace( "Failure in ID3DXFont::DrawTextA.\n" );
return RE_UNKNOWN;
}

// set the position to show the text to

lineSize.right = lineSize.right - lineSize.left + topLeft.x;
lineSize.bottom = lineSize.bottom - lineSize.top + topLeft.y;
lineSize.top = topLeft.y;
lineSize.left = topLeft.x;

//m_pTextHandler->Begin();

// draw the text

if( !m_pTextHandler->DrawText(pText, -1, &lineSize, DT_LEFT, color) )
{
Trace( "Failure in ID3DXFont::DrawTextA.\n" );
return RE_UNKNOWN;
}

//m_pTextHandler->End();  

Share on other sites
Better not to use D3DXFont as long as performance is concerned.
The drawing of D3DXFont require several steps related to GDI and thus very inefficient.

Share on other sites
Better not to use D3DXFont as long as performance is concerned.
The drawing of D3DXFont require several steps related to GDI and thus very inefficient.

Share on other sites
CD3DFont offers a good compromise between performance and readability. you can find it in sdk samples.

Share on other sites
Fraid that was the answer...guess I'm going to have to do that.

niyaw: I'll look into that...

[edited by - Screndib on December 5, 2002 11:21:03 PM]

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• Forum Statistics

• Total Topics
632954
• Total Posts
3009447
• Who's Online (See full list)

There are no registered users currently online

×