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

Re: [Public WebGL] WebGLContextAttributes



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").

-- 
Philip Taylor
excors@gmail.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: