OpenGL Lighting

Hi OpenGL community,

I made a simple white cube with a blue light but something strange happens because
depending on the intensity of the light the cube appears to be white.
As far as I understand about light behavior I think it is supposed to the cube to be blue and I don’t know why its turning into white.
To analyse how light behaves in OpenGL I decided to made a program where I could control the 3 components of light: environment, specular and diffuse.
When I decrease the specular component the cube starts to get blue and when I increase the same component it turns into white .

Does anybody know can explain that to me ?


hello! did you calculate normals for every primitive?

I don’t think the problem are the normals of the cube because I made a test with glutSolidSphere and the same problem happens.
Is there something wrong with the composition of the light ?
Where can I find detailed information about this part ?

OpenGL calculates the intensities of ambient, diffuse, specular, and emissive material relative to the light’s “material” and direction, position, attenuation, and spotlight falloff (with respect to the light type: directional, point, spot)

The end result of this can be some float value representing the intensity of that attribute. This value can be almost anything, even negative lights are possible.

The final step in the lighting calculation is scaling of the material colors by this value and clamping to the range of 0.0 to 1.0, because the is no darker than black or brighter than white color on the screen.

Means: In your lighting conditions some values have added to something brighter than the representable color and that is clamped to the maximum, which is white.

Have a look in the RedBook:…/7109;cd=7;td=6

[This message has been edited by Relic (edited 02-04-2001).]

I don’t think the problem are the normals of the cube because I made another program but now using glutSolidSphere and the same problem happens.
I think there is something about the properties in the lights and materials that I didnt understand very well.
Does anybody know where can I find detailed info about this ?