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.
http://i166.photobucket.com/albums/u111/dTr_321/lightingerror.png

Any ideas??

remdul

03-17-2007, 03:45 AM

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?

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

Sunray

03-22-2007, 01:13 AM

Is that per-vertex specular?

Jon723

03-22-2007, 12:29 PM

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.