CMPS-3480 - Computer Graphics

Lab 8 - OpenGL Shaders (ARB, GLSL)

Elements of this lab:
    • So called "modern" OpenGL
    • ARB (OpenGL Architecture Review Board standards)
    • GLSL (OpenGL Shading Language)
    • GLUT utility
    • Transformations using a vertex shader
    • Textures using a fragment shader

Step 1:
Do your work in Odin directory: 3480/8

Start by copying the lab files from:
   /home/fac/gordon/p/3480/code/lab8/*

files...
   Makefile
   arb8.c
   glsl8.cpp
   tree.gif
   zebra.png

Build programs with make.

Run arb8

The program is built using the Glut library.
Add the following functionality...
   1. Modify the program colors to our official school colors.
   2. Press the Esc key to close the program.
   3. Press the R key to rotate the rectangle on each press.
   4. Press Shift-R to rotate in the opposite direction.

program original output...


something like this...


Step 2:
Run glsl8

Activate the GLSL shader.
Activate the texture.

attribute vs uniform vs varying variable

This triangle object has multiple textures.
The strength of each texture is controlled by a value.

Add the following functionality...
   1. Press the F-key to make one texture gradually fade away, while the
      other texture increases to full-strength.
   2. Continue pressing the F-key to reverse the effect.

Holding the F-key would look about like this...



Here is a GLSL tutorial on uniform variables to help you.


For double lab points...
   1. Produce your own gif animation like the one above.
   2. Animation is produced when the 'B' key is pressed.
   3. You may replace the texture maps with your own.
   4. You may change the shape of the triangle.
   5. Due at end of semester.


What to turn in...
Your instructor will find your work on Odin.