Writing text to an opengl window

I have a msvc++ dialog appl. running opengl.
What I want to do is simply write text to the display area, using varying font sizes, etc. using x, y coordinates. Or in other words given a x, y value place a character(s)beginning at that value…

Thanks,

JerryK

Hi,

If you use glut, you have the function glutBitmapCharacter(FONT_TYPE, c) which will draw the character “c”. There are different kind of font types implemented in glut, you could easily find them.
If you want to put your text at a specific position, you should use glRasterPos2f(x,y).

Here is an example:

glRasterPos2f(20,450); //position of text
for (int i = 0; i < strlen (s); i++)
{
glutBitmapCharacter (GLUT_BITMAP_HELVETICA_18, s[i]);
}

I found bitmap character text to be very slow - check out the NeHe tutorial on using texture quads to display text quickly (nehe.gamedev.net)