Text

GLUT provides functions to draw two types of text:


Both functions draw just a single character
Strings are handled by calling them in a loop


Example code:





Bitmap text


Characters are bitmaps - arrays of pixel data

Starting position set by glRasterPos2f(x,y) or glRasterPos3f(x,y,z)


Size never changes (unaffected by scaling or perspective)
Always screen-aligned
If starting point is off screen, nothing is drawn





Stroke text


Characters are series of GL lines


Position, size, and orientation affected by normal GL transformations


glutStrokeCharacter() includes transformation to make next character follow current one
Use glPushMatrix() / glPopMatrix() to contain this as needed





next