diff options
Diffstat (limited to 'src/library_egl.js')
-rw-r--r-- | src/library_egl.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/library_egl.js b/src/library_egl.js index 0ccb13e6..ff912ed2 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'], @@ -484,6 +489,11 @@ var LibraryEGL = { eglSwapBuffers: function() { EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); }, + + eglGetProcAddress__deps: ['emscripten_GetProcAddress'], + eglGetProcAddress: function(name_) { + return _emscripten_GetProcAddress(Pointer_stringify(name_)); + }, }; autoAddDeps(LibraryEGL, '$EGL'); |