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:
varying lowp vec4 colorVarying;
varying mediump vec2 texcoordVarying;
uniform sampler2D texture;
void main(){
gl_FragColor = texture2D(texture, texcoordVarying) + colorVarying;
}
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 & color channel combined in the fixed function pipeline? My Replacement for glColor4f is:
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);
}
And I'm using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if this is somehow relevant...
For the color 1.0, 0.0, 1.0, 1.0 here is what I get now:
And I want to get:
Some ideas to accomplish this? Any help would be appreciated.