title: Texture and color together in GLSL?
body: <p>I cant figure out, how to get with OpenGL ES 2.0 similiar Results to OpenGL ES 1.1. I want to use actually a Sampler2D (to blend my texture with Alpha Channel to the Framebuffer) and also set an Color. The texture should be painted in the color - like in OpenGL ES 1.1
  My FragmentShader looks like this:</p>
  
  <pre><code>varying lowp vec4 colorVarying;
  varying mediump vec2 texcoordVarying;
  uniform sampler2D texture;
  
  void main(){
      gl_FragColor = texture2D(texture, texcoordVarying) + colorVarying;
  }
  </code></pre>
  
  <p>But the part "+ colorVarying" destroys my alphachannel with black (because I also add colorVarying, if the AlphaValue is 0) and makes an strange gradient effect... How is the texture &amp; color channel combined in the fixed function pipeline? My Replacement for glColor4f is:</p>
  
  <pre><code>void gl2Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a){
      const GLfloat pointer[] = {r, g, b, a};
      glVertexAttribPointer(ATTRIB_COLOR, 2, GL_FLOAT, 0, 0, pointer);
      glEnableVertexAttribArray(ATTRIB_COLOR);
  }
  </code></pre>
  
  <p>And I'm using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if this is somehow relevant...</p>
  
  <p>For the color 1.0, 0.0, 1.0, 1.0 here is what I get now:
  <img src="https://i.stack.imgur.com/p2o7V.png" alt="Now"></p>
  
  <p>And I want to get:</p>
  
  <p><img src="https://i.stack.imgur.com/27mID.png" alt="What I want to see"></p>
  
  <p>Some ideas to accomplish this?
  Any help would be appreciated.</p>