OpenGL text problem

Started by
18 comments, last by Deception666 18 years, 4 months ago
Hey guys, I got OpenGL text to work. The problem is that it functions the same way as a 3d model. If i turn the camera away - i can't see it. So, here's my question. How can i keep the text fixed on one position ( bottom left corner ) of the screen, regardless of what the camera does? A related question is how can i do the same thing with a .bmp that is the "Interface" of the game - what i mean is, like the ones you see in rpg's, a bar on the side, or top or whatever that shows your health, items, etc, etc. Thanks :D Mike
Advertisement
what i do because i suck is keep a relative coordinate which is always at the middle of the screen thats being rendered, but i believe there are ways to do overlays and stuff independant of the actual coordinates that are being looked at.
still, relative origin coordinates seem to work pretty well for me, might be a good started o_O. just make them move the same rate as your camera does and it should be ok
|aaap.penopticon.com| My website, including game projects. Collaboration/comments are welcome, please visit :)
Hey,

Check this out, it may help you.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13
The problem is that the camera is able to look up, down, left, and right
Make overlays the last step in rendering the scene.
Turn depth testing off.
Set the camera to an orthographic projection.
Load the identity matrix.
Begin rendering the text.

// revert the camera to orthographic modeg_pCamera->SwitchProjections(); if (g_bHideText) {    // push the matrix    glPushMatrix();    // load the identity matrix    glLoadIdentity();    // draw the text    g_pFPSText->Draw(rElapsedTime);    g_pStatText->Draw(rElapsedTime);    g_pHelpText->Draw(rElapsedTime);    // pop the matrix    glPopMatrix(); } // revert the camera to a perspective mode g_pCamera->SwitchProjections();
How do i do these two things :


"Make overlays the last step in rendering the scene"
"orthographic projection"
render your text as the last thing - overlays (correct me if i'm wrong)

and do a search here on game dev or google for glOrtho or gluOrtho

Ok, so how and where do i apply glOrtho? Right now the camera is using gluLookAt
Nehe has a tutorial on using glOrtho.
Ok, i turned in glOrtho, but the view got totally screwed up, it made the 3d room look really long

This topic is closed to new replies.

Advertisement