Sign in to follow this  
Vertex333

Drawing instanced Text?

Recommended Posts

D3D10: Is it possible to speed up Text drawing with the d3d or d3dx classes by instancing the Text. Or does it instance the chars or so anyway? I know that it batches for the same font and so on, but I dont' know how it internally draws it, so I expect that it doesn't really instance it in any way. Any explanations or hints? thx, Vertex

Share this post


Link to post
Share on other sites
Quote:
Original post by XVincentX
Draw the text on a sprite and then use the DrawBuffered function.

Thx, but how do I draw the text on a sprite? DrawText draws it on the render target, or only on the sprite that is given by the parameter?

Thx,
Vertex

Share this post


Link to post
Share on other sites
Quote:
Original post by XVincentX
It should draw only on the sprite ( i do not know).
Anyway, you can also use a BlendState with RenderTarget mask = 0 that will not draw on the frontbuffer.
Or set an empty render target.
I did not test it so far, but I think that the drawtext sets its own render or blend states and uses the sprite to call the drawbuffered (or the other one). But removing the rendertarget should work... at least I think it should...

thx,
Vertex

Share this post


Link to post
Share on other sites
I am trying now to render my thousands of texts (most static, some will change every frame). I have to render them each with a different z value. I don't know any other way how I could combine them with the other objects, wich were rendered before.

So my plan is to render to a texture2D array and always render these textures. When a text changes the texture slice gets updated. Nevertheless it sounds very stupid, since texture size will be very large and so on...

Any hints how I could do this in another way. How can I render the text in different z order without having the overhead of handling all sprites by myself (costs too much space) or rendering it one after each other (costs too much power). Is there a way to access the stuff that is done inside DrawText?

Thx,
Vertex

Share this post


Link to post
Share on other sites
You might consider ditching ID3DXFont and do your own text rendering. You can for instance use FreeType.

I've just implemented text rendering for the GUI in my engine using FreeType. What I did was render all text to a single texture, and then render a quad for each text string, with UV set to the correct place in the texture. This way all text can be rendered in a single DrawIndexedPrimitives call.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promethium
You might consider ditching ID3DXFont and do your own text rendering. You can for instance use FreeType.

I've just implemented text rendering for the GUI in my engine using FreeType. What I did was render all text to a single texture, and then render a quad for each text string, with UV set to the correct place in the texture. This way all text can be rendered in a single DrawIndexedPrimitives call.

Thx for the suggestion. Nevertheless I can't really use it, since I need to get the same output as with GDI/GDI+. DrawText does well but not with performance. In addition I could not render all my string into one texture, since it's not known if there is enough space for them in the texture.

On the other hand I could do the same as DrawText does, but this shouldn't be worth it. It's too complex and too faulty. Although DrawText could be used to create a texture for the needed alphabet. In addition I do not even know if GDI/GDI+ can be easily used in combination with D3D10.

Thx,
Vertex

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this