04-14-2006, 04:56 PM
hi,
I have the following code. I am trying to rotate around the point that I am looking at (1.5, 2.5, 0) but it seems the rotation is around the 0, 0, 0 axis. What should I do to rotate around the center point that I am looking at?
glLoadIdentity();
gluLookAt(0, 0, -10, 1.5, 2.5, 0, 0, 1, 0);
glRotatef(rotTri, 1.0f, 0.0f, 0.0f);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(1.0f, 3.0f, 0.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex3f(2.0f, 1.0f, 0.0f);
glEnd();
I have the following code. I am trying to rotate around the point that I am looking at (1.5, 2.5, 0) but it seems the rotation is around the 0, 0, 0 axis. What should I do to rotate around the center point that I am looking at?
glLoadIdentity();
gluLookAt(0, 0, -10, 1.5, 2.5, 0, 0, 1, 0);
glRotatef(rotTri, 1.0f, 0.0f, 0.0f);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(1.0f, 3.0f, 0.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glColor3f(0.0f, 0.0f, 1.0f);
glVertex3f(2.0f, 1.0f, 0.0f);
glEnd();