CS 424: Computer Graphics, Fall 2017
Lab 12: gl-matrix

This is, I hope, a genuinely short lab that you should be able to complete in the lab period. In fact, if you have extra time, you can use it to work on Lab 11, which should be turned in by 9:00 AM Saturday (November 18), at the latest. Today's lab will be due next week.

You will need a copy of /classes/cs424/lab12-files. The resources folder in that directory contains a copy of the JavaScript library gl-matrix.js, which we have discussed in class. In this lab, you will use that library to manipulate a modelview matrix. There is also a copy of basic-object-models-IFS.js, which is used to create the basic objects that are used in the program. You will work on the file lab12.html.

The lab next week should also be short, and both labs will be due next Friday, the day after Lab 13. The final lab, in the last week of classes will be devoted to final project presentations.

The project

The original lab12.html shows a tiny cube that can be rotated by dragging your mouse on the canvas. Your assignment is to replace the cube with a large windmill sitting on a rectangular base, as shown in the picture at the right. The vanes of the windmill should rotate when animation is turned on. Each vane of the windmill should be constructed from two cones, as we have done in examples in the past. (The teapot that is sitting on the base is a bonus, if you can figure out how to add it.)

The program includes three instance variables representing basic objects: cube, cone, and cylinder. These variables have instance methods cube.render(), cone.render(), and cylinder.render() that can be called to draw the objects. The untransformed objects are of size 1 in all three directions, and they have their center at (0,0,0). The axis of the cone and the axis of the cylinder are aligned along the z-axis. All objects in the scene should be transformed versions of the basic objects (or of a basic teapot object).

By the way, this is procedural graphics, not scene graph based. You will probably want to write functions to draw some of the complex objects.