In this application I have a large array of GLfloats that I need to use to color the vertices in a vertex array. The color data is provided in one of two formats, either interleaved RGB triplets, or single-component monochrome values.
Ideally what I want to do is:
glColorPointer(ismono ? 1 : 3, GL_FLOAT, 0, data);
And when the color has 1 component, it is used as the R, G, and B color component. I can’t do that because glColorPointer only accepts size of 3 or 4, not 1.
I want to avoid having to create a temporary buffer and duplicate each of the monochrome color channels 3 times; I’d really like to use the monochrome array directly.
Is there some way I can do this?