Re: [Public WebGL] Should WebGLContextAttributes be a callback interface?

On Sun, Apr 8, 2012 at 7:22 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> Kenneth Russell:
>
>> Sorry about that. It looks like I did drop that set of changes on the
>> floor by accident. Let's resolve this issue now.
>>
>> Has there been a decision on the best path forward here? The
>> requirements in the WebGL spec are relatively small; it must be
>> possible to pass a user object to getContext("webgl", /* attrs */) and
>> it must be possible to define the attributes and their types returned
>> from getContextAttributes. Aside from that the existence of the
>> WebGLContextAttributes interface is not important.
>
>
> Another problem is that a callback interface can't be used as the return
> type of getContextAttributes().  (It seems Web IDL doesn't explicitly
> disallow this, but it should.)
>
> Am I right in thinking that assigning to the properties of the object
> returned from getContextAttributes() shouldn't affect the context?  In that
> case, I think we can just change WebGLContextAttributes to a dictionary, and
> that lets us put the defaults on the dictionary too to avoid mentioning them
> in prose:
>
>  dictionary WebGLContextAttributes {
>    boolean alpha = true;
>    boolean depth = true;
>    boolean stencil = false;
>    boolean antialias = true;
>    boolean premultipliedAlpha = true;
>    boolean preserveDrawingBuffer = false;
>  };
>
> getContextAttributes() will then return a new JS object with those six
> properties set on it.

Sorry for the delay replying.

Thanks everybody for the analysis. It sounds like making
WebGLContextAttributes a dictionary is the right thing to do, since it
addresses the issue of making the entries optional, and also fixes
problems with the return value of getContextAttributes. WebGL spec and
IDL have been updated. Please post on public_webgl if you see problems
with these edits.

-Ken

Received on Friday, 27 April 2012 01:05:17 UTC