• Advertisement

Archived

This topic is now archived and is closed to further replies.

displaying a HUD that follows the camera

This topic is 5065 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

Hi, I did a HUD that follows the camera, but it requires two translate and two rotate to follow the movement of the camera. I know that it will fail me later on, so I was wondering if there is an easier way of doing this without translating and rotating. I suspect glOrtho to be used, but I do not know in which context. Thank you

Share this post


Link to post
Share on other sites
Advertisement
Correct, go into ortho and render your text, then go back to perspective

Share this post


Link to post
Share on other sites
hummm yeah.... I assumed that, its just the fact of doing that doesn''t work. Let say I want a square to always be in front of the camera even with the camera rotating and translating, any small snippet of code would be appreciated.

Share this post


Link to post
Share on other sites
Do this after all your 3d stuff has been rendered.

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(......); //or use gluOrtho2d
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//Draw your HUD here


Usually people will save their existing matrices using glPush() glPop but it is not required.

Share this post


Link to post
Share on other sites

  • Advertisement