[Public WebGL] How to check for WebGL support

Gregg Tavares (wrk) [email protected]
Thu May 19 11:07:01 PDT 2011


On Thu, May 19, 2011 at 10:37 AM, Vangelis Kokkevis <[email protected]>wrote:

> A recurring issue with sites that want to use WebGL is that there's
> currently no good light-weight way to check whether WebGL is supported in a
> particular client. We have a couple of mechanisms in place but they all have
> drawbacks:
>
> 1. Statically check for window.WebGLRenderingContext :  This will return
> false positives, e.g. when running on blacklisted configurations, when WebGL
> is explicitly disabled via some user pref, etc.
> 2. Create a WebGL context and inspect the result : Creating a context is
> expensive (slow) and when you only need to know whether WebGL is supported
> the resulting context isn't really needed.
>
> One possible solution would be to define window.WebGLRenderingContext only
> if both the browser supports WebGL and all the blacklist / user-pref / etc.
>  tests succeed.  Current pages will have to be tweaked to report a more
> generic "WebGL is not supported on your configuration" type of message
> rather than "Your browser does not support WebGL".  If they really need to
> know why it's not supported they can go one step further and try to create
> the WebGL context and decipher any context creation error.
>


That doesn't seem like it would not be a good solution because it means the
app will have no way to tell the user "hey, if you just update your drivers
you can run my app".
If window.WebGLRenderingContext does not exist then it makes no sense to be
able to call context.getContext("webgl") since that's what it's supposed to
return.



>
> Obviously there will still be some false positives with this mechanism but
> they will hopefully be rare.
>
> Thoughts?
>
>
> Vangelis
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110519/5ae6f95d/attachment.html>


More information about the public_webgl mailing list