PDA

View Full Version : Problems with GL_LIGHTING



05-15-2002, 11:12 PM
WhenI enable the lighting, my object doesn t have any more colors. The problem lasts when I light the scene with white color (1,1,1) so it s not a problem of the lighting color.
Could anyone please help me?

AndersO
05-16-2002, 12:05 AM
Your object is in grayscale?

Did you define materials for your objects triangles too?..

Azdo
05-16-2002, 01:24 AM
Originally posted by aaarg:
WhenI enable the lighting, my object doesn t have any more colors.

When you enable lighting, the color information is "thrown away". The only color data that OpenGL uses then is the material properties (ambient, diffuse, specular colors). To get a correct shading, also don't forget to specify vertex's normals.



[This message has been edited by Azdo (edited 05-16-2002).]

nexusone
05-16-2002, 04:03 AM
When you use lighting, the color is treated diffrently, maped like a material. You need to enable color under lighting, add this to your code before drawing anything: glEnable(GL_COLOR_MATERIAL);



Originally posted by aaarg:
WhenI enable the lighting, my object doesn t have any more colors. The problem lasts when I light the scene with white color (1,1,1) so it s not a problem of the lighting color.
Could anyone please help me?