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

Re: [Public WebGL] WebGLContextAttributes

On Wed, Dec 23, 2009 at 2:36 PM, Kenneth Russell <kbr@google.com> wrote:
> [...]
> 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;
>    };

Going by <http://dev.w3.org/2006/webapi/WebIDL/#native-objects>, I
think you'd need "[Callback] interface WebGLContextAttributes { ...as
above... }" and then it might be right. But I'm definitely not an
expert on WebIDL, so it'd probably be good to ask someone who is :-)

One difficulty with that context attribute syntax is what happens when
someone writes:

  c.getContext('webgl', { get alpha() { alert('alpha'); return false; } });

because the getter function will be called whenever the implementation
tries to retrieve the attribute value, and it ought to be specified
when and how often that happens. (e.g. is it only called during the
getContext call, or could it be run at an arbitrary time in the
I believe there have been similar discussions about how to design an
API with key/value pairs in the W3C public-webapps mailing list
(related to selector namespaces) but I don't know if there was any
conclusion about good or bad ways to do it.

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

Yeah, I think it'd be better to use the latest editor's draft rather
than the year-old snapshot, since it's likely to be much more correct
and stable. HTML5 already uses the syntax and definitions from the
editor's draft.

Philip Taylor

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: