In webgl I created a scene where I have 4 objects, and I added different textures on each of them. Each texture is passed on to the shader via uniform variables. I am trying to make half of one of my objects red. But every time I try to change half of one of the objects to red, i somehow get the half of every texture red. The following is what I have in my fragment shader at the moment.
varying vec2 vTextureCoord;
uniform sampler2D Texture2;
vec4 a = texture2D(Texture2, vTextureCoord);
if(a.t>0.5)
{
gl_FragColor = vec4(1.0,0.0,0.0,1.0)
}
else
{
gl_FragColor = vec4(t.x,0.0,0.0,1.0)
}
So to sum up my question, how can I get half of only one of my textures to red?
Thank you