I know web pages should be past this, but this site doesn't look right on IE.
I will fix it some day ( not for IE 6 though) but for now this is easier and a lot more fun.

Download firefox or chrome or hide this message forever...

Adding Materials




Adding materials to you objects is even easier then fog, but you will spend even more time changing the settings to make sure they look right. This results of this tutorial don't look like anything more then changing the color of the object, but wait until we add light. Before you draw the teapot add these four settings.


  • Ambient: the color of the object in ambient light.
    • Think of ambient light as the color of an object in a room during the day. There is not light directly shinning on it, but you can still se it.
    • gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, [ r, g, b], 0);
  • Diffuse: the color of the object in diffuse light.
    • Think of diffuse light the color of the object next to a lamp. It is directly lit from a source.
    • gl.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, [ r, g, b],0);
  • Specular: the color of the object's specular highlights.
    • Specular highlights are what we see as glares on cars when we dirve.
    • gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, [ r, g, b],0);
  • Shininess: the size and intensity of the specualr highlights.
    • gl.glMaterialf(GL.GL_FRONT, GL.GL_SHININESS, float between 0 and 128);