aboutsummaryrefslogtreecommitdiff
path: root/src/library_egl.js
diff options
context:
space:
mode:
authorMichael Bishop <mbtyke@gmail.com>2013-02-01 18:55:53 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-02-19 11:35:27 -0800
commit5ccadef8807c2c1bc597b6c439cfe1dff967a48a (patch)
tree23e81ad5ddcd0eed4b8c82bdaedd6c4d1b6f5651 /src/library_egl.js
parente2b70ad4e8dfcc4c75daa559bf2f643938981f24 (diff)
Added some symbol compatibility for OpenGL1.1.
Added implementations for - eglTerminate - eglDestroySurface - eglDestroyContext Stubbed out glTextEnvi
Diffstat (limited to 'src/library_egl.js')
-rw-r--r--src/library_egl.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/library_egl.js b/src/library_egl.js
index a9eb37dd..271ea29e 100644
--- a/src/library_egl.js
+++ b/src/library_egl.js
@@ -83,6 +83,17 @@ var LibraryEGL = {
return 1;
},
+// 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) {
return EGL.chooseConfig(display, 0, configs, config_size, numConfigs);
@@ -225,6 +236,20 @@ var LibraryEGL = {
return 62006; /* Magic ID for Emscripten 'default surface' */
},
+ // EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay display, EGLSurface surface);
+ eglDestroySurface: function(display, surface) {
+ if (display != 62000 /* Magic ID for Emscripten 'default display' */) {
+ EGL.setErrorCode(0x3008 /* EGL_BAD_DISPLAY */);
+ return 0;
+ }
+ if (surface != 62006 /* Magic ID for the only EGLSurface supported by Emscripten */) {
+ EGL.setErrorCode(0x300D /* EGL_BAD_SURFACE */);
+ return 1;
+ }
+ EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
+ return 1; /* Magic ID for Emscripten 'default surface' */
+ },
+
eglCreateContext__deps: ['glutCreateWindow', '$GL'],
// EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
@@ -234,7 +259,21 @@ var LibraryEGL = {
return 0;
}
- _glutCreateWindow();
+ EGL.windowID = _glutCreateWindow();
+ EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
+ return 62004; // Magic ID for Emscripten EGLContext
+ },
+
+ eglDestroyContext__deps: ['glutDestroyWindow', '$GL'],
+
+ // EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext context);
+ eglDestroyContext: function(display, context) {
+ if (display != 62000 /* Magic ID for Emscripten 'default display' */) {
+ EGL.setErrorCode(0x3008 /* EGL_BAD_DISPLAY */);
+ return 0;
+ }
+
+ _glutDestroyWindow(EGL.windowID);
EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
return 62004; // Magic ID for Emscripten EGLContext
},