Trouble with lights
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
Website - Third Party Ninjas | Twitter - twitter.com/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.
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
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
Thanks a bunch! It works like a charm.
Jesse Chounard
Website - Third Party Ninjas | Twitter - twitter.com/Chounard
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement