PDA

View Full Version : Color/Lighting confusion



Neelima
06-14-2004, 02:58 AM
Hi,

I am a little confused about how glColor4f, glColorPointer & Lights make up the final color for a primitive.

As I understand:
1. If lighting is disabled
1.1 The vertex gets the current color (possibly set by glColor4f).
1.2 Each vertex gets the color given by glColorPointer, if given (Is this correct ??)

2. If lighting is enabled Vertex color is calculated using current lighting parameters.
2.1 This lighting parameters include material properties, which can be taken from the current color (glColor4f), if COLOR_MATERIAL is enabled.
2.2 If COLOR_MATERIAL is disabled, only the current lighting parameters are used. (glColor & glColorPointer dont make any difference)(Is this correct ??)
2.3 If COLOR_MATERIAL is enabled and we have data given by glColorPointer , for each vertex we take the material color from the glColorPointer information and compute the lighting. (Is this correct ??)

Do let me know if my understanding of OpenGL ES color and lighting is right.

Thanks & regards,
Neelima

dorbie
06-15-2004, 08:28 PM
Yes those things are correct.

The attribute token specified by the glColorMaterial call determines which material parameter is affected by the application of color attributes if and only if GL_COLOR_MATERIAL is enabled. If it is not enabled color attributes are ignored and the current glMaterial attributes are used for lighting calculations.

Neelima
06-15-2004, 08:32 PM
Thanks a lot dorbie :)