[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Proposed change to WebGL Event definition
- To: Chris Marrin <email@example.com>
- Subject: Re: [Public WebGL] Proposed change to WebGL Event definition
- From: Cedric Vivier <firstname.lastname@example.org>
- Date: Sat, 21 Aug 2010 11:35:41 +0800
- Cc: public webgl <email@example.com>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type; bh=VOezE2K+NCXFQEUwQ6EYM3SN57vMT6jF8DZ2FFe4vRc=; b=i21i00dwCb/PsP7PxGC6gGCZlx29V3LnXuAvR1Xcg/jPsDSrlZmGbOotfQe80g3HRA gNSA1Z0seuS+IyEH5f74EeRHL5m7nDF8orAmpXHjf7Ta21b3Ginopb14hcQ22E+iEma5 EgugCWVvuVWIJHLCweAQVQPAfP86aeKvWG5Js=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=N+URfp+sCp7aTFoZi+nIJPYvmjXmxNGgp6wqHJZg616WoC9xxgoa7sXJtkPDEDi7NW ABX787AOqk070P3auJPQC7ewXL56hlhTTFiwRZTNsaGkewPXMHCguwzyuiPffnRtk2VE s/ZxqyNZ5CktNDwcERCH8pYU+ioRl5gdSZohw=
- In-reply-to: <33F15A1B-FF87-44F1-ABA3-632494FA649A@apple.com>
- References: <33F15A1B-FF87-44F1-ABA3-632494FA649A@apple.com>
- Sender: firstname.lastname@example.org
On Sat, Aug 21, 2010 at 00:57, Chris Marrin <email@example.com>
Currently the spec shows two event interfaces: WebGLContextLostEvent and WebGLContextRestoredEvent. Other Event generators in HTML tend to use a single Event object with many event types. For instance, there is a MouseEvent object with event types like "click", "mousedown", "mouseup", etc.
Looks good but I think event type and status code should be separated into two different fields.
Consider using one handler for all three events, the context creation error case would require 3 comparisons instead of one, it's confusing and error-prone (easy to forget one) when you only care about context creation error itself.
unsigned short type - one of CONTEXT_LOST, CONTEXT_RESTORED or CONTEXT_ERROR
unsigned short statusCode - when type is CONTEXT_ERROR, one of NOT_AVAILABLE, NOT_ENABLED or OTHER_ERROR
CONTEXT_ERROR wording has the advantage of being a little bit more general than creation-time only error. For instance such error event could be raised when a context could not be restored or the user just disabled WebGL.
Having a separate statusCode also has the advantage that we can use the same organization wrt statusCode to deliver advanced status information about context loss/restoration in a future revision of the spec where we might support partial context restoration (eg. statusCode PARTIAL vs FULL, we discussed this few months ago, case where some GL resources are still available thus it's not necessary to re-upload everything).