canvasman Posted November 20, 2018 Share Posted November 20, 2018 I can create texture of PIXI.Graphics with renderer.generateTexture() function. I could also create new render texture and use renderer.render() function to render the circle to that, am I right? Which one of those I should use? Is there any performance benefits? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 20, 2018 Share Posted November 20, 2018 generateTexture() has extra "getLocalBounds" call which is evil. That thing is messing with transforms. https://github.com/pixijs/pixi.js/blob/dev/src/core/renderers/SystemRenderer.js#L251 canvasman 1 Quote Link to comment Share on other sites More sharing options...
Rydez Posted November 22, 2018 Share Posted November 22, 2018 What exactly is wrong with generateTexture()? I use this whenever I create a sprite from a graphic. Is this bad practice? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 22, 2018 Share Posted November 22, 2018 Its difficult topic. Number of bugs I encountered because of re-parenting or re-calculating transforms inside that kind of functions in pixi is high and its always pain to debug it. I failed at patching it , most of my PR's regarding this problem were rejected because code was not clear. When someone passes element that already has a parent inside "generateTexture" or "extract" plugin, or even use "cacheAsBitmap", I advice to prepare for pain in case this thing backfires. Its their problem to debug and not mine. Example: https://github.com/pixijs/pixi.js/issues/5232 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 22, 2018 Share Posted November 22, 2018 Good Practice: either pass there element that has no parent, either pass extra parameter "region". 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.