lighting problem in movement

hi,

for some reason, my lighting which will show below is moving when the world object is moving. for example, if i press the up arrow key to move up in my environemnt, the light moves also wrt to the object.

here is what i did in init()

// lighting resources
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_shininess[] = { 60.0 };
GLfloat light_position[] = { -10.0, 5.0, 1.0, 1.0 };
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);

glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT0, GL_POSITION, light_position); // this defines position
glEnable(GL_LIGHT0);
// Turn on a light with defaults set
glEnable(GL_LIGHTING);
// Turn on lighting
glEnable(GL_COLOR_MATERIAL);

and i never change it.

any help is appreciated

thank you

If you don’t want the light to move, then inside your Draw function or your main loop, call glLightfv(GL_LIGHT, GL_POSITION, ect…) again, this tells OpenGL to put the light exactly where you told it to. If you don’t call this each frame, then OpenGL keeps thinking that no matter where the camera is looking, keep putting the light relative to the camera as specified in the intialization. Hope this makes sense. Just keep calling glLightfv for the position each frame.