CMPS-4490 - Game Dev

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: 4490/shader_lab

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

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.

Help for GLUT keyboard input

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 to help you.