CS 300

Logo

Computer Graphics
Fall 2021

Interactive Pyramid Project

You will be creating an application to render and transform a pyramid.

interactive pyramid preview

Requirements

You will model a Pyramid using the vertex technique from the cube example. You will also add lines that represent the X, Y, and Z axes. Each line starts at the origin and extends along its respective axis to the maximum positive value in clip coordinates. The X, Y, and Z lines will be colored red, green, and blue respectively. Each face of the pyramid should be a solid color (no color interpolation).

When the geometry is complete you will need the following HTML controls:

You will also need to add keyboard input controls when the following keys are pressed down:

Implementation

The Pyramid must be constructed using the vertex technique. Color and vertex values used to construct the pyramid will be contained in two const arrays. The axis lines are also drawn using a function. The colors of each pyramid face must be: magenta, red, yellow, green, and blue (the order does not matter). One function will be used to create the entire pyramid, with helper functions to create the two different types of faces. Keyboard button presses result in an immediate change in the application. Editing the angles in the text inputs does NOT change the orientation of the pyramid until either the apply rotation button is clicked or the ENTER key is pressed. ALL ROTATIONS MUST BE DONE IN THE VERTEX SHADER and the rotations must be done in X, Y, Z order. All keyboard button presses that change the rotation of the pyramid will do so in 15 degree angle increments. Keyboard button presses should also update the angles in the text inputs.

Hints

Grading

You will earn up to 60 points for this exercise, broken down as follows: