CPSC362A
Video Game Development

Activity 9

Quaternion Camera Rotation

Create an OpengGL program that uses quaternions to allow the user to control the camera orientation.

Details

  1. The program should function identically to the previous assignment.

  2. The program should use quaternions such that:

    1. the mouse location is converted into two axis angles.

    2. the two axis angles are converted into two quaternions.

    3. the two quaternions are multiplied together to create a single quaternion.

    4. the quaternion is converted to a matrix.

    5. the model-view matrix is modified using glMultMatrixf. Note that this requires getting a pointer to the glm::mat4 object’s data using the function glm::value_ptr.

See quaternions.cpp for an example of how to use the glm library to manipulate quaternions.

Example