Phong Lighting Demo PDF Print E-mail
Written by Jay Taoko   
Friday, 16 January 2009 19:00

Here is something to download. It is a simple program featuring a 3D object and some controls to modify the shading of the object. Always a good exercise for me to go back to basics with a Phong shader. The program let you several parameters of the shader. You can adjust the colors and the specular exponent of the object material.

This is how you control the 3D view:

  • Click and drag the mouse left button: rotate the view around the object.
  • Click and drag the mouse right button: move the view away or closer to the 3D object.

I had to go through many details before releasing a program that works outside of my programming environment. I tested it on the following system:

  • Vista 64 + Geforce 8800 GTX
  • Vista 64 + Radeon HD 4670
  • Windows XP + Geforce 6600 AGP

There is one thing though! You have to install Microsoft Visual C++ 2008 Redistributable Package (x86). The program needs Visual Studio 2008 CRT libraries to run. Since Windows XP and Vista supports side-by-side assemblies, it is not enough to just put msvcrt90.dll into the program's executable directory. The DLL's manifest have to be in the right location. Installing Visual 2008 Redistributable Package will do just that for you.

Phong Lighting
Phong lighting demo.

The program is easy to use. Just play with the controls. Also you may change the shader file PhongShader.glsl that is in the directory Data/Shader. If you do, no need to restart the program to see your changes. Just press the reload shader button on the interface. Should you make an error in the shader code, you will see pink! Enjoy!

Download

[Update]: A new version of this demo is available. This latest version fixes some issues related to OpenGL 2.1 when the drivers supports OpenGL 3.0.

Comments (0)Add Comment

Write comment

busy