[Public WebGL] using the same context with multiple canvases

Gregg Tavares (社用) [email protected]
Tue Dec 11 20:13:52 PST 2012


On Wed, Dec 12, 2012 at 3:02 AM, Ian Hickson <[email protected]> wrote:

> On Tue, 11 Dec 2012, Gregg Tavares (社ç~T¨) wrote:
> >
> > So to continue this discussion we still need to figure out what we plan
> to
> > do for WebGL 1 context, multiple canvases
> >
> > IIRC the current thinking is this
> >
> >     gl = new WebGLRenderingContext();
> >     db1 = new Drawingbuffer(creationAttributes1);
> >     db2 = new Drawingbuffer(creationAttributes2);
> >     canvas1 = document.createElement("canvas");
> >     canvas2 = document.createElement("canvas");
> >     canvas1.setDrawingbuffer(db1);
> >     canvas2.setDrawingbuffer(db2);
> >     gl.bindDrawingbuffer(db1);
> >     gl.drawXXX(...);
> >     gl.bindDrawingbuffer(db2);
> >     gl.drawXXX(...);
>
> I don't really understand what a drawing buffer is in this API.
>
> Why wouldn't you just do:
>
>    gl = new WebGLRenderingContext();
>    canvas1.setContext(gl);
>    gl.drawXXX(...);
>    canvas2.setContext(gl);
>    gl.drawXXX(...);
>
>
Because

 (1) your example is missing the creation attributes required for WebGL on
setContext.

   (a) those should only be supplied once
   (b) as I pointed out they would be useful for canvas 2d as well

(2) we need a way to create drawing surfaces in Workers with creation
parameters



> ...?
>
> In any case, I think it can be made any number of ways, the only important
> thing at this point to make sure it works consistently with the 2D context
> and in particular to make sure it works in Worker threads is to use the
> API described here:
>
>
> http://lists.w3.org/Archives/Public/public-whatwg-archive/2012Nov/0199.html
>
> Specifically, the bit starting "it will require some additions to WebGL".
>

I still think that API needs to be informed by the decisions here.
Specifically as I mentioned there is a desire for 2D canvases to have
creation parameters similar to WebGL contexts. If nothing else to to be
able to choose double buffered canvases (fast) vs the current single
buffered canvases (slow)


>
> HTH,
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20121212/f9b87f03/attachment.html>


More information about the public_webgl mailing list