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

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

I'm fine with that API and I don't have a preference on which object the method sits to attach a canvas to a drawing buffer.

On Tue, Dec 11, 2012 at 9:26 AM, Gregg Tavares (社用) <gman@google.com> 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");

These issues are separate from CanvasProxy etc.

Are there any problems with this?

Can you assign the same drawingBuffer to more than one canvas?


I don't know if there's any use case for that though I suppose it might give you free magnification (zoom) or minification (document navigation) with the right CSS options. You'd basically be compositing the same drawingBuffer in multiple places on the page.

Should associating the canvas with a drawing buffer be a drawingbuffer method to avoid adding stuff to the canvas?


Note that although this doesn't work with canvas2d arguably canvas2d should also have creation parameters. Specifically it would be nice if it was possible to ask for a double buffered canvas as in {preserveDrawingbuffer: false} as double buffering can be significantly faster than the fake single buffered ones we have now that requires a copy. It might also be a good way to request a non HD-DPI 2d canvas.