Jump to content

Recreate WebGLRenderer on new Canvas


hyzhak
 Share

Recommended Posts

In my case I need to recreate WebGLRenderer on new Canvas. Also I've deleted previous WebGLRenderer before.

 

After some experiments I've found that you need to clear some cache objects in PIXI.js before recreate WebGLRenderer, to avoid caching of previous 3D context in objects.

Here is solution:

//clear some cached objects in Pixi.jsPIXI._batchs.length = 0;PIXI.TextureCache = {};PIXI.BaseTextureCache = {}; 

https://gist.github.com/Hyzhak/5747824

 

PS:

But anyway I'm still having some strange bug with shuffling of sequence of rendering DisplayObjects. It's look like after recreation of WebGLRenderer hierarchy of DisplayObjects breaks.

PPS:
I've tested same use case on CanvasRenderer and everything works fine.

Link to comment
Share on other sites

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