[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] using the same context with multiple canvases
In the case of the 2d context, why would you not simply allow the context to be passed to a web worker?
On Fri, Nov 9, 2012 at 3:33 PM, Ian Hickson <email@example.com>
I've been looking at this in the context of the 2D context and cross-worker canvases.
I like the idea described in this thread regarding being able to construct a rendering context independent of a canvas ("front buffer"). Rather than having the ability to bind a context to a canvas be a property of the context, though, I think it would make more sense to have it be a feature of the canvas. As in:
var context = new WebGLRenderingContext();
// do whatever to update canvas1
// do whatever to update canvas2
Calling getContext() on a canvas after setContext() has been called would fail.
Calling setContext() on a canvas after getContext() has been successfully used would fail.
Setting a rendering context to be the context of a canvas when it's currently set to another would remove the connection from the first one. Setting a rendering context to a canvas that already has one would drop the first one.
This would then work well with the work for putting contexts in workers, since you could create a 2D context and then assign it to a particular canvas.