In this article, I will show how to implement projective shadow mapping in OpenGL using Cg shaders.
The basis of this post comes from the article titled [Transformation and Lighting in Cg]. I will assume the reader has a basic understanding of OpenGL and already knows how to setup an application that uses OpenGL. If you require a refresher on setting up an application using OpenGL, you can refer to my previous article titled [Introduction to OpenGL for Game Programmers].
I will take advantage of a few OpenGL extensions such as GL_ARB_framebuffer_object to create a offscreen framebuffer to render to and and GL_ARB_texture_border_clamp for clamping to the border color of the projective textures.