Just like lighting and coloring, OpenGL will pass us the material information for objects, allowing us to light our objects just as they would be in the fixed function OpenGL state. This tutorial will show you how to get and use the material information on your lit objects.
Previously, we looked at simuling OpenGL per vertex lighting. Now we are going to learn how to do per pixel lighting, achieving a more realistic lighting effect.
GLSL also overwrites the default lighting in OpenGL, but once again, OpenGL passes all lighting information through to us in GLSL for us to use. This tutorial will teach you how to use this information to perform per-vertex lighting, identical to that in standard OpenGL.
OpenGL provides us with not one, but three different types of lights we can make, directional lights, point lights and spot lights. I will try to teach you about how each is different, and how to use them.
Now you have your scene looking a little nicer with some lighting, but all objects are a gray colour. Here we will learn how to assign materials to shapes to change how they look under different lighting conditions.
Flatly colouring shapes is perfect, if we want an unrealistic look to our scene. But for realism, we really want to add some sort of lighting system. You can learn here how to use OpenGL's lighting system for a more realistic scene.