jeeliz/jeelizWeboji

Sharing the WebGL content with another JS library

smoothblur opened this issue · 1 comments

I have been working on a project using both jeelizWeboji and the PixiJS library. (https://github.com/pixijs/pixi.js) Currently both libs are running their own WebGL contexts. (2 canvases) Wondering if you have any thoughts on getting both libraries to share a context? A while back I saw an example of sharing a context between jeelizFaceFilter and Three.js but not for jeelizWeboji.

I was able to get PixiJS and Three.js to share a content but my initial attempts in getting jeelizWeboji and Pixi.js to share one have not had much success. Any thoughts or insight you could offer?

Hi @smoothblur

Although Jeeliz FaceFilter (https://github.com/jeeliz/jeelizFaceFilter) it is possible to share a WebGL context between THREE.js and the main library, I really don't advise to do that.

Indeed,

  • I have to reset the THREE.js state at each rendering loop,
  • It leads to complicated state relative bugs,
  • WebGL states are too remanent, I think it is not a good practice to share them,
  • The performance gain is not important,
  • Most 3D Engine (including THREE.js) are not really made for this kind of use-cases. Your code may break easily on 3D engine upgrades. You may have to add dirty hacks to fit the 3D engine.

More information about the question here: https://github.com/jeeliz/jeelizFaceFilter#1-or-2-canvas

So it is not planned to support sharing WebGL context with Weboji.