PDA

View Full Version : Lighting with OpenGL



jenny_wui
03-15-2013, 11: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.

V-man
03-15-2013, 11: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.

jenny_wui
03-15-2013, 09: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?