I'm trying to apply a shader to a Bitmap as it's described on this link.
This is the code:
var shader = new Shader ();
shader.glFragmentSource = "..."; <- this part is not important
shader.data.useAlphaImage = [ true ];
shader.data.uAlphaImage.input = alphaBitmapData;
bitmap.filters = [ new ShaderFilter (shader) ];
But if I apply the shader it gets transparent, with no errors. Do I have to configure something to get it working?
I am targeting HTML5.
ShaderFilter
is partially disabled in current OpenFL releases. The initial implementation was too slow to work on mobile; there are plans to revisit the feature again written in a different way.
In the meantime, there is a beta API you could try:
bitmap.shader = shader;
Also, be aware OpenFL uses premultiplied alpha, so bear that in mind within your shader when it comes to alpha values. This should be represented in the default shader code.