Jump to content

  • Log In with Google      Sign In   
  • Create Account


Is ID3DXFont faster than CD3DFont with the DX update?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
19 replies to this topic

#1 thedavil   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 September 2003 - 02:53 PM

The Subject says it all. Has anyone tested it yet to any extent? -Dave Mandrella thedavil@hotmail.com [edited by - thedavil on September 25, 2003 4:35:21 PM]

Sponsor:

#2 thedavil   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 09:36 AM

*bump*


#3 DrunkenHyena   Members   -  Reputation: 805

Like
Likes
Like

Posted 25 September 2003 - 09:53 AM

I''ve played with it a bit, and it''s definitely comparable. I haven''t tried it with all the optimizations (don''t save state, use D3DXSprite, etc) though.


Stay Casual,

Ken
Drunken Hyena

#4 alnite   Crossbones+   -  Reputation: 2051

Like
Likes
Like

Posted 25 September 2003 - 09:56 AM

I haven''t tested it yet. But in the previos version, CD3DFont is a LOT faster than ID3DXFont. ID3DXFont, I think, uses mathematical calculations to render the fonts. CD3DFont on the other hand, uses textured quad. And textured quad is definitely faster.

#5 thedavil   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 10:25 AM

Yeah, that is how it used to work, but with the DX Summer Update they changed it to work more like CD3DFont and totally took GDI out of the picture, so there was supposed to be a huge speed boost. I just wanted to know if it was possible to use ID3DXFont to render text faster than CD3DFont now that GDI is not being used. Basically a frame-rate to frame-rate ratio under different render options would be nice, but I''d just settle for a general comparison for plain text.

-Dave Mandrella
thedavil@hotmail.com

#6 mustanggto   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 10:52 AM

Hi guys,

I''m working on doing a test of the new ID3DXFont and then I''ll report my findings.

Pedro Remedios
Hail Storm Studios

#7 Cybird   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 12:35 PM

I have exactly the same speed with the new ID3DXFont(summer sdk update) than my own bitmap font class.

BUT, i haven''t optimized ALOT my own bitmap class...

The thing is that ID3DXFont is really fun to play with and alot less problems...

it was time for ms to do this...



#8 chdennis   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 12:42 PM

I was very interested in this myself - there are some areas where I''m currently relying on CD3DFont.

I was able to do a quick implementation in my existing app using ID3DXFont - my results seem in line with Drunken Hyena''s comments. I basically threw d3dxfont and cd3dfont calls on top of my existing rendering (as if showing debug status/etc). I used 9 calls to DrawText, each call rendering about 70 characters.

While less than scientific, my results were:

* No font rendering = 166fps
* CD3DFont = 127fps
* ID3DXFont = 112fps

Using no other rendering (just clearing the screen each frame):

* No font rendering = 333fps
* CD3DFont = 205fps
* ID3DXFont = 170fps

Hopefully Pedro will do a more intensive test . This test was pretty simple and lacked variety.



#9 RenderTarget   Members   -  Reputation: 398

Like
Likes
Like

Posted 25 September 2003 - 12:52 PM

Was that test using the summer update? It''s been greatly improved.

The biggest boost you could get is using the D3DXSprite. It has to create a D3DXSprite object every call if you don''t. Also, Sprite will cache the calls and sort things by texture if you create it that way (drawing actually happens in Flush() or End()) so using the Sprite is a big improvement, especially if you have several font objects running through the same sprite.

Incidentally, it still uses GDI, but only to create the font bitmap, so only when you create it.

I like pie.

#10 dagamer34   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 01:30 PM

I have a kinda of dumb question, what is the summer update?? If I knew what i was i could help you, but currently my computer never fully installs DX v9.0(a or b i have tried them both) It keeps stalling up when it is copying the file "qasf.dll". I know this should belong in another topic but just wanted to slide it in(hehe).

A REAL question: What else is in the summer update? Is there a new HLSL tutorial? (I would go to microsoft.com but when they designed Windows, they forgot to add a USER-friendly site as well)

This confused person is gonna hit you where it hurts, you programmer (THE HANDS!!!)

#11 thedavil   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 01:32 PM

quote:
Original post by RenderTarget
Was that test using the summer update? It's been greatly improved.

The biggest boost you could get is using the D3DXSprite. It has to create a D3DXSprite object every call if you don't. Also, Sprite will cache the calls and sort things by texture if you create it that way (drawing actually happens in Flush() or End()) so using the Sprite is a big improvement, especially if you have several font objects running through the same sprite.

Incidentally, it still uses GDI, but only to create the font bitmap, so only when you create it.

I like pie.


What do you mean when you say
quote:
The biggest boost you could get is using the D3DXSprite.


For some reason my documentation didn't get an update...either that or they hid the new information on this class pretty well.
Is it related to the three methods?:

ID3DXFont::PreloadCharacters
ID3DXFont::PreloadGlyphs
ID3DXFont::PreloadText
USAGE:
MyFontObject.PreloadCharacters(a,Z);
MyFontObject.PreloadGlyphs(a,Z);


The third looks to be only for strings, so while it may help for pre-loading I don't think it will help in real-time.

There's also this:
quote:

The ID3DXFont and ID3DXSprite interfaces now have more options to improve font rendering performance and to control sprite buffer storage and transformations. Also see available sprite rendering options in D3DXSPRITE.


But it doesn't get specific :-/

-Dave Mandrella
thedavil@hotmail.com

EDIT: Stupid Smilies

[edited by - thedavil on September 25, 2003 8:33:43 PM]

#12 thedavil   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 01:42 PM

The Direct X summer update is just that...an update for the Direct X SDK. Check out the news on this site (gamedev.net)

I'm not positive, but you can probably install the new update without having the SDK already installed. It appears to have all the Libs and Includes there.

Here's the only info I found on HLSL:
quote:

HLSL Flow Control
The high-level shader language (HLSL) shader model has been extended to cover static and dynamic flow control and predication. This support will allow more complex shaders to be developed in HLSL. For more information, see Flow Control.


quote:

HLSL Workshop
The high-level shader language (HLSL) Workshop is a set of tutorials that make it easy to learn how to generate HLSL shaders.



So yeah there are some tutorials for ya.

-Dave Mandrella
thedavil@hotmail.com

Oh, and if you don't get an error or "Application Not Responding" message when it stalls then just wait until you get a message or it completes. Patients is a virtue as they say. If all else fails just find that DLL and delete it (you'll probably need to close some programs) then try installing again.


[edited by - thedavil on September 25, 2003 8:45:55 PM]

#13 dagamer34   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 September 2003 - 01:46 PM

Whoops... I didn''t mean "HLSL tutorial", I meant HLSL compiler. I think i read somewhere that there will be a new one or at least updated. Is that true?

#14 DrunkenHyena   Members   -  Reputation: 805

Like
Likes
Like

Posted 25 September 2003 - 08:49 PM

quote:
Original post by RenderTarget
The biggest boost you could get is using the D3DXSprite. It has to create a D3DXSprite object every call if you don''t.

Acutally it doesn''t create a D3DXSprite object each time, it uses an internal one. But it''s less optimal than using your own because it has to call D3DXSprite::Begin and D3DXSprite::End each time you call DrawText. Also, if you set up your own D3DXSprite you can control whether states need to be saved and things like that which can also improve performance.



Stay Casual,

Ken
Drunken Hyena

#15 DrunkenHyena   Members   -  Reputation: 805

Like
Likes
Like

Posted 25 September 2003 - 08:52 PM

quote:
Original post by thedavil
What do you mean when you say
quote:
The biggest boost you could get is using the D3DXSprite.





The first parameter to D3DXFont::DrawText is a D3DXSprite object that it uses to optimize the rendering. If you set it to NULL, it uses an internal one which is very fast, but not as fast as it could be.


Stay Casual,

Ken
Drunken Hyena

#16 thedavil   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 September 2003 - 09:18 AM

Ok, I see it now:
quote:

To improve efficiency, a sprite object should be specified if ID3DXFont::DrawText is to be called more than once in a row.


I wish they had a tutorial for this stuff
Now...here''s a tough question: How to make the sprite object as efficient as possible for dynamic text?

What I''d like to do is make a character map (using only characters on the keyboard) with a pointer (array) to each letter and from there build my strings on top of a sprite as textures (or a faster way if anyone knows one (Grouping Sprites perhaps)).

In my situation I am going to have a lot of Dynamic Text to work with, so simply creating the Sprite with the string won''t do. Do you think I''d be better off doing it this way, or just letting ID3DXFont handle it and set the param to NULL???

-Dave Mandrella

#17 Pipo DeClown   Members   -  Reputation: 804

Like
Likes
Like

Posted 26 September 2003 - 09:54 AM

So Sprite also got a (very)big upgrade?

.lick


#18 xyzzy00   Members   -  Reputation: 307

Like
Likes
Like

Posted 26 September 2003 - 10:03 AM

The ID3DXSprite interface handles the *drawing* of sprites. ID3DXFont makes use of ID3DXSprite to draw the individual glyphs.

If you specify your own sprite object when calling DrawText, you are in control of when the sprite''s Begin and End methods are called. This allows you to call DrawText multiple times between Begin and End.. which can save the device alot of work saving and restoring state, etc.

When calling Begin on your sprite object, there is a flag parameter which specifies how you want the sprite object to behave. If you are drawing 2D text, you will probably want to use D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE as flags.

xyzzy

#19 Pipo DeClown   Members   -  Reputation: 804

Like
Likes
Like

Posted 26 September 2003 - 10:10 AM

Sprite rocks after this update.
I always told people not to use it, because of the lack of alpha blending/testing(couldnt turn off after colorkey made).
But now.. it''s been upgraded faster, better, easier

Sprite::Begin( flags ) rocks

.lick


#20 mustanggto   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 October 2003 - 09:26 PM

Hi Guys,

Sorry about the delay. As for the test, all I did was run the Text3D sample from the summer update. The results were more or less the same as those of chdennis. I believe that a game will never have more than the equivalent of 3 lines of text per game screen. If anybody disagrees please say so! My opinion is based on the games I''ve played.

Now I can use ID3DXFont instead of bitmap font creator because previously, CD3DFont was not antialiasing the fonts and ID3DXFont was but it was tooooo slow. But now that it''s faster (100% boost!!!!! From 50 fps to 120 fps!) I have no more worries about text in my engine.

Well I''m off to the gym. See yas!

Pedro Remedios
Hail Storm Studios




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS