Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

Constantly updating PIXI.RenderTexture dumps browser memory

$
0
0

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?

 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>