title: Overlaying a transparent color over a Texture with GLSL
body: <p>I have an image that I am loading using the Slick library, and the image renders fine without my shader active. When I use my shader to overlay a transparent color over the image the entire image is replaced by the transparent color.</p>
  
  <h1>without the shader</h1>
  
  <p><img src="https://i.imgur.com/GvkzOZv.png" alt=""></p>
  
  <h1>With the shader</h1>
  
  <p><img src="https://i.imgur.com/saJM4SG.png" alt=""></p>
  
  <h1>Vertex Shader</h1>
  
  <pre><code>varying vec4 vertColor;
  
  void main(){
      vec4 posMat = gl_Vertex;
      gl_Position = gl_ModelViewProjectionMatrix * posMat;
      vertColor = vec4(0.5, 1.0, 1.0, 0.2);
  }
  </code></pre>
  
  <h1>Fragment Shader</h1>
  
  <pre><code>varying vec4 vertColor;
  
  void main(){
      gl_FragColor = vertColor;
  }
  </code></pre>
  
  <h1>Sprite Rendering Code</h1>
  
  <pre><code>Color.white.bind();
  GL11.glBindTexture(GL11.GL_TEXTURE, image.getTextureID());
  GL11.glBegin(GL11.GL_QUADS);
  GL11.glTexCoord2f(0, 0);
  GL11.glVertex2f(this.x, this.y);
  GL11.glTexCoord2f(1, 0);
  GL11.glVertex2f(x + w, y);
  GL11.glTexCoord2f(1, 1);
  GL11.glVertex2f(x + w, y + h);
  GL11.glTexCoord2f(0, 1);
  GL11.glVertex2f(x, y + h);
  GL11.glEnd();
  GL11.glBindTexture(GL11.GL_TEXTURE, 0);
  </code></pre>
  
  <p>}</p>
  
  <h1>OpenGL Initialization</h1>
  
  <pre><code>GL11.glMatrixMode(GL11.GL_PROJECTION);
  GL11.glLoadIdentity();
  GL11.glOrtho(0, Screen.getW(), Screen.getH(), 0, -1, 1);
  GL11.glMatrixMode(GL11.GL_MODELVIEW);
  GL11.glEnable(GL11.GL_TEXTURE_2D);
  GL11.glEnable(GL11.GL_BLEND);
  GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  </code></pre>