Reputation: 1083
this is my fragment shader
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
varying LOWP vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main()
{
vec4 final_color = v_color * texture2D(u_texture, v_texCoords);
if (final_color.w != 0.0){
final_color = v_color;
}
gl_FragColor = final_color;
}
Upvotes: 1
Views: 300
Reputation: 2917
It looks like your original image is anti-aliased. Try just using the color of v_color
with the alpha from the texture:
gl_FragColor.xyz = v_color.xyz;
gl_FragColor.w = texture2D(u_texture, v_texCoords).w;
Upvotes: 2
Reputation: 1083
if (final_color.w >= 0.0){
final_color.w = clamp(final_color.w, 0.0,1.0);
final_color.xyz = v_color.xyz;
}
gl_FragColor = final_color;
I figured out I can also use this but @GuyRT's way is more efficient
Upvotes: 0