Jump to content
  • Advertisement

Archived

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

Screndib

Performance issues with D3DXFont.

This topic is 5732 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 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 this post


Link to post
Share on other sites
Advertisement
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.
You should compose your own methods instead.

Share this post


Link to post
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.
You should compose your own methods instead.

Share this post


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

Share this post


Link to post
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]

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!