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

Re: [Public WebGL] using the same context with multiple canvases






On Wed, Dec 12, 2012 at 1:28 PM, Ian Hickson <ian@hixie.ch> 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 });

    gl.bindDrawingbuffer(db1);
    gl.drawXXX();
    gl.bindDrawingbuffer(db2);
    gl.drawXXX();
    gl.bindDrawingbuffer(db3);
    gl.drawXXX();

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.   `._.-(,_..'--(,_..'`-.;.'