Jump to content
  • Advertisement
Sign in to follow this  
Beaverbutt8

OpenGL text problem

This topic is 4592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 mode
g_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();

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!