PDA

View Full Version : Texture bending



stenio
11-04-2011, 04:26 AM
Hello,

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?

Thanks,
Stenio

ZbuffeR
11-04-2011, 05:27 AM
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.

aqnuep
11-04-2011, 06:52 AM
Or you can use both alpha test and blending in case using only alpha test results in jagged edges.

stenio
11-04-2011, 08:14 AM
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.

Thank you very much. It works perfectly.

Best regards,
Stenio