diff --git a/specs/latest/1.0/index.html b/specs/latest/1.0/index.html index 7b6884421..e34515228 100644 --- a/specs/latest/1.0/index.html +++ b/specs/latest/1.0/index.html @@ -3773,6 +3773,81 @@
+ When the user agent is to fire a WebGL + context recreation ready at a canvas, it must perform the following steps: + +
var gl = null; +var errorInfo = ""; +function createContext() { + + var gl = canvas.getContext("webgl"); + if(!gl) { + alert("A WebGL context could not be created at the moment.\nReason: " + + errorInfo + + "A event will be fired if hardware is ready again. Possibly in less than 30 seconds depending on specific hardwares."); + } + + return gl; +} + +function onContextCreationError(event) { + + canvas.removeEventListener( + "webglcontextcreationerror", + onContextCreationError, false); + + errorInfo = e.statusMessage || "Unknown"; +} + +canvas.addEventListener( + "webglcontextcreationerror", + onContextCreationError, false); + +function onContextRecreationReady(event) { + + canvas.removeEventListener( + "webglcontextrecreationready", + onContextRecreationReady, false); + + gl = createContext(); +} + +canvas.addEventListener( + "webglcontextrecreationready", + onContextRecreationReady, false); + +gl = createContext();+