A Simple Cube

Goals

Flat shaded cube with rotation animation and perspective camera

Assignment

Use the repository from last time and follow the instructions in the slides:

eyes eyes means that the code is already in the repository and you just need to look at it.

clipboard clipboard means you can copy-paste the code and it should work.

memo memo means that you need to create a new file

o o indicates that you need to do more than just copy-paste the code.

In any case you need to understand what you are doing.

Material

List of things to implement extending the cube 3D demo

In the following, some tasks are listed that need to be implemented in order to better understand the implemented code.

Simple

(small and easy code changes)

  • Change the size of the cube
  • Change the color of the cube
  • Change the position of the cube to the top left of the canvas by modifying the viewport
  • Change the rotation speed of the cube

Complex

(needs new functions)

  • Change the color of the cube so that each edge has the same color on both adjacent faces, but there is a color gradient on each face.
  • Let the cube pulsate (change its size) in a sinusoidal way.
  • Draw a thousand cubes instead of one.
  • Change the camera to an orthographic camera (check gl-matrix for a helper function)

Insights

  • TBD