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

[Public WebGL] distinguishing browsers that support WebGL but need updated drivers




I created a very simple page that distinguishing between:

1) browsers that support WebGL
2) browsers that support WebGL but don't successfully generate a WebGL context.
3) browsers that don't support WebGL

http://visual-demos.dev.concord.org/seasons/test-for-webgl.html

I'm using this function to test whether the browser supports WebGL:

  function browserSupportsWebGL() {
    if (window.WebGLRenderingContext === undefined || window.WebGLRenderingContext.tagName === "DFN" ) {
      return false
    } else {
      return true
    }
  }

The bizarre test for tagName == DFN handles Safari 5.0.x which returns a DFN element in response to window.WebGLRenderingContext.

I've also added a handler to receive a webglcontextcreationerror event:

  function webglContextCreationErrorHandler(evt) {
    if (evt.statusMessage) {
      document.getElementById("status-message").textContent = evt.statusMessage;
    }
  };

See: http://www.khronos.org/registry/webgl/specs/latest/#5.14.3

I don't actually know if this works or what might be returned as a statusMessage.

I know FFv4 doesn't report a statusMessage yet. If some version of Chrome does I'd like to know what kind of statusMessage is returned if someone out there has a machine where Chrome won't create a WebGL context because of unsupported video cards or a video driver that is too old.

The code is here: https://github.com/stepheneb/seasons/blob/master/test-for-webgl.html

Thanks

-----------------------------------------------------------
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:
unsubscribe public_webgl
-----------------------------------------------------------