I'm trying to change an object's color by setting "obj.setAdditionalColor(255, 0, 0)" and then setting a shader like bellow:
VERTEX:
varying vec2 vTexCoord;
varying vec4 vCol;
void main(void){
vTexCoord = gl_MultiTexCoord0.xy;
vCol = gl_FrontMaterial.ambient;
gl_Position = ftransform();
}
FRAGMENT:
sampler2D myTexture;
varying vec2 vTexCoord;
varying vec4 vCol;
void main(){
vec4 color = texture2D(myTexture, vTexCoord);
gl_FragColor = color * vCol;
}
but no coloration change is happening, if I use a uniform, it will work, but I wanted to use the already existent color the object has.
can you give me a little help here?