The wglUseFontBitmaps function creates a set of bitmap display lists for use in the current OpenGL rendering context. The set of bitmap display lists is based on the glyphs in the currently selected font in the device context. You can then use bitmaps to draw characters in an OpenGL image.
The wglUseFontBitmaps function creates count display lists, one for each of a run of count glyphs that begins with the first glyph in the hdc parameter's selected fonts.
BOOL wglUseFontBitmapsA( HDC , DWORD , DWORD , DWORD );
Specifies the device context whose currently selected font will be used to form the glyph bitmap display lists in the current OpenGL rendering context.
Specifies the first glyph in the run of glyphs that will be used to form glyph bitmap display lists.
Specifies the number of glyphs in the run of glyphs that will be used to form glyph bitmap display lists. The function creates count display lists, one for each glyph in the run.
Specifies a starting display list.
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To get extended error information, call GetLastError.
The wglUseFontBitmaps function defines count display lists in the current OpenGL rendering context. Each display list has an identifying number, starting at listBase. Each display list consists of a single call to glBitmap. The definition of bitmap listBase + i is taken from the glyph first + i of the font currently selected in the device context specified by hdc. If a glyph is not defined, then the function defines an empty display list for it.
The wglUseFontBitmaps function creates bitmap text in the plane of the screen. It enables the labeling of objects in OpenGL.
In the current version of Microsoft's implementation of OpenGL, you cannot make GDI calls to a device context that has a double-buffered pixel format. Therefore, you cannot use the GDI fonts and text functions with such device contexts. You can use the wglUseFontBitmaps function to circumvent this limitation and draw text in a double-buffered device context.
The function determines the parameters of each call to glBitmap as follows.
|width||The width of the glyph's bitmap, as returned in the gmBlackBoxX member of the glyph's GLYPHMETRICS structure.|
|height||The height of the glyph's bitmap, as returned in the gmBlackBoxY member of the glyph's GLYPHMETRICS structure.|
|xorig||The x offset of the glyph's origin, as returned in the gmptGlyphOrigin.x member of the glyph's GLYPHMETRICS structure.|
|yorig||The y offset of the glyph's origin, as returned in the gmptGlyphOrigin.y member of the glyph's GLYPHMETRICS structure.|
|xmove||The horizontal distance to the origin of the next character cell, as returned in the gmCellIncX member of the glyph's GLYPHMETRICS structure.|
|ymove||The vertical distance to the origin of the next character cell as returned in the gmCellIncY member of the glyph's GLYPHMETRICS structure.|
|bitmap||The bitmap for the glyph, as returned by GetGlyphOutline with uFormat equal to 1.|
The following code example shows how to use wglUseFontBitmaps to draw some text.
HDC hdc; HGLRC hglrc; // create a rendering context hglrc = wglCreateContext (hdc); // make it the calling thread's current rendering context wglMakeCurrent (hdc, hglrc); // now we can call OpenGL API // make the system font the device context's selected font SelectObject (hdc, GetStockObject (SYSTEM_FONT)); // create the bitmap display lists // we're making images of glyphs 0 thru 254 // the display list numbering starts at 1000, an arbitrary choice wglUseFontBitmaps (hdc, 0, 255, 1000); // display a string: // indicate start of glyph display lists glListBase (1000); // now draw the characters in a string glCallLists (24, GL_UNSIGNED_BYTE, "Hello Windows OpenGL World");
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|