OpenGL Text Output
Question submitted by (21 July 2000)
|Return to The Archives
|I started working on a game in OpenGL in MSVC and I want to output text to the screen for debug purposes etc.. But how to draw text on the screen? I have a voodoo2 card, and that's why I can't use DrawText() or TextOut() Windows functions, because those will draw to my ati video card Is there some way to do it whithout writing your text functions?
OpenGL doesn't directly offer support for drawing characters. Rather, it
provides low-level support leaving the rest up to you. If you have a copy of
The Red Book ("OpenGL Programming Guide" by Woo, Neider & Davis), you can
look in Chapter 8 (on page 287 of the second edition) and find source to
font.c which does what you want.
Alternatively, you can read that chapter ("Chapter 8: Drawing Pixels, Bitmaps, Fonts, and Images") from the Red Book online right here. While I'm at it, here are some more useful links (these are books online):
Response provided by Paul Nettle
This article was originally an entry in flipCode's Ask Midnight, a Question and Answer column with Paul Nettle that's no longer active.