aboutsummaryrefslogtreecommitdiff
path: root/src/library_egl.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-08 13:54:42 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-08-08 13:54:42 -0700
commit5888dfe3d8a84921baff02e4967348a58317526d (patch)
treef209fc7a67bf24ed5ea26427c2836f5770d9a156 /src/library_egl.js
parentd92a3ab59d8446d3e2fc7e38a7090f097bc5af82 (diff)
parent75760c7bffe20a62219fdb9ade9864b5f15ec58e (diff)
Merge pull request #1483 from juj/graceful_gl_fail
Graceful gl fail
Diffstat (limited to 'src/library_egl.js')
-rw-r--r--src/library_egl.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/library_egl.js b/src/library_egl.js
index 0ccb13e6..0e96e92f 100644
--- a/src/library_egl.js
+++ b/src/library_egl.js
@@ -260,8 +260,13 @@ var LibraryEGL = {
}
EGL.windowID = _glutCreateWindow();
- EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
- return 62004; // Magic ID for Emscripten EGLContext
+ if (EGL.windowID != 0) {
+ EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
+ return 62004; // Magic ID for Emscripten EGLContext
+ } else {
+ EGL.setErrorCode(0x3009 /* EGL_BAD_MATCH */); // By the EGL 1.4 spec, an implementation that does not support GLES2 (WebGL in this case), this error code is set.
+ return 0; /* EGL_NO_CONTEXT */
+ }
},
eglDestroyContext__deps: ['glutDestroyWindow', '$GL'],