Skip to main content
gamedev.net
🔒 Locked

Text Drawing Method

Started by Firestryke31 0 replies 1k views
Original Post
Firestryke31
Firestryke31
Well, I'm at the point were I should get my UI system working and I wanted to start with something challenging: Text. Before I can get to the nitty-gritty of where the letters go (which is the really "fun" part) I need to decide how I'm going to get them on to the screen. I'm using OpenGL, so I'm going to be using textured quads to put the text up there.

Right now I can see 2 ways to go about drawing the glyphs:

Render the font to a texture and draw each glyph separately
Pros:
-Easy
-Can pre-render a font to one or more textures
Cons:
-Lots o' quads
-Deciding which glyphs to include
-If you exclude a glyph, you can't draw it
-Keeping track of which glyphs are on which textures

Allocate regions of a texture to render text to
Pros:
-Draw all of the text on a few quads
-Don't have to worry about which glyphs to include
-Can render at any DPI/size as needed
Cons:
-Have to update the texture if the text changes
-Have to keep a library to render the glyphs
-Keeping track of which regions are on which textures


I'm just having difficulty deciding which method to use. I'd like for this to be cross platform, including the iPhone/iPT/iPad. I know in most cases a few of the cons aren't really worth considering (quad count). If anybody else can think of other pros/cons that would help me decide, or other suggestions, that would be appreciated.
bubu LV
bubu LV
I use this Bitmap Font Generator. Usage and rendering is really easy. So far I had no problems with using it in DX11 or with GL on desktop, iOS and Android. As for actual rendering - on GL I just create list of triangles and render one text (usually line) with one draw call. On DX11 I use geometry shader to render points, that each gets expanded to two triangles.

Topic Locked

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

Sign in to reply to this topic.