Advertisement

Trouble with lights

Started by December 04, 2000 02:42 PM
2 comments, last by Jesse Chounard 23 years, 11 months ago
I looked at some previous threads in the forum, and it seems I''m not the only one who has had this problem, but the solutions presented in those threads don''t seem to help me any. Here''s my problem. When I enable a light, my scene (a textured box floating in space) looks great. The polygons are lit exactly as I would expect. But when I move my "camera", the light follows me. When I spin around to what should be the dark side of the box, it''s fully lit! In a couple of other threads, I learned that the lights use the same transforms as the models, so I tried this: setup my camera with gluLookAt glPushMatrix() glLoadIdentity() set light position with glLightfv glPopMatrix() draw my box And it still isn''t working properly. Anybody have any ideas? Also, this might be a decent idea for a short tutorial (moving the camera with gluLookAt while the lights remain stationary, I mean), as a quick look through the forum shows that I''m not the only one having this problem. Thanks, Jesse Chounard
If you want your light source to remain static, you only need to position it once. So call glLightfv and set the position in your Init code.
Advertisement
both the above wont work

try

glLoadIdentity()
setup my camera with gluLookAt
set light position with glLightfv
draw my box



http://members.xoom.com/myBollux
zedzeek: You are my freaking hero! Tell me what you want for Christmas, and I''ll make sure the Jolly Fat Man makes a stop at your place.

Thanks a bunch! It works like a charm.

Jesse Chounard

This topic is closed to new replies.

Advertisement