How do you draw text in DirectX 11?

Darkenor picture Darkenor · Apr 18, 2011 · Viewed 40.5k times · Source

In DirectX 10 you could use the font interface provided by D3DX10. In DirectX 11 you are supposed to use DirectWrite. But it looks like DirectWrite doesn't speak natively to Direct3D? Is there something basic I'm missing? How do you draw simple text with DirectX 11?

Answer

Zee picture Zee · Apr 19, 2011

Edit 2014:

As pointed out in comment, the link to RasterTek tutorials no longer functions, here is a link to Webarchive of RasterTek provided by RadioSpace.

The second point of the original answer is no longer valid either, because its now possible to share D3D11 backbuffer with Direct2D and through it draw text with DirectWrite.

Edit 2017:

RasterTek is still running: font rendering in D3D11


I know about two options

  • make your own font rendering engine see Rastertek DX11 tutorial

  • second option regarding direct write requires sharing backbuffer between d3d11 and d3d10.1 devices and using dwrite + d2d + d3d10.1 to render gui and d3d11 device to render 3d geometry and merge it all in backbuffer see the post from DieterVW on this thread

At this moment dwrite and d2d dont accept surface created with d3d11 device for rendering. But hopefully MS will make it so soon.