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

Re: [Public WebGL] getContext multiple context language



On Jan 26, 2010, at 1:04 PM, Vangelis Kokkevis wrote:

> 
> 
> ...
> If we require that the attributes must be identical during all
> requests, then exactly what version of the attributes need to be
> passed? The originally requested ones, which might not have been able
> to be honored, or the actual attributes that were satisfied by the
> implementation?
> 
> For this reason I strongly think that it would be a mistake to pay
> attention to the attributes on second and subsequent getContext()
> calls. Here is suggested re-wording:
> 
> "If getContext() is called with a contextId that names an
> already-active context, it must return the same resulting context
> object. In this case, the attributes, if any, are ignored."
> 
> -Ken
> 
> I agree with Ken's suggestion.  If the point of being able to call getContext() multiple times is to avoid having to pass the context object around then requiring every call to use the same arguments seems to negate that benefit (you would have to pass the arguments around instead).  It also possibly creates an expectation that by passing a different set of arguments you could modify an existing context which we know it's not what happens.

I think it's crazy to worry about the ability to use getContext() as a way to avoid having to save a context reference. It's easy enough to do:

	canvas.my3DContext = canvas.getContext("webgl");

if you need some place to put it. The problem is that if you pass a different set of attributes you don't know if you're going to get those attrs or if they're going to get ignored because there's no way to know if this is the first call to getContext() or not. Imagine that you're using some library and you do:

	My3DLibrary.init();
	var ctx = canvas.getContext("webgl", { depth:true });

Do I have a depth buffer now? Not if init() happened to call getContext("webgl"). Throwing an exception avoids surprises for the author so I think it's a good idea. I do think that calling getContext("webgl") should always work. In that case you can call getContextAttributes if you need to know what attributes are actually set.

-----
~Chris
cmarrin@apple.com




-----------------------------------------------------------
You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: