**Math 155 - Winter 2001
The ModelView program**

The **ModelView **program will let you experiment with
using 4x4 matrices to perform transformations in 3-space. The purpose of this
program for this class is twofold:

- Gain experience with model view transformations. This will be helpful in understanding how to compose transformations in your own OpenGL programs.
- Provide an example of how to use MFC widgets (specifically the dialog box).
Learning how to do this is *
**optional*** for this class, since you can use the "glut" routines to control your programs via keyboard input or via popup menus.

__ Getting started:__ Find the ModelView program in the

- Note that you can toggle between displaying a solid letter "F" and a teapot.
- Enter a scaling transformation: for instance make the diagonal entries of the matrix
"2", "1" and "0.5" and then press the
**Apply**button. Observe what happens. Which axes are the**x**,**y**,**z**axes? Does this make sense? Is it a righthanded coordinate system? - Enter a transformation that rotates around the
**y**-axis:

( | ) | ||||
---|---|---|---|---|---|

0 | 0 | -1 | 0 | ||

0 | 1 | 0 | 0 | ||

1 | 0 | 0 | 0 | ||

0 | 0 | 0 | 1 | ||

- Try some translation transformations (by setting the three upper entries in the fourth column).
- For fun: what happens if you use the identity matrix, but change the lower right 1 to 2 (or to 0.5)? Why does this happen?
- (This is harder than the above.) Figure out what matrix makes a 45 degree rotation
around the
*z*-axis. Then find the matrix that makes a 45 degree rotation around the*x*axis.

__ Composing transformations.__ The other buttons can be used
to compose transformations, e.g., to see the effect of a translation followed by a
rotation (or vice-versa.)

The operation of the program is little difficult to explain, but here goes: There are 3 matrices that are being maintained, there is a matrix

**Apply:**sets**C := D.**No change to**M.****Reset and Apply:**Sets**M**equal to the identity and**C := D.****Premultiply and Apply:**Sets**M := CM.**Then sets**C := D.****Identity Matrix.**Sets**D**equal to the identity.

**Important:** The transformations are composed by **pre**-multiplying.
This is the easy way to intuitively create and visualize the composition of
transformations. However, in OpenGL, transformations are **post**-multiplied,
so your programs have to apply the transformations in the reverse order from how you apply
them in this demonstration program.

** Try it out: Smooth vs. Flat shading:** Find the place in
the code where the teapot is drawn in