More sun light

Like Javac I too am have some lighting problems on my planet. I’ve created a segment of a sphere using triangle strips with heights applied to vertices. For the time being I have set all the normals to be opposite and parallel to gravity, ie. pointing away from the centre of the sphere. I have set:
and then defined the colour of each vertex according to it’s height.

For lighting I have set:
GLfloat ambientLight[] = { 0.f, 0.f, 0.f, 1.f };
GLfloat diffuseLight[] = { 1.f, 1.f, 1.f, 1.f };
glLightfv( GL_LIGHT0, GL_AMBIENT, ambientLight );
glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuseLight );
// position sun at local noon northern summer
GLfloat sun_x, sun_y, sun_z;
theEarth.LLA2ECR( sun_x, sun_y, sun_z, 23.*DR, (west+east)/2., 0. );
GLfloat lightPosition[] = {sun_x, sun_y, sun_z, 0.f};
glLightfv( GL_LIGHT0, GL_POSITION, lightPosition );

All is fine when looking at the horizon, but looking straight down at the planet everything goes very dark. What am I missing?



I have now set the normals to be the average of the normals to the four faces meeting at a vertex. But still, when I point the camera in the same direction as the light source, the image becomes very dim.

Any thoughts?

Are you calling the glLightfv calls just once, or per frame? Your problem appears to be because you aren’t positioning the light at each frame (which I believe needs to be done).

macfiend sounds right. Remember that lights get transformed by the modelview matrix as well. So if you set your light only once you should change this and set it every frame after your camera transformation.