illumination

I’ve got some problems with setting the lights in my project (using Java opengl bindings).
I’m trying to set up lights to illuminate the whole scene. is there any way to set the intensity of a light (in the infinity)
I set up light0 but still the whole scene is pretty dark.
My code is the following:


float light_pos[] = {-5, -5, -5, 0};
float light_color_am[] = {1, 1, 1};
float light_color_diff[] = {1, 1, 1};
float light_color_spec[] = {1, 1, 1};

gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, light_pos,0);
gl.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, light_color_am,0);
gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, light_color_diff,0);
gl.glLightfv(GL.GL_LIGHT1, GL.GL_SPECULAR, light_color_spec,0);
gl.glLightf(GL.GL_LIGHT1, GL.GL_SHININESS, 150);
gl.glEnable(GL.GL_LIGHTING);
gl.glEnable(GL.GL_LIGHT0);gl.glEnable(GL.GL_LIGHT1);
gl.glEnable(GL.GL_LIGHT2);
gl.glEnable(GL.GL_LIGHT3);
gl.glEnable(GL.GL_DEPTH_TEST);

the result is the following:

the ground is supposed to be a checkerboard using materials black plastic and white plastic from the following source:
http://devernay.free.fr/cours/opengl/materials.html
but the fields are displayed really weird…

thank you for your help.

float light_pos[] = {-5, -5, -5, 0};
this is correct for infinite distant light, when the fourth coordinate is = 0, then the 3 first define a direction, not a position.

For the weird display, it looks like your normals are wrong.

normals on the ground should be just {0,1,0}… these are drawn. or am i wrong? I think on the car they’re fine…

You should double check your normals, even on the car the shading looks weird. You may try to draw them as lines and will see immediately if they are correct.