Shininess (or not...)

Any suggestions as to why the following code does not give me any shininess?

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat white_light = { 1, 1, 1, 1.0 };
GLfloat no_light = { .1, .1, .1, 1.0 };
glLightfv(GL_LIGHT0, GL_DIFFUSE, no_light);
glLightfv(GL_LIGHT0, GL_SPECULAR, white_light);
glLightfv(GL_LIGHT0, GL_AMBIENT, no_light);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, no_light);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, no_light);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white_light);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 64);

glBegin(GL_TRIANGLES);
//yada, yada, yada

Chris

Well, I can think of two possibilities. I notice in the code posted, that you haven’t set the position of the light. So maybe the light is not where you expect it to be, or maybe you just left that out of the post.
The other possibility is that your geometry lacks sufficient detail to be lit accurately.

set your shininess value lower. The problem here is that when the shininess param is really high, the are very small margins for the specular highlight to appear. The light would have to be exactly positioned at the camera(more or less) for the highlight to appear.

The other issue is if texturing is enabled also, the highlight will be modulated with the texture colour unless you have seperate specular enabled (geforce & openGL1.2 thing).

You must be aware when using specular highlights that the highlight is dependant on the shininess param, the colour of the highlight, the position of the light & the position of the camera.

Sorry - I left out a line… the light is at the camera. And the surface is defined quite well (around 20,000 tris). The position of the light is fine, in that everything appears correctly lit from a diffuse source. But no matter what changes I make to the shininess parameters, I get no change in appearance.

Chris

That’s quite odd, I tested those settings you posted above on a sphere, and it was shiny.

… that’s because I’m stupid.

My normals were getting messed up soemwhere along the line… I fixed that, and voila! shininess. Thanks for your help…

Chris