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

Re: [Public WebGL] Proposed change to WebGL Event definition



On Dec 20, 2010, at 3:55 PM, Gregg Tavares (wrk) wrote:

> 
> 
> ...> But then how do I distinguish that from #1?  In the #1 case I call getContext("webgl") and if it returns null then what?
> >
> >     canvas.addEventListener(
> >       "webglcontextcreationerror",
> >       reportThatBrowserSupportsWebGLbutNotYourHardware);
> >   var gl = canvas.getContext("webgl");
> >   if (!gl) {
> >
> > To answer my own question,
> >
> > I suppose I can do this
> >
> > if (window.WebGLRenderingContext) {
> >   // browser supports WebGL
> 
> I don't think you can rely on that. There is nothing in the spec that requires the WebGLRenderingContext prototype to be publicly available. You don't need it for creation since getContext() does that. It is useful for type checking, but there is no text in the spec that requires it.
> 
> Currently we have conformance tests for this. I don't know what in the WebIDL or spec needs to change to ensure it but for example it's pretty useful to be able to do
> 
> if (tex instanceof WebGLTexture)
> 
> or 
> 
> if (context instanceof WebGLRenderingContext) {
>   ...
> } if (context instanceof CanvasRenderingContext2D)
>   ...
> }
>  
> The browsers appear to all support the correct types for Canvas 2d objects. Why not WebGL objects as well?

Let's not confuse what browsers support with what is specified. Window is a de facto standard (recent attempts to standardize it notwithstanding), so it's hard to use it as the basis for conformance tests, much less the spec. I'm not sure how you mandate that the Window object contains a WebGLRenderingContext object, when the Window object itself is not mandated.

I'm not an expert in this and I like the idea of testing for the existence of WebGL objects as an existence proof of WebGL. I just want to make sure we spec it right and we make conformance tests that really do test spec conformance.

I know that in all browsers I've tested the Window object is equal to the JavaScript 'global' object. Can we mandate that JavaScript based implementations of WebGL must have the WebGL objects in the global namespace?

-----
~Chris
cmarrin@apple.com




-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: