okay… well first i’ll assume your window has the dimensions 8x6 (in terms of ogl distances, not pixels… in other words, if your orgin is in the center of the screen you should be able to see from -4 to 4 across the x dimension and -3 to 3 across the y). i’ll also assume you have the variables rotX, rotY, and rotZ, which control the angles of rotation. lastly, i’ll assume you’re using glut…
in your display function, at the end, add this code:
// save previous matrix
glPushMatrix();
// clear matrix
glLoadIdentity();
// apply rotations
glRotate3f(rotX, 1.0, 0.0, 0.0);
glRotate3f(rotY, 0.0, 1.0, 0.0);
glRotate3f(rotZ, 0.0, 0.0, 1.0);
// move the axes to the screen corner
glTranslatef(-3.0, -2.0, 0.0);
// draw our axes
glBegin(GL_LINES);
// draw line for x axis
glColor3f(1.0, 0.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(1.0, 0.0, 0.0);
// draw line for y axis
glColor3f(0.0, 1.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 1.0, 0.0);
// draw line for Z axis
glColor3f(0.0, 0.0, 1.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 0.0, 1.0);
glEnd();
// load the previous matrix
glPopMatrix();
that’s it. i didnt test this code so lemme know if there are any problems. hope it helps.
[This message has been edited by moox (edited 03-06-2001).]