• Advertisement
Sign in to follow this  

DirectWrite and DirectX 11

This topic is 1654 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!

 

How i can connect DirectWrite and DirectX 11, I want to render text to directx surface and use this texture as bitmap font ? I can't find  any tutorial about this. I must draw text in WM_PAINT message but is this only one way to do this ?

Share this post


Link to post
Share on other sites
Advertisement

Maybe you can investigate this framework:

 

http://fw1.codeplex.com/

 

I personally use it, and it's great!

Yes, i know something about this, but i want to write my library to doing this but i dont know how i can do it. I look at source of this library and i cant understand how it's working

Share this post


Link to post
Share on other sites

It's a fairly straightforward concept, just lots of moving parts to deal with. Essentially you implement a custom ITextRenderer interface and plug it into DirectWrite, so the dwrite text layout engine says "here are the glyphs you want, and here is where you should put them".  Then it's up to you to render them at those spots. 

 

That library uses another piece of DWrite, a BitmapRenderTarget, to render each glyph to a memory buffer and then packs it into a Direct3D texture atlas using a bin packing algorithm. Then you have a texture atlas with various rendered glyphs, and you have positioning info, so you can just draw quads at those spots with the correct texture coordinates and it all works.

Share this post


Link to post
Share on other sites

That library uses another piece of DWrite, a BitmapRenderTarget, to render each glyph to a memory buffer and then packs it into a Direct3D texture atlas using a bin packing algorithm. Then you have a texture atlas with various rendered glyphs, and you have positioning info, so you can just draw quads at those spots with the correct texture coordinates and it all works.

And i want to do that on this method, but i still have a few question, the first is: I can draw text with DirectWrite in other place than winapi message WM_PAINT ? I can do this in render function ? And how i can copy BitmapRenderTarget to Direct3D texture ?

Share this post


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

  • Advertisement