Fast Text in OpenGL.

By Steve Baker

Sooner or later, almost everyone finds the need to draw text using OpenGL.

There are basically only three ways to do this at the OpenGL level:

Raster Fonts.

Use glBitmap or glDrawPixels to draw a rectangular bunch of pixels onto the screen. The disadvantages of doing this are many: There is one significant advantage to Raster fonts - and that is that on Software-only OpenGL implementations, they are likely to be FASTER than the other approaches...the reverse of the situation on 3D hardware.

Geometric Fonts.

Draw the characters of the font using geometric primitives - lines, triangles, whatever. The disadvantages of this are: The advantages are:

Texture-Mapped Fonts.

Typically, the entire font is stored in one or two large texture maps and each letter is drawn as a single quadrilateral. The disadvantages are: The advantages are:

Links to some Free Font Libraries:

Conclusions.

There is no one 'best' way to do text in OpenGL - on balance, I'd go for Texture-mapped fonts - but YMMV. Fortunately, there are some great freeware libraries to choose from so you can experiment.