wrong lighting with Vertex Arrays


I am now using vertex arrays for drawing terrain. The terrain is rendered with a LOD algorithm and uses GL_TRIANGLE_FAN. The triangles are drawn normally but the lighting is wrong. I noticed that the lighting is only below the terrain. So, when I move below the terrain, I see a correct lighting of the inverse terrain. The vertex calculation didn’t change from earlier implementations where I used glBegin/End and explicitely used Normal3fv. The vertex array is as big as the normals array. Each vertex has a normal. I also tried to change glFrontFace, but with no effect. So, has anyone a hint what I’ve done wrong?


I’m not exactly sure what ur saying and i’m not that great with lighting, but maybe you might have the light position on the wrong side of the terrain. That’s all I can think of. Like I said i’m not that great.

Is your winding clockwise or counterclockwise or are your normals pointing below the surface? The default winding is counterclockwise (right-hand rule). You can change the winding using glFrontFace( GL_CW ) to reverse this or you can change your algorithm to travel counterclockwise. ANd, also verify your light position as the previous poster suggested.