Article ID: 131024 - Last Review: November 21, 2006 - Revision: 3.4 Drawing Three-Dimensional Text in OpenGL Applications
This article was previously published under Q131024 SUMMARY
GDI operations, such as TextOut, can be performed on an OpenGL window only
if the window is single-buffered. The Windows NT implementation of OpenGL
does not support GDI graphics in a double-buffered window. Therefore, you
cannot use GDI functions to draw text in a double-buffered window, for
example. To draw text in a double-buffered window, an application can use
the wglUseFontBitmaps and wglUseFontOutlines functions to create display
lists for characters in a font, and then draw the characters in the font
with the glCallLists function.
The wglUseFontOutlines function is new to Windows NT 3.51 and can be used to draw 3-D characters of TrueType fonts. These characters can be rotated, scaled, transformed, and viewed like any other OpenGL 3-D image. This function is designed to work with TrueType fonts. The GLFONT sample shows how to use the wglUseFontOutlines function to create display lists for characters in a TrueType font and how to draw, scale, and rotate the glyphs in the font by using glCallLists to draw the characters and other OpenGL functions to rotate and scale them. You need the Win32 SDK for Windows NT 3.51 to compile this sample, and you need to incorporate wglUseFontOutlines in your own application. You also need Windows NT 3.51 to execute the application. MORE INFORMATIONThe following file is available for download from the Microsoft Download Center: Glfont.exe
(http://download.microsoft.com/download/platformsdk/sample24/1/w9xnt4/en-us/glfont.exe)
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591
(http://support.microsoft.com/kb/119591/EN-US/
)
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
To specify the TrueType font for which you want wglUseFontOutlines to create display lists, you must first create the desired logical font by
using CreateFont or CreateFontIndirect. Then, you must select the HFONT created into a screen device context (HDC) with SelectObject, and send the HDC to the wglUseFontOutlines function. Each character is mapped in the x and y directions in the display lists. You need to specify the depth in the negative z direction in the extrusion parameter of wglUseFontOutlines.
You can also specify whether you want the 3-D glyphs to be created with line segments or polygons. To instruct wglUseFontOutlines to create the 3-D glyphs with lines segments, specify WGL_FONT_LINES in the format parameter. To create them with polygons, specify WGL_FONT_POLYGONS. Here is an example showing how to create a set of display lists to draw the characters of the Arial TrueType font as a set of polygons: APPLIES TO
| Other Resources Other Support Sites
CommunityArticle Translations |





















Back to the top