View Full Version : Lighting with OpenGL

03-15-2013, 10:09 AM
I am working with some lighting programming in OpenGL. I have a red sphere. Now when I make the diffuse light green, the sphere should look black, but I find the sphere looks still red. How can that be fixed? Please provide some suggestion.

03-15-2013, 10:19 AM
In old OpenGL, there is a setting called GL_LIGHT_MODEL_AMBIENT which is by default 0.2, 0.2, 0.2, 1.0.
You can set it to zero if you want with glLightModel.

03-15-2013, 08:28 PM
I have done it by setting the diffuse material component to green and diffuse color to red. The object looks black. Is it ok?