Transparency Sorting changes
Your changes on the Transparency Sorting page were reverted. This was done for several reasons:
- Your change about alpha testing was incorrect. You changed the enable to enable depth testing, but didn't actually enable alpha testing. While depth testing during an alpha test render is common, enabling alpha testing is more important because, without that, you don't have alpha testing ;)
- You removed the deprecated tag on the alpha testing section. Alpha test was deprecated in OpenGL 3.0 and removed in OpenGL 3.1. That's desktop OpenGL, not OpenGL ES (where it wasn't even in ES 2.0). This Wiki, by default, describes only behavior that remains core in OpenGL. Therefore, any non-core text must clearly specify that it is describing non-core behavior. Like alpha testing.
- You removed the introductory text about how depth testing interacts with transparency. That text is important, as it helps users understand the complexities of handling transparency.
- Note: the following text is from Pagoru, which was posted on my talk page. I'm moving the text here, so that an actual conversation about the accuracy of this information can be had. If you wish to respond, please do so here, rather than us trying to talk back and forth across multiple pages. It's easier to understand who is talking about what this way. Alfonse (talk) 21:53, 24 June 2015 (EDT)
I'm using last version of OpenGL in lwjgl and I found the solution of buffer Z problem with transparency using GL_DEPTH_TEST
" glEnable(GL_DEPTH_BUFFER_BIT); glAlphaFunc(GL_GREATER, 0.1f); "
Works fine, and other webs confirm that. If you read in the wiki...
"The Z buffer doesn't work as you might hope for transparent polygons. The problem is that the Z buffer prevents OpenGL from drawing pixels that are behind things that have already been drawn. Generally, that's pretty convenient, but when the thing in front is translucent, you need to see the things that are behind it. "
...you feel fuc***... but it's not true.
I can prove, GL_DEPTH_BUFFER_BIT and GL_GREATER works fine with the last version.
The first time I searched I read this, and I want to kill someone, I had planned everything with z buffer in my project. But I searched in net a little more and I found the solution.
If you do not want to show people the solution, it's your problem, but it works and many people appreciate. This page about trasnparency, not clarify absolutely anything if you have problems with buffer Z.
- I just did a Google search for glEnable(GL_DEPTH_BUFFER_BIT};. Nothing came up, which did not surprise me. Because no OpenGL specification has ever claimed that calling glEnable with GL_DEPTH_BUFFER_BIT will do anything except fail with an OpenGL Error. You can glEnable(GL_DEPTH_TEST};, and you can glEnable(GL_ALPHA_TEST);. But not the depth buffer bit; the only thing that's used for is clearing the framebuffer with glClear.
- So at the very least, the code you posted was erroneous. Go ahead, remove the error-generating glEnable call; you'll find your code works just as well without it. It's nothing more than a magic feather for you.
- Second, the Transparency Sorting page never stated that you can't use depth testing alongside alpha testing. Indeed, it very clearly states, "You can still use depth buffering with this..." Granted, this could be made more clear by moving the alpha testing section above the section about Z-buffers. But the page's information is accurate, and it agrees with you (though not with your erroneous code).