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

Re: [Public WebGL] WebGLContextAttributes

On 12/23/09 3:36 PM, Kenneth Russell wrote:
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";

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

That is not what I recall, there were lots of discussions about it but I think we said it has to be a special object.


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: