Annoying light problem

Started by
1 comment, last by Qwanda 22 years ago
Hi! I have a (for me)major problem with using lighting in OpelGL. When I define the position of LIGHT0 like this... float lightPos[] = {20.0f, 0.0f, -30.0f}; glLightfv(GL_LIGHT0, GL_POSITION, lightPos); ... BEFORE I''m rotating and translating my scene, I get a lightsource that is fixed relative to the viewport. As I understand it, that is what is supposed to happen. But if I do the same thing AFTER I have rotated antranslated my scene I get the exact same result. I expect to get a lightsource thet is fixed relative to my scene. What am I missing here? Why is it still relative to the viewport? And maybe I should add that I am not pushing and popping the modelview-stack, so the modelview-matrix have the scene transformation. I hope I made my problem clear, and I really need all the help I can get... Thanks in advance / Qwanda.
Advertisement
have u checked the faq www.opengl.org lighting section

http://uk.geocities.com/sloppyturds/gotterdammerung.html
if your problem is you can''t get the light staying still here:
after you''ve translated & rotated your scene repeat glLightfv(GL_LIGHT0, GL_POSITION, lightPos);

...you see, light coordinates ade just like any vertex''s...they need to be rebuilt every frame to be fixed to scene



follow the yellow brick road
follow the yellow brick road

This topic is closed to new replies.

Advertisement