Jump to content

Strange crash when using Filters


undimon
 Share

Recommended Posts

I add filter to containers

protected addStylesToContainer(container: Container): void {
	container.filters = [
    	new OutlineFilter(), // Everything work with this filter
        new DropShadowFilter(), // <-- Breaks here
    ];
}

But the error start to happen even if I call new DropShadowFilter() anywhere (!) in code, even without applying to object's filters property...

After some investigation I think it somehow related to masks. In other part of a code I create mask sprite from render texture:

const cont = new Container();
const tmpSprite = new Sprite(this.sprite.texture);
cont.addChild(tmpSprite);

tmpSprite.filters = [new OutlineFilter(outlineSize, 0xffffff, 1, 1)];

const maskTex = RenderTexture.create({ width: tmpSprite.width, height: tmpSprite.height });
Game.renderer.renderer.render(cont, maskTex);

cont.destroy({ children: true });

this.maskSprite = new Sprite(maskTex);
this.maskSprite.name = 'Mask';

this.addChild(this.maskSprite);
this.mask = this.maskSprite; // <--- THIS LINE CRASHES THE APP

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...