Jump to content
  • Advertisement
Sign in to follow this  
Hassanbasil

LPD3DXFONT is slow

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

Hello everyone, Using LPD3DXFONT is really slow that i lose over 700 FPS when i use it, is there any other method for drawing text? i tried CD3DFont but it gives even worse results ( over 1900 FPS loss.. )

Share this post


Link to post
Share on other sites
Advertisement
FPS is a meaningless number. If you loose 700 FPS and go from 2000 FPS to 1300 FPS, that's a microscopic performance difference. If you lose 700 FSP going from 701 FPS to 1 FPS, that's a huge difference.

Exactly how much of a difference does it make? How much text are you drawing? Can we see your code?

Share this post


Link to post
Share on other sites
from 2000 to 1300, how can it be "meaningless", when its about 35% loss?, here's some code:


//text drawing method
char FPS[50];
float fps = myCore->GetFPS ( );
sprintf_s ( FPS, 20, "hasX engine\nFPS : %d", (int)fps );
myCore->DrawText ( 10, 10, FPS, 255, 175, 75, 225, 0 );

//render
RECT rect;
rect.top = TextV.y;
rect.left = TextV.x;
TEXTMETRICA met;
TextV.font->GetTextMetricsA ( &met );
rect.right = rect.left + ( met.tmHeight*strlen ( TextV.Text ) ) + 10;
rect.bottom = rect.top + ( ( met.tmHeight + 2 ) * numLines ) + 10;
TextV.font->DrawTextA ( NULL, TextV.Text, strlen ( TextV.Text ), &rect, DT_NOCLIP, TextV.color );

Share this post


Link to post
Share on other sites
2000 FPS is 0.5ms per frame
1300 FPS is 0.77ms per frame

That's a difference of 0.27ms per frame, which is nothing - and there'll be too much background noise for that to be remotely accurate. You need to put more load on the system before you can profile

If you're drawing multiple lines of text, you can get better performance by specifying a sprite for the first parameter to DrawText() (And use the same sprite for all draw calls).

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
If you're drawing multiple lines of text, you can get better performance by specifying a sprite for the first parameter to DrawText() (And use the same sprite for all draw calls).


well, i get the same FPS whether writing 1 line or 10 lines, so i think its not a "noticeable" performance improve

Quote:
Original post by Evil Steve
2000 FPS is 0.5ms per frame
1300 FPS is 0.77ms per frame

That's a difference of 0.27ms per frame, which is nothing


i see, thank you for the reply.

Share this post


Link to post
Share on other sites
Quote:
Original post by Hassanbasil
Quote:
Original post by Evil Steve
If you're drawing multiple lines of text, you can get better performance by specifying a sprite for the first parameter to DrawText() (And use the same sprite for all draw calls).


well, i get the same FPS whether writing 1 line or 10 lines, so i think its not a "noticeable" performance improve
Maybe not at the moment, but as you add more to your engine and it becomes CPU bound, that could gain you some FPS.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by Hassanbasil
Quote:
Original post by Evil Steve
If you're drawing multiple lines of text, you can get better performance by specifying a sprite for the first parameter to DrawText() (And use the same sprite for all draw calls).


well, i get the same FPS whether writing 1 line or 10 lines, so i think its not a "noticeable" performance improve
Maybe not at the moment, but as you add more to your engine and it becomes CPU bound, that could gain you some FPS.


I see, i shall try that when i go into sprites

Share this post


Link to post
Share on other sites
Quote:
( over 1900 FPS loss.. )


Just a little note, although E.S.'s answer is really comprehensive:
Seems you're having really HUGE FPS which means your application is doing/drawing almost nothing (or really nothing?). You cannot wonder that when you add something, your FPS drops a lot ;)

Share this post


Link to post
Share on other sites
Quote:

from 2000 to 1300, how can it be "meaningless", when its about 35% loss?, here's some code:

While I would disagree that FPS is a "meaningless" number, it is mostly-useless as a performance metric because it is a nonlinear measurement.

Share this post


Link to post
Share on other sites
Does your app actually do anything yet? I don't think I've seen 2000 fps on app doing nothing and drawing a blank screen.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!