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

Re: [Public WebGL] WebGLContextAttributes

On Wed, Dec 23, 2009 at 3:13 AM, Philip Taylor <excors@gmail.com> wrote:
> On Wed, Dec 23, 2009 at 1:54 AM, Kenneth Russell <kbr@google.com> wrote:
>> The WebGLContextAttributes interface currently uses DOMStrings for the
>> values passed to the NameSetter and returned from the NameGetter.
>> Should these be type "any" instead? Currently creating such an object
>> would be unnatural in JavaScript:
>> gl = c.getContext("experimental-webgl",
>>    { antialias: "false",
>>      stencil: "false" });
> I believe that is not allowed by the current spec, and will result in
> a TypeError. It seems the intention of WebGL is that the second
> argument is a WebGLContextAttributes object (though the WebGL spec
> currently lacks the IDL defining that), in which case
> http://dev.w3.org/2006/webapi/WebIDL/#es-interface is relevant. The
> "{...}" object is not a host object, and WebGLContextAttributes
> doesn't satisfy the criteria for allowing native object
> implementations, so this won't work.
> You'd have to say
>  var attr = new WebGLContextAttributes();
>  attr.antialias = "false";
>  etc
> Then (with the current definitions) you could already say
>  attr.antialias = false;
> because the NameSetter takes a DOMString argument, so the value on the
> JS side will be automatically converted to a string (in this case
> "false").

The WebGL working group's intent with this interface was to allow a
JavaScript object literal to be passed in for this argument. (Someone
please correct me if I'm misspeaking.)

How would we need to change the IDL to allow this? From looking at the
WebIDL spec you pointed to, it looks like the issue is the presence of
the setters / getters, and that this would satisfy the requirements:

    interface WebGLContextAttributes {
        attribute boolean alpha;
        attribute boolean depth;
        attribute boolean stencil;
        attribute boolean antialias;
        attribute boolean premultipliedAlpha;

By the way, I and perhaps others have been looking at
http://www.w3.org/TR/WebIDL/ , which it looks like is out of date.


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: