I made a simple lighting example consisting of some random geometric shapes and a light (all in black and white). But when I run it the shapes aren’t always shaded properly. Sometimes they have white stripes in an area turned away from the light, sometimes they only have a couple of triangles shaded in, and sometimes they aren’t shaded in at all. Please help.
Do you have the depth buffer and depth testing enabled?
It would be interesting to see your code, but I think maybe you are setting your projection in the modelview matrix. That will cause considerable lighting problems. Also, make sure you are sending normals in with the polygons, or automatically generate normals (which I forget how to do at the moment, and don’t have my Red/Blue books with me).
Thanks to the both of you. In the end it turned out to be the depth test, I had already tried enabling it but then the shapes wouldn’t shade at all or only partially (which I found really wierd). But my computer has been giving me problems for quite a while now and I guess I should reformat and soon.
If they still aren’t rendering right (or it’s wrong in a new way) could you post a screenshot? Be sure you are clearing the depth buffer.