(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:

Features of EduPhong:

  1. Separate shader programs for Phong shading and Gouraud shading. (Both kinds of shading use Phong lighting!)
  2. Allows ambient, diffuse, specular and emissive lighting to be turned off and on independently.
  3. Allows optional use of the Fresnel adjustment for specular lighting.
  4. Supports multiple lights, similar to what was supported in legacy OpenGL.
  5. Supports distance attenuation.
  6. Supports directional and positional lights.
  7. Supports a directional or positional viewer.
  8. Supports spotlights, similarly to what was supported in legacy OpenGL.
  9. Supports applying a texture map to the non-specular lighting.
  10. The shader programs are written modularly to facilitate using the shader code in other applications.
  11. 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.