I've got colors in GL_UNSIGNED_BYTE r,g,b but I want to use the alpha channel to put a custom value that is going to be used inside the pixel shader to color the geometry differently. There are two possible values 0 and 127 now my problem is that when I do this in the vertex shader :
[vertex]
varying float factor;
factor = gl_Color.w
it seems that the factor is always 1.0 because if I do this:
[fragment]
varying float factor;
factor = factor;
gl_FragColor = vec4(factor, 0.0, 0.0, 1.0)
The output is always red why I would expect two different colors, one when the factor is zero and one when the factor is 127.
So if I assign two values 0 and 127 I should get in the vertex shader 0/0.5? is this correct?
[Edit] Ok I see now two different values but I don't know why I get them, there s any operation the GPU does in the gl_Colow.w component I am not aware of?
[Edit2] As Nicholas has pointed out I am using glColorPointer(4...);