Is ID3DXFont faster than CD3DFont with the DX update?

Started by
18 comments, last by thedavil 20 years, 6 months ago
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::PreloadCharactersID3DXFont::PreloadGlyphsID3DXFont::PreloadTextUSAGE: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]
I am an Asteroid.

I am a drifter. I go where life leads, which makes me usually a very calm and content sort of person. That or thoroughly apathetic. Usually I keep on doing whatever I'm doing, and it takes something special to make me change my mind. What Video Game Character Are You?
Advertisement
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]
I am an Asteroid.

I am a drifter. I go where life leads, which makes me usually a very calm and content sort of person. That or thoroughly apathetic. Usually I keep on doing whatever I'm doing, and it takes something special to make me change my mind. What Video Game Character Are You?
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?
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
Stay Casual,KenDrunken Hyena
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
Stay Casual,KenDrunken Hyena
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
I am an Asteroid.

I am a drifter. I go where life leads, which makes me usually a very calm and content sort of person. That or thoroughly apathetic. Usually I keep on doing whatever I'm doing, and it takes something special to make me change my mind. What Video Game Character Are You?
So Sprite also got a (very)big upgrade?

.lick
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
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
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
Pedro RemediosPete Productions

This topic is closed to new replies.

Advertisement