Search code examples
htmlblurhaxedropshadowopenfl

Filters on DisplayObject Not working


I'm trying to add DropShadowFilter / BlurFilter / GlowFilter to a simple Sprite on stage. If i target flash, it looks and behaves fine. When i target HTML5, i see nothing.

The wiki says "Available on all platforms" (link). Am i doing something wrong?

I'm importing import openfl.filters.BlurFilter; import openfl.display.Sprite;

Here is the code im using:

var s:Sprite = new Sprite();
s.graphics.beginFill(0xff0000, 1);
s.graphics.drawCircle(50, 50, 50);
s.graphics.endFill();
var blur:BlurFilter = new BlurFilter(40, 40, 1);
s.filters = [blur];
addChild(s);

HTML5 PRINTSCREEN: enter image description here

FLASH PRINTSCREEN: enter image description here


Solution

  • Right now there is little to no support for filters on any target but Flash.

    The good news is that we are working on implementing custom shaders and filters for OpenFL next on every target that uses OpenGL. Here is the PR and discussion https://github.com/openfl/openfl/pull/697

    html5 webgl

    I would guess that some filters could be implemented via software for HTML5 canvas, but I'm not focusing on that in that PR.