displaying a HUD that follows the camera
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
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement