[Public WebGL] How to check for WebGL support

Vangelis Kokkevis [email protected]
Thu May 19 11:56:27 PDT 2011

On Thu, May 19, 2011 at 11:38 AM, Benoit Jacob <[email protected]> wrote:

> ------------------------------
> On Thu, May 19, 2011 at 1:37 PM, Vangelis Kokkevis <[email protected]>wrote:
>>  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.
> A problem someone pointed out at one point is that browsers (Chrome, as I
> recall) want to be able to update the GPU blacklist at runtime while the
> browser is running, without forcing a browser restart.  However, once you
> expose WebGLRenderingContext to a window, you can't remove it.
> Good point; see my isWebGLAvailable() suggestion in the other email I just
> sent --- that would also address that concern.

Chrome does indeed support out-of-band blacklist updates but the results
typically only take effect in new tabs.  We won't shut down a running WebGL
context and cannot change the behavior of already loaded pages.

Defining a query method would work fine too although having both a variable
defined on window and a method will be confusing.


> Benoit
> I think there's nothing wrong with browsers not exposing WebGL interfaces
> when it's known in advance that WebGL isn't available, but pages still
> couldn't depend on it.  They'd still end up having to create a context to
> check whether it actually works.
> On Thu, May 19, 2011 at 2:21 PM, Gregg Tavares (wrk) <[email protected]>
> wrote:
> > I guess I don't understand the use case.
> > Either you want to use WebGL in which case you are going to have to call
> canvas.getContext("webgl") with whatever parameters your app needs and see
> if it succeeds.  You have to pay the startup cost since you are using WebGL.
> > If it fails (blacklisted, no webgl) there is no startup cost or shouldn't
> be.
> > Why do you need another way to check?
> You may want to grey out or remove WebGL-related features from your site if
> it's known in advance that it's not going to work, instead of presenting the
> user with unusable features.  Not every use of WebGL is something that's
> started up immediately when a page loads.
> --
> Glenn Maynard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110519/2ea412db/attachment.html>

More information about the public_webgl mailing list