Hi everyone,
I’m coming from the world of Direct3D programming, as I’m trying to port my project over to OpenGL/SDL…
All I’m trying to do, is to move the camera a few units back, and up while pointed at 0,0,-10 (in OpenGL).
When I begin my scene rendering, I set the view matrix using:
//move our camera 10 units up, 5 units back,
//and point to 0,0,-10.
//Our up vector should be(?) 0,1,0
gluLookAt(0,10,5,0,0,-10,0,1,0)
//render a simple damn triangle! :(
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -10.0f);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 1.0f, 1.0f);
glVertex3f(-5.0f, 0.0f, 5.0f);
glVertex3f(-5.0f, 0.0f, -5.0f);
glVertex3f(5.0f, 0.0f, 5.0f);
glEnd();
glPopMatrix();
But my vertices do not come across properly! The
triangle looks flipped somehow…
I’ve tried re-ordering the vertices, but I still roughly end up with the same result…
Am I using gluLookAt wrong??
thanks for any help…