Computer Graphics I

4003-570 / 4005-761

Assignment #4: OpenGL Shading Language (GLSL)



Date posted: November 2, 2011
Date due: November 11, 2011 at 11:59 p.m.

Drop box available at myCourses


Introduction

This project is designed to give you experience using the OpenGL Shading Language (GLSL). You are to write a set of GLSL shaders to implement a shading method as described below.

Required Elements

You will be implementing a fragment-shader version of the Phong shading model.

Your implementation must include both a vertex and a fragment shader. The vertex shader must do a very small portion of the necessary Phong calculations (specifically, any that involve vertex-specific information such as vertex position); the color calculations must be done in the fragment shader.

Supplied Files

You can download skeleton and support files for the assignment here.

The README included in the folder provide a description of the files. Be sure to read this carefully.

What to submit

As you are writing shaders, all you need to submit are the two shader source files you are creating. These files must be named phong.vert and phong.frag. Submit your files (along with an optional README file) to the dropbox on myCourses.

Expected Output

The following figures show the expected output of the driver programs:

driver1.c driver2.c

Grading

Your grade will be based on the following items:

Notes

The supplied ShaderSetup() includes all the necessary code to verify that your shaders compiled and linked correctly.

You may want to experiment with your shader code using your scenes from Assignment 3.

If you will be testing your code on your own system, you may want to determine what versions of OpenGL and GLSL are installed on that system. A simple OpenGL demo program which draws a single line on the screen and also reports the results from glGetString() queries for GL_VENDOR, GL_RENDERER, GL_VERSION, GL_SHADING_LANGUAGE_VERSION, and GL_EXTENSIONS is available here.

The CS Ubuntu systems have OpenGL 2.1.2 and GLSL 1.20 installed on them; thus, features in newer versions of these languages will not work on our systems. This includes the GLSL switch() statement, and the use of the generic in and out qualifiers for vertex and fragment shader global variables.

If you have a newer verson of GLSL than the one on the CS systems, be careful, because your GLSL supports features that aren't available in the version your code will be tested with, and if you use them your solution will not work when it's being graded!

Unlike previous assignments, you will most probably not be able to test this assignment remotely, as GLSL accesses the graphics hardware directly.