[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Proposed change to WebGL Event definition
On Sep 6, 2010, at 3:44 AM, Dean Jackson wrote:
> On 04/09/2010, at 11:57 PM, Chris Marrin wrote:
>> I think the right way to handle that is to add a media query for WebGL. We've made a proposal to add media queries for CSS animations, transitions, and transforms. These are all supported in WebKit today. It would be easy to add one for 'webgl'. You can run the query from JS and know you don't have WebGL without having to call getContext(). But the really nice thing about media queries is that you can use them in CSS style sheets. If WebGL is missing you can style the page differently for, for instance, not take up the space for the WebGL canvas.
>> So the proposal is to get rid of statusCode and add a media query for 'webgl'. I will talk to dino, who is pushing the media query extensions spec, about this as well.
> For the feature detection part, yes, CSS media queries are fairly nice. They have the benefit of running inside a style sheet, as well as a JS interface for on-the-fly queries (implemented in WebKit at least). They have a slight downside in that they are not evaluated in browsers that don't understand the feature - so you have to use them in a way that adds functionality when the feature is there, rather than provides a fallback when it isn't (if that makes sense :)
Yes, it sounds like in order to make this feature really effective, we would have to require that all browsers supporting WebGL would have to support media queries, at least those related to WebGL. We'd need to do this:
1) Do a media query for WebGL support. If no, tell the user WebGL is not supported in the browser. done.
2) addEventListener for 'webglcontexterror'.
3) Call canvas.getContext("webgl"). If a valid context is returned, use it. done.
4) When event comes in show user a dialog telling them why they can't use WebGL. done.'
In order for all that to work, we need to make the assumption that if media queries for WebGL don't exist, WebGL doesn't exist.
> You should probably talk to the W3C CSS Working Group if you plan to add a new media query. Chris mentioned CSS animations where we've included the media query as part of the spec. In the WebGL case, where the specification isn't at W3C, I think you should make the effort to contact the group - or at least start with a post on www-style.
> It's a shame the HTML5 canvas API doesn't have feature detection built in. Well, I guess it does - if you get a null result the context isn't supported - it's just that you here want more information than that. Are you sure you really need to tell the developer exactly why WebGL is not available? If it was because WebGL is not turned on do you really explain to the user how to enable it? What if they can't? Does it matter if their hardware isn't powerful enough ("please go buy a new computer")?
> My gut feeling is that you don't need a status message. If there is no WebGL, there's no WebGL. That's all that really matters, and that's the way it works for other Web technologies like SVG, CSS3, HTML5, <video>, etc.
This issue was raised mainly because there are (at least) 3 distinct reasons for WebGL content to be inaccessible. 1) This browser doesn't support WebGL, in which case we can show the user a page of browsers that do, 2) This browser supports WebGL but it is currently turned off, in which case we can show the user how to turn it on, and 3) the current hardware doesn't support WebGL functionality, in which case we can tell the user which hardware does. Since WebGL is so new and have many variables about how to make it work, we wanted a rich and consistent way to help the user to see WebGL content.
You are currently subscribed to email@example.com.
To unsubscribe, send an email to firstname.lastname@example.org with
the following command in the body of your email: