Advertisement

Specular lighting not working correctly

Started by January 23, 2005 07:38 AM
2 comments, last by theZapper 19 years, 10 months ago
I have lighting working and am getting correct shading of triangles, but for some reason when I use specular lighting the highlight doesn't react correctly. If the view is looking directly at the light I get the specular highlight on the surface in front of me, where it should be, but if I turn the camera to the right, the highlight moves to the left, and vice-versa for right, and it shouldn't even move at all. Also, again looking directly at the light, if I then strafe the camera to the left or right, the highlight SHOULD move then, but doesn't. This is really confusing me as the rest of the lighting calculations are working perfectly well. Any help is appreciated. Thanks.
---When I'm in command, every mission's a suicide mission!
i had the same problem at one time. every frame you need to restate the light's position ie glLightfv(GL_LIGHT, GL_POSITION, lightPosition);

try that and see how it works
Advertisement
I'm already doing that, and it doesn't seem to matter where I put that code. I find it very strange that the rest of the lighting works fine, but specular does not.
---When I'm in command, every mission's a suicide mission!
It's ok i've fixed it now, (In case anyone's interested) just needed the line glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
---When I'm in command, every mission's a suicide mission!

This topic is closed to new replies.

Advertisement