Color/Lighting confusion

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

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.

Thanks a lot dorbie :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.