문제

Man so much has changed since I learned DirectX 7.

Everywhere I look (except Wikipedia), it says I have to render from DWrite to D2D or GDI before I can do anything.

Is that Wikipedia article wrong? Can I not render to Direct3D?

I'd like to avoid having to render to D2D, since apparently, to get D2D to write to D3D, you have to open up a D3D10.1 device as well.

Does it really take all this just to render text in D3D11?

도움이 되었습니까?

해결책

Unfortunately, Microsoft decided to remove native text support from their DirectX API. Now you can either use DirectWrite, and then as you said render to GDI or D2D, which is somewhat clunky, or alternatively, make your own font-handling class, and use that (which is what I've chosen to done for my project).

There is a good tutorial on how to produce a custom Font-handling class, here: http://www.rastertek.com/dx11tut12.html

Obviously, you should write your own, but it provides a good starting point, and allows you to see all the necessary proceedures (something you will probably want to add will be support for multiple fonts, for which I recommend creating a Font class, which your Font-Handler stores with an associative string in a std::map< char*, Font* >).

Hope this helps! :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top