title: OpenGL - rotating around 2 axes using glm
body: <p>I have created 2 cylinders that i wish to rotate using the following code:</p>
  <pre><code>glm::vec3 randVec3 = { 1.0f, 0.0f, 0.0f };
  glm::vec3 randVec4 = { 0.0f, 1.0f, 0.0f };
  d_tfms[i] = glm::rotate(90.0f, randVec3 );
  d_tfms[i] = glm::rotate(10.0f, randVec4);
  </code></pre>
  <p><code>d_tfms[i]</code> is a 4x4 matrix which is then being transferred to the vertex shader as the ModelView matrix.</p>
  <p>Before any rotation, this is how my cylinders look like:
  (ignore the other shapes, the cylinders here appear as <strong>hollow</strong> 2D circles)</p>
  <p><a href="https://i.stack.imgur.com/Aoljk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Aoljk.png" alt="enter image description here" /></a></p>
  <p>After the first rotation (90 degrees in the x-axis):</p>
  <p><a href="https://i.stack.imgur.com/OjRCb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OjRCb.png" alt="enter image description here" /></a></p>
  <p>After the second rotation (10 degrees in the y-axis):</p>
  <p><a href="https://i.stack.imgur.com/KD3aw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KD3aw.png" alt="enter image description here" /></a></p>
  <p>As you can see, those rotations don't make sense.
  In particular, if you look at the dark blue cylinder in the first image vs. the second, it seems like it doesn't rotate around its own local x-axis.</p>
  <p>What could be the problem?</p>