Advertisement

Best way to draw text on D3D11 application?

Started by January 04, 2016 07:16 PM
4 comments, last by ongamex92 8 years, 11 months ago

Ok, I need to know best way to draw text on D3D11 application. I tried to be smart and use easier way of rendering text on screen, by that i'm meaning TextOut and DrawText, which both failed, I used dozens of new examples of RenderText() and TextOut(), everyone of them failed. So what's the best way to draw text?

The simplest way I found was to implement something called a spritefont which is a sprite sheet with the ascii sequence on it.

See one of my old journals for source code and descriptions:

http://www.gamedev.net/blog/1059/entry-2260816-making-my-own-spritefont-implementation/

There are some problems. It is harder to localise your text later and each font has to be pre-captured to an image file, but apart from that I found this to be trivially simple.

Let me know if this helps at all!
Advertisement
Not a Lounge topic. Moving to For Beginners.

-- Tom Sloper -- sloperama.com

I use AngelCode's wonderful BMFont free application to generate a texture from a font (http://www.angelcode.com/products/bmfont/). It's easy to use, the output format is very simple and easy to implement (just be careful with packing in structures or it's gonna be a pain in your butt) and its documentation is short and simple. Although it's simple, it still supports kerning pairs and character padding.

The simplest way I found was to implement something called a spritefont which is a sprite sheet with the ascii sequence on it.

See one of my old journals for source code and descriptions:

http://www.gamedev.net/blog/1059/entry-2260816-making-my-own-spritefont-implementation/

There are some problems. It is harder to localise your text later and each font has to be pre-captured to an image file, but apart from that I found this to be trivially simple.

Let me know if this helps at all!

Wow, thanks, i'll try and implement it to my engine! ;)

I you want to generate those font spritesheets at runtime you could use FreeType or this https://github.com/nothings/stb .

This topic is closed to new replies.

Advertisement