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

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

I'm also fine with this proposal! Seems very practical.

Also, unless there's a technical reason to avoid it I think that sharing drawing buffers between canvases would be a very nice option to have. The minification and magnification options you mentioned are great real-world applications, and I've personally used similar techniques in the native world to great effect. Assuming we want to keep that ability, I have a preference towards canvas.setDrawingBuffer rather than the inverse because "set" methods tend to imply that only a single object is tracked, thus suggesting that a canvas can only have a single drawing buffer but the drawing buffer may be assigned to multiple canvases. If you want to avoid adding methods to the canvas I would suggest that the drawing buffer method instead be drawingBuffer.addCanvas/removeCanvas


On Tue, Dec 11, 2012 at 1:04 AM, Florian Bösch <pyalot@gmail.com> wrote:
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.