[Public WebGL] How to check for WebGL support
Thu May 19 11:38:41 PDT 2011
----- Original Message -----
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.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the public_webgl