PDA

View Full Version : light vector transformation



hoshi55
03-25-2002, 05:43 AM
is a directional light vector actually affected by modelview transformations? i've coded a simple demo with just one quad lying in the xz plane and light coming perpendicular from above. i can rotate my view as i want, but when i view perpendicularly from above onto the plane (i.e. in the same direction as the light rays), the lighting seems to have no effect on the quad (yes, the normal vector IS set correctly)

is this beacuse the light vector is transformed along with all geometry or do i have to transform the light vector myself if i change my viewpoint?

eik

hoshi55
03-25-2002, 05:48 AM
ok i just found out myself http://www.opengl.org/discussion_boards/ubb/smile.gif

you need to call glLightfv(GL_POSITION, vec) every time after the camera transformations without altering 'vec' at all, then everything works smooth http://www.opengl.org/discussion_boards/ubb/smile.gif

eik