[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Shared resources between contexts

As far as I know there is no such thing as 2 OpenGL contexts sharing a backbuffer in real OpenGL. Every OpenGL context has its own backbuffer, even if it's offscreen or 1x1 pixel. So you can't render to the same backbuffer with 2 contexts since the backbuffers are not shared. You can render to the same framebuffer object though.

WebGL is effectively simulating OpenGL so I wouldn't expect to be able to get 2 context to the same canvas. 

This is what I'd propose the API be

   cavnas1 = document.createElement("canvas");
   canvas2 = document.createElement("canvas");
   gl1 = canvas1.getContext("webgl");
   gl2 = canvas2.getContext("webgl", { sharedResourceGroup: gl1 });

That last line could be also be

   gl2 = canvas2.getContext("webgl", { sharedResourceGroup: canvas1 });


   gl2 = canvas2.getContext("webgl", { sharedResourceGroup: gl1.sharingGroup });

but something along those lines. This effectively follows eglCreateContext. The first example most closely.