trouble getting the lighting and material set up right

I am having some trouble getting the lighting and material set up. Below I have setup lighting and material, however, when ever I turn on spectular reflection for material the sphere that I am rendering turns white with only a little of its colour in the corners. But if I don't turn it on I get approximately the right colour. I understand that specular reflection property of material is suppose to reflect light and make the object look shiny. But with a specular reflection value of {0.1,0.1,0.1,1} the difference seems to be really great. I don't think the picture below is what I want. Could anyone tell me what I am doing wrong here?

      glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat ambientLight[] = {1.0, 1.0, 1.0};
GLfloat diffuseLight[] =  {1.0, 1.0, 1.0};
GLfloat specularLight[] = {1.0, 1.0, 1.0};
GLfloat position[] = { 10.0f, 10.0f, 10.0f, 1.0f };

glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);
glLightfv(GL_LIGHT0, GL_POSITION, position);

GLfloat materialColor[] = {1, 0, 0, 1.0};
GLfloat materialSpecular[] = {0.1, 0.1, 0.1, 1.0};

//The color emitted by the material
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, materialColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, materialSpecular);
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 10);
// Perform OpenGL calls necessary to set up this material.

• The specular looks correct in the left sphere. Perhaps there is something wrong with the geometry of the other object, e.g. normals are incorrect. Check if there is any different when using glEnable(GL_NORMALIZE); – msell Apr 12 '15 at 17:13
• glEnable(GL_NORMALIZE); seems to work! – Mark Apr 12 '15 at 18:27
• @Mark It's fine to post answers to your own questions, by the way. – Anko Apr 15 '15 at 9:16

1 Answer

glEnable(GL_NORMALIZE); seems to work!