Search code examples
mathopengl3dvector

How to get Yaw, Pitch and Roll from a 3D vector


I have a direction vector that applied to a position gives me the point at which the camera should look. How can I get from that yaw, pitch and roll in order to use glRotatef properly?

Thanks in advance


Solution

  • You probably don't actually want the yaw, pitch and roll. You just need the correct transformation. Try using gluLookAt to build it. Documentation.