GL_COLOR_ARRAY and glColor

Started by renanse, September 13, 2007, 22:16:28

Previous topic - Next topic

renanse

I've got this puzzling issue regarding glColor.  I am optimizing JNI calls, and when I tried doing this with glColor, I sometimes run into cases where if I don't expressly call glColor, I get a dimmer color to my textures.  (for example I can mouse over a button and the color change on that button bleeds into the rest of the scene.)  I've checked the GL_CURRENT_COLOR and it is indeed what I expect.  It seems to be related to GL_COLOR_ARRAY, because if I get rid of that part of the code, things are only colored by the glColor call.

Does glColor override the current setting for color arrays or visa versa or something like that?  Anyone know what is going on there?

elias

According to the man page for glDrawArrays:

Quote

            Vertex attributes that are modified by glDrawArrays have an
            unspecified value after glDrawArrays returns. For example, if
            GL_COLOR_ARRAY is enabled, the value of the current color is
            undefined after glDrawArrays executes. Attributes that aren't
            modified remain well defined.
       

which means that if you disable a color array, you need an explicit glColor call to get a known color value.

- elias

renanse

Thanks for clearing that up, Elias.   :)