View Full Version : How does lighting work?

03-10-2010, 12:54 PM
I am having a little bit of trouble with adding light to my OpenGL scene. Everything else works great, I just get some strange results when I add lights. For example, after I add a light to the scene and rotate the camera, the light on some of the faces flash on and off. This is not the intended result. I want the shaded faces to stay shaded no-matter where the camera is and what it's rotation is. This is very annoying when rotating the camera. I am using gluLookAt to rotate the camera and an unchanged location for the light. The normals for the faces are all per-calculated.
Are there any simple tutorials for adding light to a scene? Preferably without glut involved.

Ehsan Kamrani
03-10-2010, 01:49 PM
You haven't attached your code.
For example glScale() may cause some lighting problems, so you need to normalize the normal vectors of your object if you scale it.
But we don't know what's happening in your code.