You should not use blend, you should use alpha test.
Code:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.01);
For shaders... I am beginner myself, but look at my FFP emulation for my GUI:
(please note that I calculate matrix by hand for GLES compatibility where glRotate() and the like do not exist: these are deprecated)
Code:
#version 120
uniform mat4 u_matrix;
attribute vec3 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;
varying vec4 v_color;
void main()
{
gl_Position = u_matrix * vec4(a_position[0], a_position[1], a_position[2], 1.0);
v_texCoord = a_texCoord;
v_color = a_color;
}
Code:
#version 120
uniform sampler2D u_texture;
varying vec2 v_texCoord;
varying vec4 v_color;
void main()
{
vec4 mytexel = texture2D( u_texture, v_texCoord);
if (mytexel[3] < 0.05) {
discard;
} else {
gl_FragColor = v_color * mytexel;
}
}
Bookmarks