Skip to main content
gamedev.net
🔒 Locked

Displaying Text

Started by Endemoniada 1 reply 400+ views
Original Post
Endemoniada
Endemoniada
Hi guys, What do the pros do when displaying text ? I read that some display each character with a small textured quad. I was going to set that up but before I do I rather hear from some of you. My game will have lots of text so I want to make it as efficient as possible. Thanks.
emeyex
emeyex
This is a good reference, with a tutorial and links to a couple more tutorials:
http://www.angelcode.com/dev/bmfonts/

In brief, a font is created offline as characters in a texture, along with information about where each character is located in the texture, kerning info, etc. At run-time, you generate dynamic vertex buffers with one quad per character. As long as your text strings don't change, you can just keep rendering from the same vertex buffer; when your text changes, update the vertex buffer with new quads. You'll want to minimize your draw calls (i.e., don't do one draw call per character, do one draw call per string, or even one draw call for all characters of the same font on screen, etc).
dave
dave
You have 3 options really:

1) Create the textures offline in photoshop etc...
2) Use ID3DXFont to create text at application load time. This can either be saved to a texture or done on the fly.
3) Use D3DXCreateText() which creates text out of vertices.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.