[Public WebGL] getContext multiple context language

Chris Marrin [email protected]
Tue Jan 26 16:16:24 PST 2010

On Jan 26, 2010, at 1:09 PM, Vladimir Vukicevic wrote:

> On 1/26/2010 1:04 PM, Vangelis Kokkevis wrote:
> ...One thing that I have on my todo list (it's actually done, just need to make sure I don't screw up the svn line endings) is to change the webgl attributes object a bit -- we changed 'antialias' to 'antialiasHint', and made the other non-Hint attributes requirements... that is, if you request stencil, you either get a context with a stencil buffer, or null.  For the Hint attributes, you can get anything, but you indicate your preference.
> One thing that I didn't do here but might be a good idea is to move getContextAttributes(contextId) to the canvas itself, as opposed to putting it on the context.  That seems to be better symmetry.

I like it where it is. That way its return type can be specific to our object. And since the param is optional, some contexts (like '2d') won't use it at all, so the extra function would be useless.

>> 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.
> It would be simpler, but the latter bit is exactly what worries me -- if the attributes are just silently ignored, then the user might think that a switch took place.
> What about a third alternative: attributes are invalid on a getContext() call for an already-active context?  That is, any subsequent getContext call must not specify any attributes?

That seems fine to me.

[email protected]

You are currently subscribe to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:

More information about the public_webgl mailing list