I’ve been trying to use BlendMode.ADD to create a distortion effect, but it seems to be really slow, specially in mobile platforms. If I run the exact same code without changing the blend mode, the performance issue disappears (but then the effect doesn’t really work).
Has anyone been able to work around this problem?
If you use old codebase (legacy, openfl 2) then BlendMode will work on CPU for cpp target. It’s slow.
Try to use openfl next, then it should work on GPU and work much faster.
Also FYI, using TileSheet.BLEND_ADD flag with the TileSheet.drawTiles() API can create the blending effect, and this API is using the GPU on native for both old and new code base.
Unfortunately I don’t think I can do that in this case, since it’s being applied to a dynamic part of the viewport, where there’s several layers. I guess I’ll have to either come up with some simpler effect, or try some GL trickery, but I haven’t used it before, so I’m not sure that last option is such a good idea…
You can try the new code base as dmitryhryppa said.