Lighting in OpenGL

Started by
3 comments, last by Bouga 19 years, 3 months ago
A simple question. It seems that there always is a default point light source which is located in the eye, we assume it is light nr 0. The problem is that if we write "glDisable(GL_LIGHT0)", or any other light source for that matter, it's still there! We cannot turn off light sources that way, only by disabling lighting completely with "glDisable(GL_LIGHTING)". Anyone who recognizes the problem?
Advertisement
Well, I think I can say with much certainty that there isnt a light thats allways located at the eye position & cant be turned off :) What makes you think so? Show the code you used & what you got as a result. Maybe you're talking about the ambient light or something?
"A screen buffer is worth a thousand char's" - me
Hehe, well, about the light source that's located at the camera position, that's definitely true, but that thing about not being able to turn off the light sources, that was just because we were doing it inside of a "glBegin()...glEnd()" :-) Not so strange after all.

I don't exactly in what cases the light source defaulting in the eye position occurs, but it does sometimes, and one of those times is when you have not specified any lightsources, but turned on lighting. Then the default light source is a point light source being placed in the eyeposition.

Thanks anyway!
According to the Red Book, the default light position is (0, 0, 1, 0). In other words, a directional light that points along the negative z-axis.
GMMidge, Yes, thats the default position, but it doesnt mean that "there is a light at the eye position" :) there is a light, which you can place anywhere, but if you dont specify the position it will be at the eye position. EDIT: or as Kalidor corrected - a directional light pointing along the negative z axis ;)
"A screen buffer is worth a thousand char's" - me

This topic is closed to new replies.

Advertisement