Jump to content
  • Advertisement


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


drop in frame rate

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

okie, i got a drop in frame rate and i managed to corner down the code to:
CD3DFont* font = theApp.GetSmallFont();   

assert(font);               //check font

char str[10];               //char array

char str1[10];
sprintf(str, " %d", theApp.playarea[0][0]->score);  //converting int to string

sprintf(str1, " %d", theApp.playarea[0][0]->speed);

font->DrawText( 600, 380, 0x88ffff00, str, 0L ); //2D coords

font->DrawText( 600, 280, 0x88A2F69E, str1, 0L );
I am using CD3DFont* and the DrawText function, which both are from d3dfont.h. So, if the last line of the code above is commented out, the frame rate is ok(75+), but if it is uncommented, the frame rate drops to 25+. Whats wrong with adding the last line? //d3dfont.h HRESULT DrawText( FLOAT x, FLOAT y, DWORD dwColor, TCHAR* strText, DWORD dwFlags=0L ); [edited by - edwinnie on June 3, 2002 2:34:15 AM]

Share this post

Link to post
Share on other sites
The problem is that DrawText( ) is slow. You should write your own font engine. Search here for an example.

Share this post

Link to post
Share on other sites
D3DFont shouldn't be THAT slow. It's not the fastest font engine you can get, but it's pretty fast nonetheless. I would look at the renderstates if I were you. Try drawing only the text, without modifying any renderstates, and see what your framerate drop is. Compare your code to Text3D sample. Your framerate drop would be appropriate if you used ID3DXFont, but it's too big for D3DFont. How big are your strings?

lucinpub: Stock DrawText isn't slow unless you're drawing many strings or have very long strings. It should be quite fast for short strings. And if you do write your own font engine, D3DFont is a very good start.

[edited by - IndirectX on June 3, 2002 6:36:13 AM]

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!