simple lighting of a shaded cube

I have a rotating cube, each vertice is a different color so the colors are smoothly shaded across each face. I am trying to add a simple light to the scene just to experiment with it. Every time I enable lighting, the cube turns into black and white. I obviously do not have the material values of the cube set correctly, or the light values set correctly or something. Can someone tell me what values to use for the material of the cube, or the properties of the ligh, so that it will retain its smoothly shaded surface when the light strikes it. Thanks in advance.

You need to set the material color of the faces, not the colors of the vertices.

Chris

You can also enable color tracking for your material using-

glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE)
and…
glEnable(GL_COLOR_MATERIAL)

As long as you define a material with ambient and diffuse properties, you can then go ahead and change it’s colors on the fly.

Then you can still have your vertex colors and if the Model Shading is set to Smooth, they will be blended.