Hi, I’m actually doing a 2D HUD system but there is a problem when I try to draw a square made of 2 alpha-faded triangles: The common border of triangles are overlapping and, because of blending, there is a line more visible it should be. Screenshot Here (it’s a bit hard to see).
No, they are not. The effect you’re getting is due to interpolation, not blending. If you turn blending off, you’ll get the same effect.
It’s a standard problem of interpolating colors across a “rectangle” that’s actually 2 triangles. The edge between them interpolates only by the colors at the two vertices that make up that edge, not the two other vertices of the rectangle.
The only way to fix this is to effectively do interpolation manually. Instead of interpolating a color, interpolate a 2D vector that represents where you are in the rectangle (with (0, 0) being the top-left corner for example, and (1, 1) being the bottom right). Then you use this factor to do manual bilinear interpolation between the four colors in your fragment shader.