|OpenGL 2.0 Shading Language Vertex Lighting Demo.
This Windows demo implements the per-vertex Blinn-Phong lighting model that fixed function OpenGL uses with a series of OpenGL Shading Language (GLSL) shader programs. This demo implements specular highlights using a local viewer lighting model rather than the OpenGL default infinite viewer lighting model. Each of the three light source types - directional, point, and spot - are each implemented as separate GLSL shader programs.
The purpose of this demo is to replicate the fixed function lighting model. Switching between the fixed function pipeline and the programmable pipeline should show no visible differences within the scene in this demo. The shaders presented in this demo will serve as the foundation for future GLSL demos.
The demo consists of a single textured cube centered at the world origin. The light source is fixed and located directly in front of the cube where the virtual camera is located in the scene. The mouse can be used to rotate the cube and to zoom in and out of the scene. Note that the cube intentionally has a very low polygon count to emphasize the fact that realistic per-vertex lighting depends on sufficiently tessellated geometry.
1. This is an OpenGL 2.0 demo. This demo will not run on OpenGL 1.x hardware.
2. This demo requires the Visual C++ 2010 Library Runtimes. Download instructions can be found here.
Download executable, source, and Visual C++ 2010 solution files.
10 July 2010.
Added missing .vcxproj.filters file to the project.
13 June 2010.
Updated solution to Microsoft Visual Studio 2010.
1 April 2008.
gl_font.cpp: Fixed bug in drawTextEnd() method where the vertex buffer was not being unmapped when there's no text to draw. Thanks goes to Ari Ohvo for spotting this bug.
2 February 2008.
Updated solution to Microsoft Visual Studio 2008.
6 January 2008.
Renamed the file decal_map.tga to color_map.tga.
In all three shaders renamed the uniform sampler2D variable from decalMap to colorMap.
main.cpp: Major rewrite to use the same format and structure as the more recent OpenGL demos. Added font support. Added diagnostic output text. Added help text. Added ability to toggle textures on and off. Added support for Vista.
8 December 2006.
main.cpp: Changed the clear color to CornflowerBlue. Removed the cube's silver material and replaced it with OpenGL's default material. Replaced the procedurally generated checker pattern with the same stone wall decal map texture as used in the bump mapping and parallax bump mapping demos. Much of the code has been rewritten to more closely match the structure of the bump mapping and parallax bump mapping demos.
18 November 2006.
main.cpp: The UpdateLighting() function was not being called when the camera was being dollied. This was causing the spot light's cone to remain fixed in size as the camera was being dollied.
28 April 2006.
Fixed the issue where the demo was crashing during shutdown if OpenGL 2.0 is not supported.