diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-01-31 21:26:47 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-01-31 21:26:47 +0200 |
commit | 40ca8f65b04a7b8128a82e90c2f3cef0c60a0656 (patch) | |
tree | 6c291a0e7c3b3e9c5b43c7dbcf6e8e55865be624 | |
parent | 7b129450d48a3552dc8189d96ef695db8cc9c15b (diff) |
Implemented eglTerminate and eglDestroyContext.
-rw-r--r-- | src/library_egl.js | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/library_egl.js b/src/library_egl.js index 1c35ddf4..a9eb37dd 100644 --- a/src/library_egl.js +++ b/src/library_egl.js @@ -71,6 +71,17 @@ var LibraryEGL = { return 0; } }, + + // EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); + eglTerminate: function(display) { + if (display != 62000 /* Magic ID for Emscripten 'default display' */) { + EGL.setErrorCode(0x3008 /* EGL_BAD_DISPLAY */); + return 0; + } + // TODO: Tear down EGL here. Currently a no-op since we don't need to actually do anything here for the browser. + EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); + return 1; + }, // EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); eglGetConfigs: function(display, configs, config_size, numConfigs) { @@ -228,6 +239,22 @@ var LibraryEGL = { return 62004; // Magic ID for Emscripten EGLContext }, + // EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); + eglDestroyContext: function(display, context) { + if (display != 62000 /* Magic ID for Emscripten 'default display' */) { + EGL.setErrorCode(0x3008 /* EGL_BAD_DISPLAY */); + return 0; + } + + if (context != 62004 /* Magic ID for Emscripten EGLContext */) { + EGL.setErrorCode(0x3006 /* EGL_BAD_CONTEXT */); + return 0; + } + + EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); + return 1; + }, + // EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); eglQuerySurface: function(display, surface, attribute, value) { if (display != 62000 /* Magic ID for Emscripten 'default display' */) { @@ -336,6 +363,7 @@ var LibraryEGL = { return EGL.eglErrorCode; }, + // EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); eglQueryString: function(display, name) { if (display != 62000 /* Magic ID for Emscripten 'default display' */) { EGL.setErrorCode(0x3008 /* EGL_BAD_DISPLAY */); @@ -412,7 +440,8 @@ var LibraryEGL = { EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); return 1; }, - + + // EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); eglSwapBuffers: function() { EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); }, |