want to draw text in simple 2D with openGL

I am making a simple 2D graphical presentation, which literally includes rectangles and squares as I only have to show stacks and queues. The problem is that I also have to display text and labels and information in the form of strings but dont know how to do it. Either help me or direct towards a webpage from where I can get help. Secondly I want to make simple buttons in openGL, what should I do?

Use wglFontBitmaps (its in MSDN) to generate display lists from a given font. There are examples on the web all over the place. Just do a google for it, or head over to NEHE or another coders site.

Hope this helps.

Have a look at…
http://homepages.paradise.net.nz/henryj/code/index.html

The problem is that I am using the glut library. So I cannot use windows dependant code. The link provided here used another library and is for mac, I am using a vc6 as compiler on windows.

I was under the impression that GLUT provided font handling by default? please correct me if I’m wrong GLUT users

Edit–>

void glutBitmapCharacter (void *font, int character)
int glutBitmapWidth (GLUTbitmapFont font, int character)
void glutStrokeCharacter (void *font, int character)
int glutStrokeWidth (GLUTstrokeFont font, int character)

Try googling for `glut+font’ - there are quite a few pages there but unfortunately, a lot of them are pretty crap.

[This message has been edited by Robbo (edited 07-21-2002).]

I am able to use glutBitmapCharacter function but unable to position the characters on the screen. Secondly I have checked in the glut specs, but these functions only display a character at a time; I on the other hand want to display whole lines of text would I have to do it one character at a time?

Right on the front page of this site there is a link to a Surevey of OpenGL font Technology . Read that and try some of the free texture based font libraries. They’ll probably work nicely.

Here is how you display text in Glut using the glutBitmapCharacter

char *name=“displaying text”;
char *c;
glRasterPos3f(x, y,z); //position your text

for (c=name; *c != ‘\0’; c++)
glutBitmapCharacter(font, *c);