The GLa ES 2.0 Reference Card defines:
Variable
mediump vec4 gl_FragColor;
Description
fragment color
Units or coordinate system
RGBA color
The following is said:
Vector components
In addition to the syntax of the numeric subscript number of the array, the names of the vector components are denoted by a single letter. Components can be swizzled and replicated e.g.: pos.xx, pos.zy
{x, y, z, w} Use when accessing vectors that represent points or normals
{r, g, b, a} Use when accessing vectors that represent colors
{s, t, p, q} Use when accessing vectors representing texture coordinates
So, of course, using .a will be more idiomatic, but explicitly what you save in .w is the alpha output for gl_FragColor .
To answer the question that you asked as a heading, and not a question in the body, the value returned by texture2D will be correct for this texture. Either the actual stored value if the texture is GL_RGBA or GL_LUMINANCE_ALPHA , or 1.0.
So, you are outputting alpha correctly.
If your alpha version does not have the blending effect that you expect, then you should have glBlendFunc set to something unexpected, possibly involving GL_CONSTANT_COLOR .