opened
LeedaCode
username_0
Hi,every one !I wrote a stage snapshot through renderTexture, but due to constant creation, after running for a period of time, it became very stuck.
```javascript
/**
* This is the default playground.
* You should see a bunny spinning in the right preview pane.
* Feel free to use this as a starting point for you own playground!
*/

// Create our application instance
var app = new PIXI.Application({
    width: window.innerWidth,
    height: window.innerHeight,
    backgroundColor: 0x2c3e50
});
document.body.appendChild(app.view);

// Load the bunny texture
app.loader.add('bunny', 'https://pixijs.io/examples/examples/assets/bunny.png')
    .load(startup);

function startup()
{
    var container = new PIXI.Container();
    app.stage.addChild(container);
    
    var rect = new PIXI.Graphics();
    rect.beginFill();
    rect.lineStyle(5, 0xFF0000);
    rect.drawRect(0,0,app.renderer.width,app.renderer.height);
    rect.endFill();
    container.addChild(rect);

    var bunny = new PIXI.Sprite(app.loader.resources.bunny.texture);

    // Center the sprite's anchor point
    bunny.anchor.set(0.5);

    // Move the sprite to the center of the screen
    bunny.x = app.renderer.width / 2;
    bunny.y = app.renderer.height / 2;

    container.addChild(bunny);

    var renderTexture = app.renderer.generateTexture(container);
   // rect.visible = false;
    
    var s = new PIXI.Sprite.from(renderTexture);
    app.stage.addChild(s);
    s.width=app.renderer.width*0.1;
    s.height=app.renderer.height*0.1;
    s.x = app.renderer.width - s.width;


    // Listen for animate update
    app.ticker.add(function(delta)
    {
        renderTexture.destroy();
        renderTexture = app.renderer.generateTexture(container);
        s.texture = renderTexture;
        // Rotate mr rabbit clockwise
        bunny.rotation += 0.1 * delta;
    });
}

```

- **Running Example**: pixiplayground.com/#/edit/1UpX-VHEMARq_KF4_5e5Y
Rendertexture Snapshot
issue
created
LeedaCode
username_0
Maybe I should:
```javascript
    app.ticker.add(function(delta)
    {
       app.renderer.render(container, renderTexture);
        bunny.rotation += 0.1 * delta;
    });
```
comment
created
ivanpopelyshev
username_1
```
renderTexture = app.renderer.generateTexture(container);
s.texture = renderTexture;
```
        
all created renderTexture's are your to free. `s.texture.destroy()` 

also, if you can make your own code instead of generateTexture - that shoul work better, because we dont have guarantees on generateTexture. There's always something goes wrong with that heavy function , and its not because its written wrong - its because it uses so many systems that there are many points of failure, and many things are determined automatically when sometimes its easier to adjust them for your own case.
comment
created
LeedaCode
username_0
@username_1 thank you ，I see.I don't need to change GenerateTexture, for now, the default is what I want, I just need to update it via render
comment
closed
LeedaCode
username_0
issue