Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixi JS Renderer Drawingbuffer issues on iOS #4106

Closed
bhaux opened this issue Jun 16, 2017 · 10 comments
Closed

Pixi JS Renderer Drawingbuffer issues on iOS #4106

bhaux opened this issue Jun 16, 2017 · 10 comments
Labels
🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim Stale Previously “Won’t Fix”, bots should tag with this for inactive issues or pull-requests. 💾 v4.x (Legacy) Legacy version 4 support

Comments

@bhaux
Copy link

bhaux commented Jun 16, 2017

Hi there!
Pixie code which runs well on desktop seems to behave strangely on mobile.
I am a noob to pixie.js so I may with a very high likeliness be doing something wrong here.

When I use my drawing code on mobile, it appears that the canvas refreshes strangely.
I am not redrawing the entire stroke but maintaining the DrawingBuffer and just adding new sprites to it.

No matter if I set 'legacy:' to false or true (as below) - it will give me the same result.

Thanks for taking a look!

pixierenderer


initializePixieCanvas() {
    console.log("init canvas")
    const cArea = this.canvasContainer;
    const width  = 1000;
    const height = 1000;
    this.stage = new PIXI.Container();
    this.renderer = new PIXI.WebGLRenderer(
      width,
      height,
      {
          antialias: false,
          transparent: true,
          resolution: 2,
          clearBeforeRender: false,
          preserveDrawingBuffer: true,
          premultipliedAlpha: false,
          forceFXAA: true,
          legacy: true
      }
    );

    cArea.appendChild(this.renderer.view);

    this.renderer.view.style.position = "absolute";
    this.renderer.view.style.top = "0";
    this.renderer.view.style.left = "0";
    this.renderer.view.style.pointerEvents = "none";
    this.renderer.view.style.zIndex = "99";

    const cnvs = this.renderer.view;
    const scaleForHighResDisplay = true;
    if (scaleForHighResDisplay) {
        cnvs.width = width * 2;
        cnvs.height = height * 2;
        cnvs.style.width = width + 'px';
        cnvs.style.height = height + 'px';
    }

    this.pointer = new PIXI.Sprite(PIXI.Texture.fromCanvas(this.brushElement));
    this.pointer.texture.destroy();
    this.pointer.texture = PIXI.Texture.fromCanvas(this.brushElement);
    this.pointer.anchor.x = 0.5;
    this.pointer.anchor.y = 0.5;

    this.renderer.clear();

    this.stage.addChild(this.pointer);
}
@ghost
Copy link

ghost commented Jun 16, 2017

You should be writing native apps for stuff this advanced.

@bhaux
Copy link
Author

bhaux commented Jun 16, 2017

The web app is surprisingly fast and it seems so close - other than that the drawingbuffer likes to regurgitate old data of course...

@bhaux
Copy link
Author

bhaux commented Jun 17, 2017

So the good news is, turning on antialiasing fixes this artifact. But clearly turning on antialiasing still has a significant hit on the performance. Any help on bypassing/fixing this is bug is hugely appreciated. thx!

@GoodBoyDigital
Copy link
Member

hello! This looks like it may be a precision issue, have you tried setting the precision of the shaders to highP?

@floepi
Copy link

floepi commented Mar 15, 2018

I can confirm that it works with antialiasing enabled.

@GoodBoyDigital : Tried setting "highP" which did not have an effect unfortunately

Any other idea how this could be fixed without the performance hit of antialiasing?

@ivanpopelyshev
Copy link
Collaborator

@floepi

You can try change transparency, if you dont need that background.

{ transparent: 'notMultiplied'}

or

{ transparent: false}

@bhaux
Copy link
Author

bhaux commented Mar 15, 2018

unfortunately we will need both as this is a transparent paint layer...
We should see if we can debug why this is not happening with antialiasing enabled...

@ivanpopelyshev
Copy link
Collaborator

Do you want to debug mobile browser?

@themoonrat themoonrat added 🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim Renderer: WebGL 💾 v4.x (Legacy) Legacy version 4 support labels Jul 15, 2018
@stale
Copy link

stale bot commented Feb 24, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Previously “Won’t Fix”, bots should tag with this for inactive issues or pull-requests. label Feb 24, 2019
@lock
Copy link

lock bot commented Feb 24, 2020

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.

@lock lock bot locked and limited conversation to collaborators Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim Stale Previously “Won’t Fix”, bots should tag with this for inactive issues or pull-requests. 💾 v4.x (Legacy) Legacy version 4 support
Projects
None yet
Development

No branches or pull requests

6 participants