I’ve been trying to move sourcelights around my 3d-world, but whatever i tried (for example editing the position-array and calling a glLightfv in my glScene func.), the lighting didn’t change at all. Maybe I misunderstand the position, what does it need 4 coordinates for, anyway?
>>what does it need 4 coordinates for, anyway
Fairly simple. It’s a homogenous coordinate (x, y, z, w). For directional lights you put w = 0.0 which doesn’t specify a point in space but only a direction vector (x, y, z).
For point and spot lights you normally set w = 1.0 to define a position (x/w, y/w, z/w)
The light position or direction is affected by the modelview matrix.
If you want to transform the light with your other geometry, put glLightfv(GL_LIGHTi, GL_POSITION, myPositionArray) after the modelview matrix has been set.
Thanks, I’ll try that. I think my main problem was understanding the w-coordinate.