I'm pretty new to OpenGL and even newer to WebGL. I'm trying to draw a textured quad with an alpha channel. However I just can't get the blending right.
This is the result I'm looking for
And this is what the WebGL result looks like
As you can see there is kind of a white outline on the dice edges, where in the original image, there is not.
This is how I do my blending in WebGL
gl.clearColor(0.5, 0.5, 0.5, 1);
gl.disable(gl.DEPTH_TEST);
gl.enable(gl.BLEND);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
Here is my fragment shader:
precision mediump float;
varying vec2 vUV;
uniform sampler2D texture;
void main(void) {
vec4 frag = texture2D(texture, vUV);
gl_FragColor = frag;
}
Any idea why this is happening? I'm not creating mipmaps, BTW.
See Question&Answers more detail:os