   opengl euler angle camera problem
  I know, euler angles suck, but I''m doing a project on them (and quaternions) for school, so I have to demonstrate an euler angle camera. I have an axis-angle camera already, and I am trying to convert it to euler angle and quaternion. My euler angle cam is all screwy. It''ll work okay for a second, but then it does wierd stuff, like invert the mouse, or lock for a second and then unlock. I borrowed *some* of the camera code from gametutorials to do my testing, cause I figured maybe I had my mousemove function done badly. Here it is.  void Camera::RotateCamera(double Yaw, double Pitch, double Roll){Vector OriginView = View - Position, NewView;Yaw = (Yaw * PI)/180;Pitch = (Pitch * PI)/180;Roll = (Roll * PI)/180;double SinYaw = sin(Yaw);double CosYaw = cos(Yaw);double SinPitch = sin(Pitch);double CosPitch = cos(Pitch);double SinRoll = sin(Roll);double CosRoll = cos(Roll);NewView.x =  CosRoll * CosYaw * OriginView.x;NewView.x += (-SinRoll * CosPitch + CosRoll * SinYaw * SinPitch) * OriginView.y;NewView.x += (-SinRoll * -SinPitch + CosRoll * SinYaw * CosPitch) * OriginView.z;NewView.y =  (SinRoll * CosYaw) * OriginView.x;NewView.y += (CosRoll * CosPitch + SinRoll * SinYaw * SinPitch) * OriginView.y;NewView.y += (CosRoll * -SinPitch + SinRoll * SinYaw * CosPitch) * OriginView.z;NewView.z =  -SinYaw * OriginView.x;NewView.z += (CosYaw * SinPitch) * OriginView.y;NewView.z += (CosYaw * CosPitch) * OriginView.z;View = Position + NewView;}void Camera::SetViewByMouse(void){int MouseX, MouseY;int CenterX = SCREENWIDTH / 2;int CenterY = SCREENHEIGHT / 2;int DirectionX;int DirectionY;static double CurrentRotationY = 0.0;SDL_GetMouseState(&MouseX, &MouseY);if(MouseX == CenterX && MouseY == CenterY)return;SDL_WarpMouse(CenterX, CenterY);DirectionX = (CenterX - MouseX)/10;DirectionY = (CenterY - MouseY)/10;CurrentRotationY -= DirectionY;if(CurrentRotationY >= 50.0)CurrentRotationY = 50.0;else if(CurrentRotationY <= -50.0)CurrentRotationY = -50.0;elseRotateCamera(DirectionX, DirectionY, 0);}  anybody got a fix?  
  Ok, I got part of it fixed. It no longer inverts the camera, as I added a check to see what quadrant the view vector is in in regards to the origin on the x/z plane. The camera is still very jerky though, and sometimes it will keep me from going too far on the y-plane. Kind of irritating. The rotatecamera function is the same. HEre is the new mousemove function   void Camera::SetViewByMouse(void){int MouseX, MouseY;int CenterX = SCREENWIDTH / 2;int CenterY = SCREENHEIGHT / 2;double DirectionX;double DirectionY;static double CurrentRotationY = 0.0;SDL_GetMouseState(&MouseX, &MouseY);if(MouseX == CenterX && MouseY == CenterY)return;SDL_WarpMouse(CenterX, CenterY);DirectionX = (MouseX - CenterX)/9;DirectionY = (MouseY - CenterY)/9;CurrentRotationY += DirectionY;if(CurrentRotationY >= 60.0)CurrentRotationY = 60.0;else if(CurrentRotationY <= -60.0)CurrentRotationY = -60.0;else if(View.z - Position.z <= 0) RotateCamera(-DirectionX, -DirectionY, 0);else if(View.z - Position.z > 0)RotateCamera(-DirectionX, DirectionY, 0);}  Any ideas on how to fix these last coupla problems, since I don''t need to worry about the inverted mouse?  ;  perhaps youre seeing gimbal lock?>>The camera is still very jerky though<<perhaps smooth it out, see a paul nettle flipcode artcile    http://uk.geocities.com/sloppyturds/kea/kea.htmlhttp://uk.geocities.com/sloppyturds/gotterdammerung.html  ;  It may be gimbal lock, but I''m not losing a degree of freedom, what is happening is that at z = 0 and z = PI, the camera will not move up and down *very far*. It still moves somewhat and is rather jerky, but I don''t think it''s gimbal lock. Thank you very much for the reply and the links though 