Jump to content

Constantly updating PIXI.RenderTexture dumps browser memory


toowren
 Share

Recommended Posts

There are two sprites, one is dynamic and second have to be constantly updated with first one through PIXI.RenderTexture()

let sprite = new PIXI.Sprite(), tmp = new PIXI.Sprite();

//some manimulations with these sprites

app.ticker.add((delta_) => {

    ...
    updateTexture(w, h); //width is dynamic value
    ...

})

Here is updateTexture() function

function updateTexture(w_, h_){

    let renderTexture = PIXI.RenderTexture.create({ width: w_, height: h_});

    tmp.texture = sprite.texture;
    
    app.renderer.render(tmp, renderTexture);
    app.renderer.clear();

    placeholder_.texture = renderTexture;
    placeholder_.texture.update();

}

And it seems that let renderTexture = PIXI.RenderTexture.create({ width: w_, height: h_}); creates a new instance in memory dumping it every time up to browser crash.

app.renderer.clear() doesn't helps.

Any ideas?

 

Edited by toowren
Link to comment
Share on other sites

  • toowren changed the title to Constantly updating PIXI.RenderTexture dumps browser memory

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...