title: OpenGL GLSL texture transparency
body: <p>I want to make transparency on my 32bit bitmap texture using GLSL.
  My fragment shader looks like this:</p>
  <pre><code>#version 120
  uniform sampler2D myTexture;
  varying vec2 TexCoord;
  
  void main(void)
  {
      if(texture2D(myTexture, TexCoord).a != 1.0f)
      {
          discard;
      }
      gl_FragColor = texture2D(myTexture, TexCoord);
  }
  </code></pre>
  <p>But that makes transparent only the pixels where alpha is equal 0 and <strong>I want to maintain the fade</strong> from the texture. For example in this picture the first image is the texture, the second is the texture mask and the third is the desired result:</p>
  <p><img src="https://i.stack.imgur.com/JLgux.png" alt="Example" /></p>
  <p>The texture and the texture mask are in one 32bit bitmap.</p>
  <p>Does anyone know, how to achieve this using GLSL?</p>