displaying a HUD that follows the camera

Started by
4 comments, last by Lufian 20 years ago
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
Advertisement
Correct, go into ortho and render your text, then go back to perspective
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.
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.
Thank you,

I''m very grateful, it worked.
You''re welcome.
Jehovah is viewed by Gnostics as fundamentally evil, jealous, rigid, lacking in compassion and prone to genocide.

This topic is closed to new replies.

Advertisement