Hi,

I'm writing my own library/engine based on OpenGL. I've just started implementing lighting. When I created a sphere or plane (my own models), placed them in [0, 0, 0], set lighting mode to GL_FLAT I got this:

where I expected something like this (sample image from web):

The light parameters in plane scene are:
- position = [0, 5, 0, 1],
- ambient = [0, 0, 0, 1],
- diffuse = [1, 1, 1, 1],
- specular = [0, 0, 0, 1],
other are default.

The light position in sphere scene is [10, 0, 10 ,1], other parameters the same as before.

The plane is a square of size 20, it's composed of 20x20x2 triangles (2 triangles per small square). Normals of each vertex [0, 1, 0].

The sphere's radius is 2, it has 20 meridians and 18 latitude-lines (+ 2 poles), so 2x20 triangles at poles, and 20x17x2 triangles in the rest of it. Normals of each vertex are vectors, which would have connect this vertex with center of sphere, if they'd be longer.

Both models materials are:
- ambient = [0, 0, 0, 1],
- diffuse = [1, 1, 1, 1],
- specular = [0, 0, 0, 1],
- shininess = 0.

I'm rendering using GL_TRIANGLES. So I thought that changing this to GL_QUADS will help. It did, but two new issues appeared:
- i heard that GL_QUADS are depraciated,
- when I look at a broken quad (not planar) from very close distance, it's inner (broken) edge suddenly flips (so it's broken the other way).

I thought it's a problem with normals, but then I made this plane from first image (at the beginning it was only the sphere), with all normals = [0, 1, 0], and you see what I got.

So I have no idea what can cause this problem. Maybe you have?

I would show my code, but for now my library has about 40 classes. It's really hard to show key fragments. I would have to introduce you to entire logic and way of thinking in my library, and it would take too much time and too much writing.