Regarding opacity / transparency in OpenGL ES 2.0

Evening Guys/Girls

Got a problem on something I thought would be relatively simple to achieve, but turns out it’s not. :doh:

I am drawing a textured quad as a sprite and am simply trying to add ‘variable’ opacity. By this I mean I want to be able to change the opacity level at will between 0.0 (invisible) to 1.0 (completely visible, i.e. but without the alpha).

Now, I’ve had some partial success, this is my fragment shader as it currently is:

String strFShader =
            "precision mediump float;" +
            "varying vec2 v_texCoords;" +
            "uniform sampler2D u_baseMap;" +
            "void main()" +
            "{" +
            "gl_FragColor = texture2D(u_baseMap, v_texCoords);" +
            "gl_FragColor.a *= "+1.0f+";"+  //Where 1.0 is the blend value between 0.0 - 1.0 - so here it should draw the sprite 'complete & without alpha bits'.

And then in my rendering method I do the following:

	 GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

With the above code, my sprite is draw without the alpha bits as I would expect and fades correctly until it’s invisible at 0.0 but it’s much darker than it should be and also seems to have a ‘shadow’ around it (I’m not 100% Sure but it seems that anything that has been anti-aliased in whatever package was used to create the .png comes out really like a dark grey, could be wrong).

If I change the blend mode to:


Then with a value of 0.0 it draw pretty much perfectly but if I start fading it out only parts of it fade until I’m left with certain colours.

Anyone have any idea what I’m doing wrong here?

Thanks all! :tired: