PDA

View Full Version : static lighting



infinitecmdz
03-07-2004, 10:11 AM
hello everyone,

i'm a newbie in opengl and i've been working on it for sometime. I had a sort of wierd experience during lighting. you see i have a model at the origin and i have given two lights at opposite side of the object. now when i rotate the object by glRotatef(), i see that the lighting appears to be static.In other words, the lights seem to be attached to the model. instead shouldn't the light affect differently at different places of the object when i rotate the object. right now its like as though i am rotating the object together with the lights.

I hope you guys understand what i mean. i want the object to rotate independant of the lighting.

To be more precise, its like as if the texure were all precalculated with lighting and then applies to the 3d object. i want the object to be lit independant of the lights.

thanx for your time

chowe6685
03-07-2004, 10:20 AM
set you light position after transforming the modelview matrix

chowe6685
03-07-2004, 10:24 AM
better idea, make sure you are using the modelview matrix not the projection matrix

infinitecmdz
03-08-2004, 10:04 PM
hi, thanx a lot. it worked fine.