One flat polygon coloured dark blue - glColor3f(0.2f,0.2f,0.5f);
One point light in front of the polygon (but not very close)
Both material and light have a diffuse component of (0.1f, 0.1f, 0.1f) - everything else is set to 0.0.
GL_LIGHTING and GL_COLOR_MATERIAL are enabled, shade model is set to GL_SMOOTH.
So why oh why oh why is my polygon WHITE???
btw if I move the light so it is to the left (or right, etc) of the polygon the polygon will then shade the right blue. (Not that I expected that either, I would have expected it to be a much darker blue too).
ok, and if you say “GL_COLOR_MATERIAL is enabled”, do you mean you have only glEnable(GL_COLOR_MATERIAL) or do you have also glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE) f.e. ? (Even though this should be the default values)
Originally I only had glEnable(GL_COLOR_MATERIAL) but adding glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE) made no difference to the scene.
By the way, if you enable color material with ambient and diffuse, the values you set with glMaterial have no effect.
The color you set before drawing the polygon is then your ambient and diffuse color.
Pitfall #14 has been avoided, I am using AMBIENT_AND_DIFFUSE material, I have ensured the light ambient is off. My colour is glColor3f(0.2f,0.2f,0.5f); therefore (if I read the instructions correctly) the materials ambeint and diffuse properties should be the same. With the lights diffuse at (0.1, 0.1, 0.1) the resulting colour should be (roughly) (0.02, 0.02, 0.05) for the final diffuse property. (with everything else “off” in one way or another I would expect the vetex colour to be (0.02, 0.02, 0.05) - am I being stupid?)
hmmm…perhaps it would be useful if you could post more code, f.e. how your polygon looks like (vertices and normals) and where your light is exactly placed.
There’s a glScale hiding in my code which I had forgotten I’d put in there and only just noticed, so of course it was messing up my normals. Just enabled GL_NORMALIZE and I am getting results more along the lines I expected.