2D text in a 3D environment
This may seem very simple, but I can't figure it out.
I'm using wglUseFontBitmaps to draw 2D text in a 2D overlay, kinda like a HUD in a 3D game.
Now I want to use the 2D text in the 3D environment. An object with a 3D coordinate should have a flat text with info about it straight above it.
Right now I use glRasterPos2f to position the text. I've messed with glRasterPos3f, gluPerspective, glOrtho, switched the matrix mode between GL_PROJECTION and GL_MODELVIEW, etc; either it shows nothing or it ignores the depth and just draws it like it does the HUD text.
Any ideas on how to tackle this?
Sorry, that's not what I meant. That tutorial draws the text on top of the 3D environment, so the text itself is still in its 2D overlay environment. That's what I was doing already. I want to draw the text straight above an object in the 3D space. I basically just need the 2D screen coordinates (x, y) of the 3D object (not the (x, y) coordinates of the object in the 3D space).
How do I get those screen coordinates from a 3D space?
The samples on this site are for DirectX but a very easy to translate to OpenGL