PDA

View Full Version : lighting stuff



10-18-2000, 11:58 PM
Hi. I'm quite new to GL, and trying to add some lighting to my little 3d engine.
I'm a little confused by the positioning of a light... are the coordinates in local object space, so that I have to tranform the global coords to each objects space bvefore calling glLight(GL_POSITION,... ), or have I done something else wrong? (the lighting behaves rather strangely when I try to specify the position in global coordinates)
thanx,
/rikard

Bob
10-19-2000, 12:25 AM
If you want to place you light in world space coordinates, you need to set it AFTER the modelview matrix is set. The light position is transformed using the modelview matrix.

julien
10-20-2000, 06:17 AM
How did you setup the light position ? Because there are different kind of lioghts, there are positional and directional lights. It depends on the position value you give to opengl :

{x, y, z, 0.0} is a directional light
{x, y, z, 1.0} is a positional light

I hope that it will help you.