# Lighting

I got a problem with lighting - i wanna move the light around the z axis. I got the translation and in the VC++ Debugger everything looks ok - then i update the position by calling glLight* and nothing happens the light anyway comes from the original direction and location.

i got the light at X: 450, Y 750 and z -750 and the rotation is okay, but no result is seen.
do i have to disable lighting to move it ? or is it the 0.0f in the last param ??

i enclose my draw function part…

// rotate the light along the z axis

GLfloat lightx = -450.0f;
GLfloat lighty = -750.0f;
GLfloat lightz = 750.0f;

LightPosition[0] = (lightxcos(clockPII))-(lightysin(clockPII));
LightPosition[1] = (lightxsin(clockPII))+(lightycos(clockPII));
LightPosition[2] = lightz;
LightPosition[3] = 0.0f;
glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);

thanks for help.

When you use 0 for the w component of a light’s position, that makes the light a non-positional light. The “position” then just describes the direction the light comes from a point light source that is infinitely far away. However given the numbers you’ve used, I’m surprised you don’t see any changes at all. Then again, the changes seen would depend upon the geometry being lit, and the properties of the light. For example, perhaps your ambient term is swamping the diffuse term. Also check your clock and PII values to see that they are correct. Also ensure that you have GL_LIGHT1 enabled in addition to GL_LIGHTING.

The rotated x, y values are correct - i just update the position
clock got a float and i add every frame 1.0f to it
and PII ist defines to be 3.141592 / 180.0f

i change my lightsource to a positional one moment - and it did not made anything different…

GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse[]= { 0.9f, 0.9f, 0.9f, 1.0f };

is something wrong with this.

my geometry got verctor normals…

Try also set the light direction.
Or try divide lightx,lighty and lighty
by 100.

[This message has been edited by FoxDie (edited 07-28-2001).]

My normals was the problem - they where not correctly imported… good to learn from misstakes

thanky you!