LIGHT position.

I’ve got one light source in my scene. And i would like to move it to the new position. My code is following:

OnCreate

GLEnable(GL_LiGhtinG);
GLEnable(Gl_LiGht0);

OnButtonClick

GLPushMatrix;
GlTranslatef (-1.0,1.0,0.0);
E[0]:= Ex/(Nx - 1 );
E[1]:= -Ey/(Ny - 1 );
E[2]:= Ez/ maximum;
GLLiGhtfv(GL_LiGht0, GL_Position, @E);
GlPopMatrix;

But the light source is don’t move. Errors?
Ye, E : array [0…2] of GLFloat; :wink:

You still did not fix your G key ? it is always capslocked ?

read the docs :
“GL_POSITION :
params contains four integer or floating-point values that specify the position of the light in homogeneous object coordinates.”

You can basically think of the fourth parameter as a sort of switch : put 1.0 for a positional light source (what you need), and put 0.0 for a directional light (infinite light with parallel rays, like the sun seen from earth, etc).

My “G” key becomes popular here. :slight_smile: I hope it don’t enrage somebody.
Thanks for your answer, ZbuffeR.