specular lighting looks wrong

I am just starting opengl and I have setup a basic pool table with a light hovering above it and the camera rotating around it. My problem is that the specular lighting of the table seems to highlight the wrong place. See the picture for a better idea of what I mean.

Any ideas??

I’ve had some similar results once with three invalid attenuation parameters (I think they where all zero) which gave me irregular noise over it from some angles. Comment out some parameter calls to use the default values.

Also, check on the specular calculation mode:

glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);

Could you post your code and the values that you pass to the light (position,attenuation,specular etc)? How are you setting up the perspective?

remdul is reffering to use:

    gl.glLightf(GL_LIGHT2, GL_CONSTANT_ATTENUATION, 1.0f);
    gl.glLightf(GL_LIGHT2, GL_LINEAR_ATTENUATION, 0.0f);
    gl.glLightf(GL_LIGHT2, GL_QUADRATIC_ATTENUATION, 0.0f);
}

1.0f, 0.0f, 0.0f as stated above are the default value from OpenGL 1.2 on I am quite sure.

Try setting that to see if it works.

Cheers!
Rod

Is that per-vertex specular?

From the looks of it, it seems that the highlight is being interpolated over a single quad with one normal (am i correct?). You might want to try breaking up the “table” into a grid like structure with multiple normals.