Two functions can be used to manage fonts and text.
Win32 Function | Description |
---|---|
wglUseFontBitmaps | Creates a set of character bitmap display lists. Characters come from a specified device context's current font. Characters are specified as a consecutive run within the font's glyph set. |
wglUseFontOutlines | Creates a set of display lists, based on the glyphs of the currently selected outline font of a device context, for use with the current rendering context. The display lists are used to draw 3-D characters of TrueType fonts. |
The wglUseFontBitmaps and wglUseFontOutlines functions take a handle to a device context, and use that device context's current font as a source for the bitmaps. It is therefore necessary to set the device context's font and the font's properties before calling wglUseFontBitmaps or wglUseFontOutlines.
The wglUseFontBitmaps and wglUseFontOutlines functions also take a parameter that turns the first glyph in the font into a bitmap display list, and a parameter that specifies how many glyphs to turn into display lists. The function then creates display lists for the specified consecutive run of glyphs. For example:
The wglUseFontBitmaps and wglUseFontOutlines functions represent a null glyph in a font with an empty display list.
The display lists created by a call to wglUseFontBitmaps or wglUseFontOutlines are automatically numbered consecutively.
After calling the wglUseFontBitmaps or wglUseFontOutlines function, call glCallLists to draw a string of characters. See Drawing Text in a Double-Buffered OpenGL Window for sample code. In this context, glCallLists uses each character in a string as an index into the array of consecutively numbered display lists created by wglUseFontBitmaps or wglUseFontOutlines.
When you finish drawing text, call the glDeleteLists function to release the contiguous set of display lists created by wglUseFontBitmaps and wglUseFontOutlines.