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

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



If they don't have webgl you should direct them to http://get.webgl.org

if (!window.WebGLRenderingContext) {
   // the browser does not know what webgl is
   // present a link or redirect to http://get.webgl.org
}

If they DO have webgl but it won't initalize you should direct them to http://get.webgl.org/troubleshooting

gl = canvas.getContext("webgl");
if (!gl) {
   // present a link or redirect to http://get.webgl.org/troubleshooting
}
- Show quoted text -

On Fri, Mar 11, 2011 at 1:19 PM, Stephen Bannasch <stephen.bannasch@deanbrook.org> wrote:

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" ) {
      if (window.WebGLRenderContext) {  // this should be enough in _javascript_ 
     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 status messages are undefined. Best to just send the user to http://get.webgl.org/troubleshooting
 

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