The following is the OpenGL ES 2.0 simple GLSL Fragment Shader, I use to place textures on polygons, to render 2D sprites.
varying mediump vec2 TextureCoordOut;
uniform sampler2D Sampler;
void main()
{
gl_FragColor = texture2D(Sampler, TextureCoordOut);
//gl_FragColor = vec4(texture2D(Sampler, TextureCoordOut).xyz, TextureCoordOut.w * 0.5);
}
The fragment shader places voxels with alpha information taken from the source 2D texutre(.png image). Apart from alpha information, I need to control overall polygon/sprite transparency to achieve Fade In/Fade Out effects.
Could you show me, please, how to modify the above shader to control the overall transparency, besides the alpha information?
Note: The commented out line is used for my attempts to achieve the transparency. I wish to combine both the alpha information with the overall polygon/sprite transparency.
Thanks.