how to create directional light in jogl

I programmed java3d a lot, I’m new to jogl and opengl. I’m having a bit of trouble with lighting.

I want to create a directional light. that is, all surfaces having the same angle to the directional light are rendered in a color, that is same regardless of the surface’s orientation to the view. I thought this is diffuse color, but I can’t manage it.

Thanks in advance,
Ozgur

using glLight(…)

from the doc at http://www.opengl.org/sdk/docs/man/xhtml/glLight.xml
GL_POSITION

params contains four integer or floating-point values that specify the position of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating-point values are clamped.

The position is transformed by the modelview matrix when glLight is called (just as if it were a point), and it is stored in eye coordinates. If the w component of the position is 0, the light is treated as a directional source. Diffuse and specular lighting calculations take the light’s direction, but not its actual position, into account, and attenuation is disabled. Otherwise, diffuse and specular lighting calculations are based on the actual location of the light in eye coordinates, and attenuation is enabled. The initial position is (0, 0, 1, 0); thus, the initial light source is directional, parallel to, and in the direction of the - z axis.

thanks, however I still have the problem: depending on the eye position surface is lighter or darker, this is the effect I don’t understand.

I render object so:

    gl.glPushMatrix();

    gl.glTranslatef(sc.x, sc.y, sc.z);
    gl.glRotatef(sc.yaw, 0, 0, 1);
    gl.glScalef(sc.dx, sc.dy, sc.dz);

    gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, ambiSC);
    gl.glCallList(box);

    gl.glPopMatrix();

box is a display list, with a unit box(I wonder if normals are transformed appropriately), and lights are:

gl.glEnable(GL.GL_NORMALIZE);

gl.glEnable(GL.GL_DEPTH_TEST);
gl.glDepthFunc(GL.GL_LEQUAL);

gl.glShadeModel(GL.GL_FLAT);

gl.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, FloatBuffer.wrap(new float[] {.6f, .6f, .6f, .6f}));

gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, FloatBuffer.wrap(new float[] { 1f, 1f, 1f, 0f}));  
gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, FloatBuffer.wrap(new float[] { 1f, 1f, 1f, 0f}));  

gl.glEnable(GL.GL_LIGHTING);
gl.glEnable(GL.GL_LIGHT1);

I set location of eye so:

Point3d center = mouseBehaviour.getCenter();
Point3d location = mouseBehaviour.getLocation();
Vector3d up = mouseBehaviour.calculateUpVector(location, center);

glu.gluLookAt(location.x, location.y, location.z, center.x, center.y, center.z, up.x, up.y, up.z);

ok, problem solved. i should have been repositioning light everyrtime eye position changes.