Question regarding GLSL discard instruction

This topic contains 2 replies, has 3 voices, and was last updated by  Gordon 7 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #29972

    Hi list!

    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 ?




    discard is the OpenGL ES 2.0 equivalent of alpha test. You cannot achieve the same result without discard.



    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.

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.