I have just spent my first half hour playing with the shader language.
I have modified the basic program I have which renders the texture, to allow me to colour the texture.
varying vec2 texCoord;
uniform sampler2D texSampler;
/* Given the texture coordinates, our pixel shader grabs the corresponding
* color from the texture.
*/
void main() {
//gl_FragColor = texture2D(texSampler, texCoord);
gl_FragColor = vec4(0,1,0,1)*vec4(texture2D(texSampler,texCoord).xyz,1);
}
I have noticed how this affects my transparent textures, and I believe I am loosing the alpha channel which would explain why previously transparent area's appear totally black.
If I use the following line instead, I am shown the transparent area's
gl_FragColor = vec4(0,1,0,1)*vec4(texture2D(texSampler,texCoord).aaa,1);
How can I retain the transparency after this modification to the colour?
I have seen various things about a .w property, and also luminous, but my tweaks with those and the .aaa property are not working XD