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

Re: [Public WebGL] Re: [whatwg] Canvas.getContext error handling



On 19/04/2011 04:06, Glenn Maynard wrote:
> Following up from whatwg:
> http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-April/031192.html. 
> To recap, step 6 of getContext ("Return a new object for contextId"),
> which is where WebGL takes over, was never intended to return null. 
> null isn't a "new object", it's no object.
What happens if the context type passed to getContext is not recognized
by the browser, e.g., when WebGL is not supported by the browser?
>
> I'd recommend, in line with Cedric's suggestion:
>
>  - getContext always returns a WebGLRenderingContext, whether the
> drawing surface can be created or not.
>  - If the drawing surface couldn't be created (where it currently
> returns null), synchronously dispatch webglcontextlost before
> getContext returns.
>  - webglcontextcreationerror is dropped; statusMessage is included
> with webglcontextlost instead.
If we go this route, a status message in webglcontextlost is
insufficient. Applications that wish to handle webglcontextlost will not
want to be parsing strings, especially localized strings, to determine
if the browser is refusing to create a context, so there is no
possibility of restoration, or if it is a normal context lost event.
Some kind of error code will be needed.

Regards

    -Mark

begin:vcard
fn:Mark Callow
n:Callow;Mark
org:HI Corporation;Graphics Lab, Research & Development
adr:Higashiyama 1-4-4, Meguro-ku;;Meguro Higashiyama Bldg 5F;Tokyo;;153-0043;Japan
email;internet:callow_mark@hicorp.co.jp
title:Chief Architect
tel;work:+81 3 3710 9367 x228
tel;fax:+81 3 5773 8660
x-mozilla-html:TRUE
url:http://www.hicorp.co.jp,  http://www.mascotcapsule.com
version:2.1
end:vcard