- November 6, 2009 at 11:56 am #29972
I am currently working on the development of an SGX OpenGLES 2.0 3D application.
The application was initially created using OpenGLES 1.1. At this time, we were using alpha ref and alpha textures, which worked just fine. The behaviour looks like discard is used in the fixed function pipeline (i.e. zBuffer not updated if alpha<alphaRef)
Now that we want to use OpenGLES 2.0 we would like to get the same results with shader programs. How can I achieve this without using the discard instruction ? (I tried setting the gl_FragColor.a = 0.0, but it requires triangles to be sorted, which can’t be achieved)
Does anyone have an idea ?
Florent.November 20, 2009 at 4:35 pm #33502
discard is the OpenGL ES 2.0 equivalent of alpha test. You cannot achieve the same result without discard.November 20, 2009 at 4:56 pm #33503
If you were working with a POWERVR under OpenGL ES 1.1 then using alpha test would still be less than ideal for performance already. As Xmas says, you can’t achieve the same effect without sorting transparent triangles, but you may find sorting these and using blending may help the performance of the graphics core on both implementations, but at the price of some CPU load. If you have (or want) any partially transparent polys that need blending and had to sort these anyway then it might be fairly easy to prototype this approach and see.
I suppose it comes down to whether the CPU or the GPU is limiting your application.