(This page is still under development. Please email corrections or suggestions
for improvements to the author.)
EduPhong is a C++ software plus GLSL shader programs
implementing Phong lighting in vertex and fragment shaders which
allow either Gouraud shading or Phong shading.
This is
part of a set of programs introducing the
use of Modern OpenGL, which are
intended to accompany a possible second edition
of the book 3D Computer Graphics: A mathematical
approach with OpenGL, Cambridge University Press, 2003.
EduPhong includes vertex and fragment shaders
for Phong lighting, with either Phong shading or Gouraud shading.
This includes C++ data structures for recording information about
material properties, global lighting properties, and properties of
individual lights.
It consists of two C++ source files, EduPhong[.cpp,.h] and
several GLSL shader programs.
The EduPhong routines provide a full-featured implementation of
Phong lighting.
Available for download:
- EduPhong.zip: A zip file with all
C++ and GLSL source files.
- EduPhong uses the GlShaderMgr
C++ software package for reading GLSL shader programs from files.
You need to download those routines separately.
- There is documentation
of how to use the EduPhong routines for
setting up materials and lights for
Phong lighting.
- The documentation is based
on the main program SimpleLightModern.
You may download that software as an example of how to use
the EduPhong routines.
Features of EduPhong:
- Separate shader programs for Phong shading and Gouraud shading. (Both kinds
of shading use Phong lighting!)
- Allows ambient, diffuse, specular and emissive
lighting to be turned off and on independently.
- Allows optional use of the Fresnel adjustment for specular lighting.
- Supports multiple lights, similar to what was supported in legacy OpenGL.
- Supports distance attenuation.
- Supports directional and positional lights.
- Supports a directional or positional viewer.
- Supports spotlights, similarly to what was supported in legacy OpenGL.
- Supports applying a texture map to the non-specular lighting.
- The shader programs are written modularly to facilitate
using the shader code in other applications.
- Uses Uniform Buffer Objects, allowing a program to use easily switch between
different shaders for different versions of Phong lighting. For instance,
a shader using Gouraud lighting and a shader using Phong lighting can
be used together.
Version 1.0 of EduPhong, September 13, 2020.