On Sep 10, 2012, at 12:44 PM, Tobie Langel <tobie.lan...@gmail.com> wrote:

>>> What about enabling feature detection by providing a method per context?
>>> 
>>> interface HTMLCanvasElement : HTMLElement {
>>> object get2DContext();
>>> object getWebGLContext(any... args);
>>> };
>>> 
>>> That way, developers can use idiomatic JS for feature testing like
>>> pretty much everywhere else on the Web platform:
>>> 
>>> if (canvas.get2DContext) {
>>> // do stuff with 2D canvas
>>> }
>> 
>> This doesn't address the problem we are hitting, which is that
>> it is expensive to create a context.
> 
> It does. Only expose the API when you can create the context.

This is actually what we could do now. We could hide 
window.WebGLRenderingContext
when we can't create one. But then we'd have to hide all these too:

        attribute [Conditional=WEBGL] WebGLActiveInfoConstructor 
WebGLActiveInfo;
        attribute [Conditional=WEBGL] WebGLBufferConstructor WebGLBuffer;
        attribute [Conditional=WEBGL] WebGLFramebufferConstructor 
WebGLFramebuffer;
        attribute [Conditional=WEBGL] WebGLProgramConstructor WebGLProgram;
        attribute [Conditional=WEBGL] WebGLRenderbufferConstructor 
WebGLRenderbuffer;
        attribute [Conditional=WEBGL] WebGLRenderingContextConstructor 
WebGLRenderingContext;
        attribute [Conditional=WEBGL] WebGLShaderConstructor WebGLShader;
        attribute [Conditional=WEBGL] WebGLShaderPrecisionFormatConstructor 
WebGLShaderPrecisionFormat;
        attribute [Conditional=WEBGL] WebGLTextureConstructor WebGLTexture;
        attribute [Conditional=WEBGL] WebGLUniformLocationConstructor 
WebGLUniformLocation;

It seems like a pain.

Dean

> 
>> It's also a big change to
>> an existing operational API.
> 
> Agreed. You can always leave the previous method around for backward
> compatibility.
> 
> --tobie

Reply via email to