I have a hexagonal map and try to build a fog of war over it. What I'm doing is building a VBO with vertices being center of hexes. I then assign alpha value to each tile center according to its visibility (0.0f, 0.5f, 1.0f). Here is vertex shader:
#ifdef GL_ES
precision highp float;
#endif
attribute vec4 a_position;
attribute float a_alpha;
uniform mat4 u_MVPMatrix;
varying float v_alpha;
void main()
{
gl_Position = u_MVPMatrix * a_position;
v_alpha = a_alpha;
}
and my fragment shader:
#ifdef GL_ES
precision highp float;
#endif
varying float v_alpha;
void main()
{
gl_FragColor = vec4(v_alpha, v_alpha, v_alpha, 1.0);
}
I tried to carve a hole from the fogmap to try it out and I'm getting this:
What's wrong with the interpolation? Why is there a triangle structure so visible?