My brain has melted as I've spent forever on this problem.
I need to offset a cube from the origin by two in both the x and y direction however keep the one point perspective like I'm looking straight at it.
Everytime I translate the cube it is acting as if the projection is coming from the origin.
I cant figure out how to do it.
//this is here to draw a graph
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho(-10,10,-10,10,-10,10);
glBegin(GL_LINES);
glVertex3f(-10, 0,0);
glVertex3f(10, 0 ,0);
glVertex3f(0, -10,0);
glVertex3f(0, 10 ,0);
glEnd();
glPushMatrix();
glLoadIdentity();
glFrustum(-2.0, 2.0, -2.0, 2.0, 5, 100);
gluLookAt( 0,0,-6,
0, 0, 0,
0.0, 1.0, 0.0);
glutWireCube (.5);
glPopMatrix();
glFlush();
You're using gluLookAt on the projection matrix. This is wrong, gluLookAt is to be applied on the modelview matrix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With