title: OpenGL Rotation relative to object axis
body: <p>I'm struggling with the rotation of an object. I want to illustrate the gyro readings from my AR Drone 2.0 with this little program.
  Maybe you want watch this short video first: <a href="http://youtu.be/HvrLS8Olr2c" rel="nofollow">http://youtu.be/HvrLS8Olr2c</a></p>
  
  <p>The sliders are for x,y,z rotation that is done with</p>
  
  <pre><code>glRotatef(rotationX, x_vect.x, x_vect.y, x_vect.z);
  glRotatef(rotationY, y_vect.x, y_vect.y, y_vect.z);
  glRotatef(rotationZ, z_vect.x, z_vect.y, z_vect.z);
  </code></pre>
  
  <p>where the values are:</p>
  
  <pre><code>Vector x_vect = {1.0f, 0.0f, 0.0f};
  Vector y_vect = {0.0f, 1.0f, 0.0f};
  Vector z_vect = {0.0f, 0.0f, 1.0f};
  </code></pre>
  
  <p>You can download the full source code of this small app from here: <a href="http://ablage.stabentheiner.de/2013-01-21_openglimportmodel.zip" rel="nofollow">http://ablage.stabentheiner.de/2013-01-21_openglimportmodel.zip</a></p>
  
  <p>The problem is that if you rotate let's say the Y axis first and then try to play with the X-slider it won't pivot the axis it should do (see C4D animation for comparison). I think it's because I perform the X rotation first and then the Y rotation. Swapping the lines of code doesn't solve the problem but pushes it to another axis..</p>