Hi,
I have two textures :
texture1 : 8bit Luminance
texture2 : 16bit RGB5_A1
I want to merge these two textures based on RGB value of texture2. If texture2 is having RGB(0,0,0), i want to treat is as transparent, any other color value as opaque. I have written following shader prog for this :
void main (void)
{
vec4 texval1 = texture2D(myTexture1, vec2(gl_TexCoord[0]));
vec4 texval2 = texture2D(myTexture2, vec2(gl_TexCoord[1]));
if( (texval2.r != 0.0) || (texval2.g != 0.0) || (texval2.b != 0.0) )
{
gl_FragColor = texval2;
}
else
{
gl_FragColor = texval1;
}
}
Everything looks ok, but when I am writing RGB(1,1,1) on texture2, its also getting treated as transparent !!!
Any suggestions ?
Thanks in advance.