Printing Text with OGL

Hi, I’m a Visual Basic programmer stepping out of my protected little RAD universe into the depths of OpenGL. I’ve managed to do some cool 3d stuff with transparency, texturemaps, etc, but one thing still eludes my completely: How do i make OpenGL print Text onto the screen? I know it’s possible (Quake 3 does it, unless those letters are generated with 2d polygons(!) ).

Is there some function that you pass a string and a set of coordiantes?

There are 3 ways to print text in opengl.

  1. Use glut
  2. Use your windowing systems bitmap font function
  3. Use texture mapped polygons with your text on them in an orthograhpic projection.

Depending on what you want the text for and what platform you are running they all have their advantages and disadvantages.

So we need more info

Program9 on my webpage uses method one.


Thanks, I think number 2 will work best because VB can do this easilly. I looked at your source code for program9; the

glutBitmapCharacter ( GLUT_BITMAP_9_BY_15, string[i] );

is not part of the GL module that my compiler is using (basic can’t import C header files). I could add it if I found the exact syntax of the command and the actual values of the constants that can be used. It would proably be something like:

declare sub call lib “OpenGLUtility” alias “glutBitmapCharacter” ( params as integer, text as pstring )

but I could’nt be sure. You wouldn’t happen to know the value of GLUT_BITMAP_9_BY_15 would you?

Thanks for the help,
-Noah Desch