Jump to content
  • Advertisement
Sign in to follow this  
Pyrogame

DX11 Drawing Text - DX11 - SlimDX/C#

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

Hi, I think, that the DirectWrite API wrapper in SlimDX is not finished yet. Is this true? In DX9, this was very easy. Now, I have a DX11 device, and I know, that I need Direct2D or/and DirectWrite to draw text in DX11. What is the best method to do this? a) Create a Direct2D device, then somehow (I have to figure it out) connect it to the DX11 device and then draw the text with it? b) Use only the DirectWrite API, implement my own TextRenderer which can render to the DX11 device using some kind of textures for the glyphes (chars)? c) ... maybe there is a cool, fast, easy option ^^? In my opinion, a) feels to me like a hack... it is not a direct way. Or maybe the interop between DX11 and D2D is easy and well supported? b) in my opinion is something like: I have to render text on my own, there is an API, which simply handles my string -.-. How do you render text in your DX11 applications? What, if you want a 3D text?

Share this post


Link to post
Share on other sites
Advertisement
You certainly don't *have* to use DirectWrite/D2D for text with D3D11. In fact the two can't really interoperate at the moment: you have to create a D3D 10.1 device in order to use D2D, which means you have to use DXGI synchronization methods in order to use that surface with a D3D11 device. Not impossible, but not simple either.

For my little simple framework I just ended up using GDI+ to render out text to a bitmap, then I load the bitmap data into a D3D11 texture. Then at runtime use my SpriteRenderer to to draw batches of quads with proper texture coordinates in order to draw glyphs. Wasn't too hard to get up and running.

Share this post


Link to post
Share on other sites
Hmm... using GDI+ to render, because the new DX can't do this for us: a simple text rendering ^^. I'm very disapointed.

What happend to the 3d text? I can remember, that in DX9 there was some kind of mesh, which could be build up from a font and string. The result was a 3D text as a mesh.

Share this post


Link to post
Share on other sites
Quote:
Original post by Pyrogame
Hmm... using GDI+ to render, because the new DX can't do this for us: a simple text rendering ^^. I'm very disapointed.


FYI, text rendering has never been part of D3D. D3DX had ID3DXFont, which was just a very basic class that was there purely for convenience (it used GDI to render text).

If you're not actually rendering the glyphs at runtime you can use whichever library you want to generate your texture. I just used GDI+ because I knew how it worked, and I wanted something I could get up and running quickly.

Quote:
Original post by Pyrogame
What happend to the 3d text? I can remember, that in DX9 there was some kind of mesh, which could be build up from a font and string. The result was a 3D text as a mesh.


You mean D3DXCreateText? They probably took it out because nobody used it. It was a cute little helper to have, but I'd imagine that if you actually need 3D text as part of your game you'll need a lot more flexibility than what that function would give you.

And if you really wanted to use that with D3D11, you could. You can just create a NULLREF D3D9 device, create the mesh, and then extract the vertex and index data. It's a simple mesh so you won't have to worry about materials or vertex declarations.

EDIT: I was talking about the native API, I forgot that this thread was originally about SlimDX. However everything I said should still apply, the names are just different.

Share this post


Link to post
Share on other sites
Yes, i need to output dynamic text, but I can use precreated glyphs to do this. So I do not need any GDI's, I will render it using ms-paint ^^.

But like I said: I'm disapointed. Something, that was so easy in DX9, is now gone, or is complicated.

Thank you for your comments so far. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!