PDA

View Full Version : drawing stationary 2d primitives & using gluLookAt



Choff04
11-28-2009, 11:57 PM
So I appologize in advance if this is a basic question, but its hard to find anything regarding what I need because of the keywords involved.

But here is the issue:

I want to draw 2d buttons using primitives, but I need the buttons to always be at the bottom of the screen even if I am changing where the camera is positioned and what direction it is looking at.

Do I always need to draw them based on the camera location? or is there a simpler way to do this?

If I need to provide more details, let me know.

Artemiy
11-29-2009, 12:23 AM
You could always move the camera (the scene, actually) after you've drawn the buttons, for instance.

Alternatively, to avoid unnecessary glitches you can switch to the orthographic projection (glOrtho) after you've drawn the scene, clear the depth buffer but not the color one, then just draw the buttons on top of the picture.

Choff04
11-29-2009, 12:41 AM
When I draw the buttons in glOrtho after i've drawn the scene, they still seem to be moving if the camera position is moved.

Artemiy
11-29-2009, 12:43 AM
Do glPushMatrix() and glPopMatrix() help? Or glLoadIdentity() for the modelview matrix before you draw the buttons?

Maybe you can use the stencil buffer to draw the buttons beforehands and then draw the scene in the free pixels...

Choff04
11-29-2009, 12:46 AM
Ahhh I needed to call glLoadIdentity()! Thanks for the help, I think all is working for now!