Hi, I am programming OpenGL with Python.
Basically I have a spot light pointing at a wall. The direction of the spotlight, the direction of the camera, and the direction of the normal on the wall are collinear.
As I move the camera away from the wall, the light (originally in the middle of the wall), moves upward and to the right.
I attached 3 pictures of what my camera looks like at various distances from the wall, with the camera coordinates displayed.
Why doesn’t the light stay in the middle of the wall as I move away from it?
Here is my lighting function:
(I can show the rest of my code if needed)
def lighting():
glShadeModel(GL_SMOOTH)
glEnable(GL_LIGHTING)
glLightfv(GL_LIGHT1, GL_POSITION, [5.0,0.0,0.0,1.0])
glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION,[-1.0,0.0,0.0])
glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 60.0)
glLightf(GL_LIGHT1, GL_SPOT_EXPONENT, 128.0)
glLightfv(GL_LIGHT1,GL_SPECULAR,[0.0,0.0,1.0,1.0])
glEnable(GL_LIGHT1)
glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,[1.0,1.0,1.0,1.0])
glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,0.0)
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE)
glEnable(GL_COLOR_MATERIAL)