[whatwg] [canvas] getContext & multiple contexts

On Tue, 3 Aug 2010, Chris Marrin wrote:
> On Aug 2, 2010, at 3:16 PM, Ian Hickson wrote:
> > On Thu, 29 Apr 2010, Vladimir Vukicevic wrote:
> >> 
> >> A while ago questions came up in the WebGL WG about using a canvas 
> >> with multiple rendering contexts, and synchronization issues that 
> >> arise there. Here's our suggested change to getContext.
> > 
> > This seems overly complex. I've gone for a somewhat simpler approach, 
> > which basically makes <canvas> fail getContext() if you call it with a 
> > context that isn't "compatible" with the last one that was used, as 
> > defined by a registry of contexts types. Currently, only '2d' and '3d' 
> > are defined in this registry, and they are not defined as compatible.
> 
> '3d'? We're calling it 'webgl'. Is there another 3D context registered 
> somewhere?

Sorry, typo in the e-mail. The spec correctly refers to a "webgl" context.

(I have to say, I'd rather we called it "3d". I hate it when we embed 
marketing names into the platform.)


>> [arguments on getContext]
>
> We feel it's more appropriate on the getContext() call because it 
> involves creation of the resources for the context. If it were a 
> separate call, you'd need to defer creation of those resources until the 
> attribute call is made or create them as needed. This not only involves 
> overhead in every call, but it requires you to provide specific rules on 
> which calls cause automatic resource creation. Making it a parameter to 
> getContext simplifies the definition. And it seems this would be a 
> useful parameter for many types of contexts, even the 2D context as Vlad 
> pointed out.

What happens if you call getContext with the same contextID but different 
attributes?

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

Received on Tuesday, 3 August 2010 15:41:43 UTC