PDA

View Full Version : glColor with glLight



laprej
03-04-2004, 09:54 PM
I'm a newbie so please forgive me if this sounds stupid. Anyway, I was playing with lighting today for my assignment and determined that just turning on a light changed everything to a more or less grayscale. My friend said that was because I did not set up any material properties. So I have two questions: a) are material properties required to see colored objects, and b) if the answer to part a is yes, then why bother specifying colors at all? i.e. why not just specify the reflective properties of the materials? Thanks in advance.

dorbie
03-04-2004, 11:32 PM
You must change the color of material properties to get colored objects with lighting.

Color calls let you change the color when there is no lighting, but they can also let you change the color of a specific material property more quickly than the heavyweight material property calls.

To apply the glcolor calls to a material property use the glColorMaterial call.

For example call:





glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);



[This message has been edited by dorbie (edited 03-05-2004).]