KlausKobald Posted May 4, 2014 Share Posted May 4, 2014 That was giving me a hard time and some crashes, that where caused by full memory on mobile devices.I am creating a lot of canvas textures and found out, that the cache fills up and grows into infinity. Pixi sets a _pixiId for every new canvas, which is then used as a key for the cache. I did not find out how to delete it. Maybe I am missing something in the API, or do not understand what´s going on. So I wrote this little patch, that could help also others: PIXI.BaseTexture._fromCanvas = PIXI.BaseTexture.fromCanvas; PIXI.BaseTexture.fromCanvas = function (canvas, scaleMode) { if (canvas._usePixiCache) return PIXI.BaseTexture._fromCanvas(canvas, scaleMode); else return new PIXI.BaseTexture(canvas, scaleMode);}; For canvas objects that are about to be reused one can set canvas._usePixiCache=trueFor some reason this has to be done.If there is a better solution, any advise would be fine! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.