litegl.js
litegl.js copied to clipboard
Multiple contexts on the same page
trafficstars
Is there a good example illustrating multiple contexts on the same page? I'm getting WebGL: INVALID_OPERATION: bindBuffer: object does not belong to this context and not quite sure where to start.
Dug through the code and found the (undocumented) solution. Instead of doing e.g.
this.gl = GL.Create( ... )
...
this.yourMesh = GL.Mesh.load({vertices: this.yourPoints, colors: this.yourColors});
You need to do
this.gl = GL.Create( ... )
...
this.yourMesh = GL.Mesh.load({vertices: this.yourPoints, colors: this.yourColors}, null, null, this.gl);