Texture bending


I’m trying to simulate some spheres connected by lines with a mipmapped texture. The images are fully opaque on all points inside the circle and fully transparent on the other points. The problem depends on the order by which the textures are drawn.
In the first image attached you can see what I’m trying to avoid: the bigger “sphere” is drawn before the smaller one (depth test seems to work: the spheres have the same size). I tried to disable the depth mask with glDepthMask(GL_FALSE)
but than depth testing doesn’t work: the far sphere is drawn over the bigger one, as you can see in the second image.

Sorting the spheres seems impractical.

Do you have any suggestions?


Use alpha test instead of blending, that way you the depth test will work properly and you will not have to sort the quads yourself.

Or you can use both alpha test and blending in case using only alpha test results in jagged edges.

Thank you very much. It works perfectly.

Best regards,