3D movement

Hi,

I’m trying to write a flight simulator but I’m having a problem with the code. Basically I’m taking the input from a joystick(hence only 2 axis for movement). I’ve been looking into quaternions but not 100% sure how to use them. Has anyone else got an algorithm, or see a major fault in my code.

Thanks.

Alasdair.

Joy Z and Y are taken from a joystick
RotateScene is a constant.
ZAngle = (RotateScene * JoyZ)
XAngle =(RotateScene * joyY);

glPushMatrix();
glRotated(XAngle,-1.0, 0.0,0.0);
glRotated(ZAngle,0.0,0.0,1.0);
glTranslated(XTrans, YTrans, ZTrans);
glCallList(thePoints);
glPopMatrix();

The major fault is that you always rotate the world around the same axes, while the real local axes would be rotated as well. You can’t represent a flight simulator movement with just two angles. Well, at least I found no way.