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:
glEnable( GL_COLOR_MATERIAL );
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
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?
Cheers,
Mark