Interactive Computer Graphics - Assignment 4

3D Transformations and Geometry in OGL


Topics:



Create an OpenGL program that displays a 3D colored cube.

Allow the user to transform the cube via key input.

Keystrokes should modify the specified transformation (scaling, translation and rotation).



  1. Cube geometry and color are defined in Lecture 8.

  2. Enable the depth test to ensure proper display.

  3. Create a menu that allows the user to specify the transformation to be modified. (SCALE, ROTATE, TRANSLATE)
    Apply all of the transformations in the order of scale, rotation, then translation, at each update.

  4. Define six keys for increasing and decreasing the X,Y,Z components of the current transformation.
    The cube should only be transformed with each key stroke.

  5. Define two keys for increasing and decreasing the delta added to the transformations.
    Each transformation will have its own delta.

  6. Define a key for resetting all of the transformations.

  7. You may decide where to calculate the necessary transformation matrices, in the application or in the vertex shader.

  8. The transformation matrix should be applied to your vertices in the vertex shader.

  9. Do not apply camera or projection transformations.

  10. Your program should print instructions to the terminal screen describing the functionality of your keyboard inputs.
    This should be the only text output that your program generates.

Note that since you will be using the default orthographic projection, translation in the Z direction should have no visible effect on the size of your cube.
Of course if you transform the cube outside of the default view volume, it will be clipped.

Your cube should look something like the following.


Grading Scheme

  1. Defining cube geometry and colors: 1 point
  2. Correct viewing: 1 point
  3. Correct rotations: 2 points
  4. Correct scaling: 2 points
  5. Corect translations: 2 points
  6. Mouse interaction: 1 point
  7. Keyboard interaction: 1 point


Last modified February 8, 2017.