title: OpenGL direction of a vector in degrees (X, Y, Z)
body: <p>I have an object traveling along a 3D vector in terms of X, Y, Z... I need to rotate the object according to each axis (x-axis, y-axis, and z-axis).</p>
  <p>How do I get these measurements in terms of degrees?</p>
  <p>(I am using OpenGL and only know of <code>glRotatef(...)</code>) [glRotatef(...) documentation <a href="http://www.opengl.org/sdk/docs/man/xhtml/glRotate.xml" rel="nofollow noreferrer">here]
  </a>
  Looking at <a href="https://stackoverflow.com/questions/993332/obtaining-the-camera-rotation-in-radians-on-the-x-y-and-z-axis-in-opengl">this</a> question, the answer gives</p>
  <blockquote>
  <p>viewvector =<code>&lt;x, y, z&gt;</code></p>
  <p>r = sqrt(x² + y² + z²)</p>
  <p>phi = arctan2(y, x)</p>
  <p>theta = arccos(z / r)</p>
  </blockquote>
  <p>but from <a href="http://en.wikipedia.org/wiki/Spherical_coordinate_system" rel="nofollow noreferrer">this wiki</a> page I understand that:</p>
  <p>[Edit from Ignacio Vazquez-Abrams]</p>
  <blockquote>
  <p>phi =&gt; angle around Z-axis</p>
  <p>theta =&gt; angle between x/y plane</p>
  </blockquote>
  <p>but how do I find Y? or do I need to?</p>
  <p>The real question is, How do I represent this in terms of <code>glRotatef(...)</code>?</p>