PDA

View Full Version : Ortho/Camera Question



redknite
10-10-2000, 02:04 PM
Ok. I have a 3d scene that im drawing, and the player can walk around in via a camera. The Camera works fine in displaying the world and such, but now i need to display some sort of score on the screen at all times. I know the raster graphics are slow, so i want to use a textured poly. But im having problems getting the poly to follow the camera(be drawn in refrence to the camera) Its drawn at the initial position and then stays there regardless of movement. Any ideas? Heres the code im using.

glMatrixMode (GL_MODELVIEW);
glPushMatrix ();
glLoadIdentity();

float rotMatrix[ 16 ];
SceneCamera->camOrient.getMatrix(rotMatrix);

glMultMatrixf(rotMatrix);

glTranslatef(SceneCamera->camX, SceneCamera->camY, SceneCamera->camZ);

glMatrixMode (GL_PROJECTION);
glPushMatrix ();
glLoadIdentity ();
gluOrtho2D(SceneCamera->camZ - 1, 640, 480, SceneCamera->camZ + 1);

glBegin (GL_QUADS);
glVertex3i (150, 0, -1);
glVertex3i (640, 0, -1);
glVertex3i (640, 480, -1);
glVertex3i (150, 480, -1);
glEnd ();
glPopMatrix ();

Khrob
10-10-2000, 03:49 PM
When you've drawn the world like this, reset the matrix (modelview, I think) then draw your alphadtextured quad from -1.0,1.0 1.0,1.0 1.0,-1.0 -1.0,-1.0

Hope this is in some way accurate/useful!

redknite
10-11-2000, 06:51 AM
nevermind, fixed my own problem.

thanks