In this lab you will implement in GLSL an interesting vertex and/or
fragment shader of your choosing.
Basic requirements
- Find or design an interesting use for vertex and/or fragment shaders
and implement it in a compelling 3D OpenGL application. You do not
have to do both vertex and fragment shaders; you may choose one (but
some applications benefit from the combination of both).
- Suggestions for vertex shaders: particle systems,
flocking/boids,
wave motion, cloth motion,
fractals
- Suggestions for fragment shaders:
Phong shading,
bump mapping,
procedural texture, Gaussian blur / bloom
- Your OpenGL application / virtual world need not be too complex, but
the overall program should be cohesive (i.e., not just a demo of the
shader program). You can build on top of one of your prior labs if you
wish.
Notes
- To make sure you have a working GLSL development environment, you
may want to try recompiling and running the
particle system demo. You need GLEW, and you'll probably need to
compile it. See the README
for the particle system for more details.
If it runs and shows an animated burst of black squares, you've successfully
run a vertex shader!
- I've tested this with Cygwin on Windows on the senior lab machines.
You are free to use other environments (as long as you use C/C++, GLSL, and
preferably FLTK). But you're on your own to get it setup, and I warn you,
GLSL is still quite new, and support is spotty from hardware, OS, OpenGL,
GLUT, GLEW, and compilers!
Resources
- Official
GLSL docs. Not easy to read, but it's the official source.
- GLEW: manages OpenGL
extensions for you. Up until OpenGL 2.1, GLSL was an extension of
OpenGL, so something like GLEW was needed. Most Windows installations
have old versions of OpenGL, so GLEW is generally needed. Don't worry,
it's small.
- The Orange Book (OpenGL Shading Language).
This is one of the most definitive books on GLSL.
-
NeHe Introduction to GLSL.
A fairly short overview, with some sample code.
- Lighthouse3D tutorials.
Covers both ARB and OpenGL2.0 syntaxes; this is a bit outdated now with GLEW.
-
ClockworkCoders GLSL tutorials at the official OpenGL SDK site.
- Our directory of GLSL sample code.
We also have a local copy of TyphoonLab's GLSL tutorials (PDFs).
-
AMD's RenderMonkey is a complex development environment for shaders.
Lab write-up
- Follow the template lab write-up
to document your program. Name your write-up:
your_name_lab5_writeup.doc (or .txt, etc.)
Put it in the same project directory as your code so that it will be
included in the tarball.
Electronic turn-in
- Put everything (C++ code, header files, executable, lab
write-up) into a tarball/ZIP and upload it to myCourses under "Lab5":
your_name_lab5.zip