[Public WebGL] using the same context with multiple canvases

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

On Wed, Dec 12, 2012 at 1:28 PM, Ian Hickson <[email protected]> wrote:

> On Wed, 12 Dec 2012, Gregg Tavares (社ç~T¨) wrote:
> >
> > I still think that API needs to be informed by the decisions here.
> It was; see the thread last month.
> > 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)
> I don't understand what you mean by that distinction for 2D canvas.

webgl canvas:

    canvas1 = document.createElement("canvas");
    gl = canvas1.getContext("webgl", { alpha: false });  <--- these
properties are part of the canvas NOT the context

While the current spec makes them appear to be part of the context they a
really part of the canvas as is pointed out by using 1 context will
multiple canvases. We need each canvas to have it's own creation
parameters, not each context. Separating DrawingBuffer into it's own object
gives as an easy way to provide those parameters.

    canvas1 = document.createElement("canvas");
    canvas2 = document.createElement("canvas");
    canvas3 = document.createElement("canvas");

    gl = WebGLRenderingContext();

    db1 = new Drawingbuffer({ alpha: false });
    db2 = new Drawingbuffer({ antialias: false });
    db3 = new Drawingbuffer({ preserveDrawingBuffer: true });


Again, some of those parameters would be useful for 2d canvases as well.

> --
> 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/4318fd44/attachment.html>

More information about the public_webgl mailing list