I’ve written following code to render in my 3d mesh editor 3 small axis to help artist to know how they are rotating the camera.
void CCAMERA::RenderViewMatrix()
{
//Saves old stuff
float ovMatrix[16];
int oViewport[4];glGetFloatv(GL_MODELVIEW_MATRIX,ovMatrix);
glGetIntegerv(GL_VIEWPORT,oViewport);//Creates the viewport (at older_maxs - 50),reset matrix and renders rotation vectors
//glViewport(oViewport[2] - 50,oViewport[3] - 50,oViewport[2],oViewport[3]);
glViewport(0,0,50,50);
gluPerspective(45.0f,50/50,0.1f,100.0f);glMatrixMode(GL_PROJECTION);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();glBegin(GL_LINES);
glColor3f(0.0f,0.0f,1.0f);
//X
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(1.0f,0.0f,0.0f);
//Y
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(0.0f,1.0f,0.0f);
//Z
glColor3f(1.0f,0.0f,0.0f);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(0.0f,0.0f,1.0f);
glEnd();//Restores old stuff
glViewport(oViewport[0],oViewport[1],oViewport[2],oViewport[3]);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}
Now, it renders axis ok, but how to render them rotated according to MODELVIEW rotation?
Thx ))
Dexter
[This message has been edited by Dexter (edited 01-01-2002).]