Please have a look at this tutorial here:
https://code.tutsplus.com/tutorials/how ... -cms-23650
and the info here:
https://arm-software.github.io/opengl-e ... aders.html
I believe this is the missing link between having a widget / object in a gl surface and then rendering it using a dedicated GLSL
fragment shader.
In a GLSL fragment shader you can use additional textures to apply the transparency of a provided mask. You can also provide two masks there: one for clipping and another for alpha. It's all done in the same fragment shader and therefore also fully HW accelerated.
You could even allow some special effects using shaders like reducing saturation, tinting or increasing contrast using the very same fragment shader.
You would have variants of shaders to acomplish this. But since shaders are basically strings they could be combined using string operations on startup to generate the required shader programs. You could define multiple shaders for these scenarios:
(1) no clipping mask, no alpha mask, no effects (no additional textures required, very simple passthrough-shader)
(2) apply clipping mask, no alpha mask, no effects (one additonal texture sampler for binary opacity (0 OR 1 in the mask) which is multiplied with the already existing alpha for each fragment -> output.a = color.a * clippingmask.a)
(3) no clipping mask, apply alpha mask, no effects (one additonal texture sampler for linear transparency (0.0...1.0 in the mask) which is multiplied with the already existing alpha for each fragment -> output.a = color.a * alphamask.a)
(4) apply clipping mask, apply alpha mask, no effects (two additional texture samplers, alpha values are multiplied -> output.a = color.a * clippingmask.a * alphamask.a)
(5)..(8) Same as above but with additional calculations for contrast, saturation, tinting and brightness using user provided parameters. These effects work on the color part (color.r, color.g, color.b).
Creating such shader programs is not really complicated, HW accelerated and fun. For alpha values (clipping and alpha masks) these are just some multiplications basically. Alpha + clipping masks must be loaded and activated before actually rendering the object.
It would bring a lot of customization to all objects in LL!
Hope you consider that for the next release eventually
