question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] ParticleContainer can only be renderered in one renderer

See original GitHub issue

I am using double buffering and i render a particleContainer once in a renderer, once in another renderer. The particleContainer is always correctly displayed in the first renderer and always invisble in second renderer. This can be seen in this demo. You just have to translate or zoom the map to see that the markers are displayed, invisible, displayed, invisible,…

If i patch ParticleContainer.prototype.renderWebGL this way:

PIXI.particles.ParticleContainer.prototype.renderWebGL = function(renderer) {
  if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)
    {
        return;
    }
    if (!this.baseTexture)
    {
        this.baseTexture = this.children[0]._texture.baseTexture;

    }
    // patch begin
    this.onChildrenChange(0);

    // if (!this.baseTexture.hasLoaded)
    //     {
    //         this.baseTexture.once('update', () => this.onChildrenChange(0));
    //     }

    // patch end 
    renderer.setObjectRenderer(renderer.plugins.particle);
    renderer.plugins.particle.render(this);
};

the problem disappears like in this demo. Apparently, the texture is not usable in second renderer and needs to be uploaded. I’m not very happy with this solution. Do you think another approach is possible?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ivanpopelyshevcommented, Feb 19, 2018

Please try this one and confirm that it works: http://pixijs.download/dev-particle-two-renderers/pixi.js It takes a couple of minutes to build from a branch.

0reactions
lock[bot]commented, Mar 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] ParticleContainer can only be renderered in one renderer
The particleContainer is always correctly displayed in the first renderer and always invisble in second renderer. This can be seen in this demo....
Read more >
PIXI.ParticleContainer - PixiJS API Documentation
IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. Default Value: 0xFFFFFF. Methods. destroy (options) ...
Read more >
How to use PIXI.Graphic when using new PIXI.particles ...
In Canvas, when you use PIXI.Container to hold PIXI.Graphics , it will loop through all its Graphics object children and call CanvasGraphicsRenderer to...
Read more >
new PIXI.particles.ParticleContainer (maxSize, properties ...
The ParticleContainer class is a really fast version of the Container built ... This is a webGL only feature and will be ignored...
Read more >
Weird behavior of PIXI.particles.ParticleContainer, no children ...
If in canvas Container's performance for rendering thousands of sprites is not that different with ParticleContainer I will just use Container.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found