I'm using LWJGL and OpenGL 1.1 at this time and I was wondering what command is used to change the yaw, pitch and roll?



glRotatef(Angle.X, 1.0f, 0.0f, 0.0f) ;
glRotatef(Angle.Y, 0.0f, 1.0f, 0.0f) ;
glRotatef(Angle.Z, 0.0f, 0.0f, 1.0f) ;

(which of those angles are 'yaw', 'pitch', and 'roll', and the order in which you apply them, will depend on which axis you're considering to be 'up')

  • \$\begingroup\$ -1: For using Euler angles without any mention of the pitfalls of this. Like Gimbal Lock and such. \$\endgroup\$ – Nicol Bolas Jan 18 '13 at 2:15
  • \$\begingroup\$ I didn't choose to use euler angles -- the OP did. It was explicitly a "what is the function to apply pitch/yaw/roll in this API" question, and my answer is the objectively correct answer to that question. If I'd provided an answer which said how to rotate by a quaternion or by a rotation matrix, it would not answer the question which was asked. \$\endgroup\$ – Trevor Powell Jan 18 '13 at 2:56
  • \$\begingroup\$ With that said, it would absolutely be appropriate to provide a "here's why you may not want to do that" note as a comment on the question. It's just not an answer to the question that was asked. \$\endgroup\$ – Trevor Powell Jan 18 '13 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.