To move anything n units at a x° angle, move it cos(x)*n in x-direction and sin(x)*n in y-direction. (you might want to include math.h).
Second, translating before rotating seems to make not much sense. I’s suggest something like the following, called from your display function:
GLfloat angle = 0.0;
void moveArrow ( GLfloat stepwidth, GLfloat angle )
glPushMatrix ( ); // to move it independantly from the rest of the scene
glRotatef ( oldangle + angle, 0.0, 0.0, 1.0 ); // if angle = 0 it will just move forward
glTranslatef ( 0.0, stepwidth, 0.0 ); // if stepwidth = 0 it will just spin, if not it will move in y-direction (upwards, relatively)
glBegin ( GL_TRIANGLE );
// colors, vertices...
glEnd ( );
glPopMatrix ( ); // go back to the rest of the scene
This way you don’t need to do any math. It’s just like the car, first use the steering wheel and then the accelerator, not lift it around a bend and pose it in the correct direction afterwards
Damn typos in here…
[This message has been edited by Hermann (edited 02-07-2001).]