Rotating coordinate axes

Hi oll,

I am able to draw 3D coordinate axes in Opengl, however i want to rotate the coordinate axes based on my rotation matrix which i compute from some data. I don’t want to change the origin of the coordinate axes but only rotate the coordinate axes. Moreover i don’t want to redraw the window on which the axes were drawn, i.e i don’t wan go through the code which draws the window but only rotate the axes.

Pls help

well I assume that your axes are GL_LINES? then there are 2 points which define each line so initialy you got something like this:
UP : P1(0,0,0) - P2(0,1,0)
FRONT : P1(0,0,0) - P2(0,0,-1)
RIGHT : P1(0,0,0) - P2(1,0,0)

Soo… you are going just to rotate these P2s and you got it. Even if your P1s aren’t at absolute origin you can do this like thinking relative. You store P2 as just direction from P1.
Getting something like this:
UP : P1(50,0,50) - P2(0,1,0)
But when drawing you will set:
glBegin(GL_LINES);
glVertex3f(P1.x,P1.y,P1.z);
glVertex3f(P1.x+P2.x,P1.y+P2.y,P1.z+P2.z);
glEnd();

And this draws your upvector at 50,0,50 pointing up. If you rotate it you just again rotate P2 so it could look like P2(0,0.7,0.7) and when drawind add it to P1.
Simple huh?