Here are my solutions for assignment 2.

This assignment used the stencil and depth buffers to draw models using various line types. It also enabled OpenGL fog and loaded and executed GLSL shaders.

Problem 1: This problem loads several simple models and allows the user to be able to selectively draw them in one of four modes: standard OpenGL lighting, standard wireframe, without hidden lines, wireframe mode with halos.

Here is the program when it first started. The menu lets the user selectively draw the models in one of the four modes.

All models drawn in standard OpenGL lighting.

Models drawn in standard wireframe. (The user can move around in the scene as well as rotate about the y-axis).




Models drawn with the hidden lines removed.


Models drawn with halo wireframe.



Problem 2: This problem enabled OpenGL fog.

Linear Fog

Exp Fog

Exp2 Fog

Problem 3: This problem loaded and executed GLSL shaders.

Part 1: Replaces the texture on the floor with a sinusoidal pattern. This can be changed with the +/- keys.



Part 2: This shader changes the alpha component of an objects color depending on the surface orientation. Areas directly facing towards or away from the eye are tranparent. Locations with normala perpendicular to the eye are completely opaque. These update as the eye moves. This are several shots that illustrate this.