Programming assignment 2: Simulated flying over surface
CS-116A: Introduction to Computer Graphics
Instructor: Robert Bruce

Objective

For this assignment, you will create a randomized rough terrain as a wireframe mesh then fly over the terrain from the perspective of the camera using C or C++ with the OpenGL Utility Toolkit (GLUT). The specifications are outlined below.

Specifications

The terrain should be created from a three-dimensional array of vertices (X, Y, Z).

Each vertex should be evenly spaced on a grid in the X plane (left to right) and Z plane (moving in and out of the screen).

Each vertex should have a randomized value in the Y plane (up and down). The Y plane is what gives the terrain a mountainous surface.

Draw an unfilled triangle (wireframe) between every adjacent vertex such that each triangle shares an edge with another triangle. The triangles should not overlap or encapsulate other triangles. This will create a giant, tesselated, polygonal surface mesh.

The camera will be controlled using the following keys:

  • The up-arrow key moves the camera and the camera focus forward.
  • The down-arrow key moves the camera and the camera focus backward.
  • The left-arrow key moves the camera and camera focus right.
  • The right-arrow key moves the camera and camera focus left.
  • The 'a' key moves the camera and the camera focus up (further above the ground).
  • The 'z' key moves the camera and the camera focus down (closer to the ground).

The camera should not move beyond the edges of your ground terrain (in the X and Z planes).

Note: It is ok for the camera to fly through a mountain peak.