Speed of LPD3DXFONT

Started by
19 comments, last by HunterTKilla 21 years, 5 months ago
I just wrote a class that works with the LPD3DXFONT Direct X class. Although I have just ran into a problem, speed. When I print out just the fps in 800x600x32 I get about 600-800fps. When I print out just 7 more variables the FPS slows to about 300-400!! Does anyone have any idea what I am doing wrong, by the way I am calling the text like this:
    
LPD3DXFONT->Begin();
LPD3DXFONT->DrawText(idents[i], -1, &fontRect, DT_CALCRECT, 0);
LPD3DXFONT->DrawText(idents[i], -1, &fontRect, DT_LEFT, D3DCOLOR_XRGB(255, 50, 50));

...

LPD3DXFONT->End();
    
[edited by - HunterTKilla on October 20, 2002 1:16:32 PM]
Advertisement
There are many shortcommings to D3DXFont. The one I read of most often is it uses the Windows GDI to create the text, which is never good when speed is key. You''re only going to get about two to three lines of text before taking massive performance hits.

----
AIDS
----AIDS
The SDK comes with D3DFont in the Common source which is many times faster than D3DXFont.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena
I can confirm this, I have been using D3DXFont for some basic output stuff, and it is *slow*. I''ll have to look into what Drunken Hyena is talking about.
I also have a custom library that does text rendering. It used a bitmap which I prefer to a Windows font.

http://www.drunkenhyena.com/docs/dhFastFont.phtml

Full source, it''s just a header file.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena
Definitely check out DrunkenHyena''s technique. It''s a lifesaver.

----
AIDS
----AIDS
Argh, I just got finished working D3DXFont into my textbox/listitem class hierarchy. I really wanted to be able to set the rectangle for clipping so I could chop text to a certain length in text boxes etc.

Neither CD3DFont nor DH''s implementation do this...

Anyone looked into extending CD3DFont to clip (especially the width) to a rectangle yet? Hmmm...
quote:Original post by Igilima
Anyone looked into extending CD3DFont to clip (especially the width) to a rectangle yet? Hmmm...

yup.
the ID3DXFont class isn''t for rendering directly to the screen. Well, it is if you dont care about speed. But if you do care about speed, then its for rendering to a texture.

use the ID3DXFont class to render the alphabet to a texture, then parse the letters of the texture, and go from there.

The problem with the DH font tutorials is that all the fonts have to be pre-generated with a separate program. You can use ID3DXFont to generate them programmatically at load time, or on-the-fly.
"This is stupid. I can't believe this! Ok, this time, there really IS a bug in the compiler."... 20 mins pass ..."I'M AN IDIOT!!!"
quote:Original post by PSioNiC
use the ID3DXFont class to render the alphabet to a texture, then parse the letters of the texture, and go from there.

um... CD3DFont already does that.

This topic is closed to new replies.

Advertisement