GLfloat Direction[3]={0,0,0}; // Light Direction
/*
Note : the direction is used only when you specify a value which
is not 180 for GL_SPOT_CUTOFF. If you do that, you do not have uniform
lighting anymore. But here, we want an omni light so the direction
is not important...
*/

GLfloat SpotExponent=0;
/*
Note : this specifies how focused is your light beam. But for an
omni light, there is no beam !
*/

GLfloat SpotCutOff=180; // See above //
GLfloat m_ConstantAttenuation=1;
GLfloat m_LinearAttenuation=0;
GLfloat m_QuadraticAttenuation=0;
/*
Note : this means we do not attenuate the light according to
its distance from the light source */

/*Now, if you do not want to assign material to your objects but
want the objects to use what you specify with glColor, you have
to use the following :*/

glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_D IFFUSE);

/* This means that the Ambient and Diffuse material will use the
values specified by glColor. Otherwise, you have to use glMaterial.
Note that there are plenty of different parameters so you should
have a look at glColorMaterial function in your docs. */

glEnable(GL_COLOR_MATERIAL);

/* This enable the Color Material mode we specified above */

------------------------------------------

I hope I did not forget anything.

It was a real pain for me to understand OpenGL lights when I started so I really know what you are feeling.

Nevertheless, after some practice on simple things, you should be able to do whatever you want with the lights.

Have fun and do not hesitate to contact me if this code does not work.

Best regards.

Eric

Kaeto

05-24-2000, 12:40 PM

From what I get from your post, CyBBe, you're looking for a directional light... That will light up the whole scence, kinda like (as Eric said) sunlight. A positional light is like a lightbulb. The farther an object is from it, the dimmer it is. A directional light should be quite a bit faster than a positional one... Hopefully this is understandable... http://www.opengl.org/discussion_boards/ubb/smile.gif