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

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

On Fri, Dec 14, 2012 at 5:08 AM, Ian Hickson <ian@hixie.ch> wrote:
On Thu, 13 Dec 2012, Gregg Tavares (社ç~T¨) wrote:
> >
> > Is this something that would make sense as arguments to setContext()?
> It doesn't seem like the appropriate place since they are "creation"
> parameters and since for an animated app with multiple canvases you're
> going to be calling setContext once per canvas per frame.

They don't have to be creation, right? I mean, you have multiple contexts
and you have multiple canvases, you're not going to be necessarily
creating anything after that, just binding a context to a canvas and
drawing. If the settings are specific to a particular context/canvas
binding, then setContext() seems the right place...

How does this help us in workers where we also want to be able to create some object that represents what's being drawn to and we want to be able to create multiple of them, draw to them with 1 context, and have each have different attributes?


> On top of that, if understand your current setContext spec, setContext
> effectively destroys the content of the canvas when called and loses all
> state in the context.

setContext() doesn't do anything except what the rendering context spec
says it should:


Literally all it does is unbind the previous context and bind the new one,
and it does that by just deferring to the spec that defines the contexts
for how to unbind and rebind.

The 2D context resets state, but GL doesn't have to.

> For WebGL and 1 context multiple canvases we need each canvas to keep
> its content with each call and we need the context to keep its state.

That's fine.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'