diff options
author | juj <jujjyl@gmail.com> | 2014-02-17 22:05:10 +0200 |
---|---|---|
committer | juj <jujjyl@gmail.com> | 2014-02-17 22:05:10 +0200 |
commit | bae7c6e93962e4cb25ee5fa532bee5ba7f8f237c (patch) | |
tree | 78789a363c3573b8331518534d018b225a8a0543 | |
parent | 749325298aa5328429ee571f50034adaa4a6423d (diff) | |
parent | 5e952a9e3778c09db6befd48712786092e939261 (diff) |
Merge pull request #1871 from abergmeier/fixup_eglSwapBuffers
Fix eglSwapBuffers
-rw-r--r-- | src/library_egl.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/library_egl.js b/src/library_egl.js index 69dd266d..e2d1df43 100644 --- a/src/library_egl.js +++ b/src/library_egl.js @@ -550,7 +550,21 @@ var LibraryEGL = { // EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); eglSwapBuffers: function() { - EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); + if (!EGL.defaultDisplayInitialized) { + EGL.setErrorCode(0x3001 /* EGL_NOT_INITIALIZED */); + } else if (!Module.ctx) { + EGL.setErrorCode(0x3002 /* EGL_BAD_ACCESS */); + } else if (Module.ctx.isContextLost()) { + EGL.setErrorCode(0x300E /* EGL_CONTEXT_LOST */); + } else { + // According to documentation this does an implicit flush. + // Due to discussion at https://github.com/kripken/emscripten/pull/1871 + // the flush was removed since this _may_ result in slowing code down. + //_glFlush(); + EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); + return 1; // EGL_TRUE + } + return 0; // EGL_FALSE }, eglGetProcAddress__deps: ['emscripten_GetProcAddress'], |