Working with fonts
Until now, we embedded any text that we needed inside of an existing texture. However, there are times when we may want to have the code decide what text to display. For example, on our credits screen, we don't want to make a graphic for each person's name who took part in creating the game.
Creating the font
We need a way to render text directly to the screen, and this means that we also need a way to define the font that we want to use when rendering the text. First, we need to add a global variable that services as a handle to our fonts. Add the following line to the variable declarations in the code:
GLuint fontBase;
Now, we need to add the following code to create the font:
GLvoid BuildFont(GLvoid) { HFONT newFont; HFONT tempFont; fontBase = glGenLists(96); tempFont = CreateFont(-26, // Height 0, // Width 0, // Escapement 0, // Orientation FW_BOLD, // Weight FALSE...