Assignment 5 (3D terrain rendering)

In this assignment you will extend the code from Assignment 4 to visualize a grid in 3D. Essentially you will need to add the third coordinate to your vertices (use glVertex3f() instead of glVertex2f()) and change the default orthographic projection to a perspective projection (use glPerspective() or glFrustrum()). Choose the initial viewpoint so that it does not show a blank screen.

In addition implement keyboard options to rotate (with a predefined step angle) around the axes and translate forward, backward, up and down (with a predefined distance). This will allow you to rotate and translate the terrain in any direction and thus view it from any angle. Below are some examples of 3D views of \emph{set1, kaweah} and \emph{sierra} datasets.

In order to handle the larger grids provide keyboard options to increase and decrease resolution. The initial rendering should be fast and if necessary at low resolution (set the initial resolution as a function of the number of rows and columns of the grid).

In addition to the keyboard menu your program should include a menu that:

Challenge work (leading into the first pro ject): Animate a rotation of the terrain (around z-axis) and a fly-through the terrain. Essentially this means executing a sequence of one-step rotations and translations.

You do not need to submit your code. We will demo it in class.