diff options
author | juj <jujjyl@gmail.com> | 2013-12-20 01:21:50 -0800 |
---|---|---|
committer | juj <jujjyl@gmail.com> | 2013-12-20 01:21:50 -0800 |
commit | 0025736920d7f388929d606340e744f53a9dc1a4 (patch) | |
tree | 50df520113abf24767558e8dbff2e775cb378afa /src | |
parent | 4efa4270a220da968cd039d724c96a091387b2b9 (diff) | |
parent | c1f5a5b30a53f22e495de4313c81496431b2e759 (diff) |
Merge pull request #1934 from juj/eglCreateContext
eglCreateContext.
Diffstat (limited to 'src')
-rw-r--r-- | src/library_egl.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/library_egl.js b/src/library_egl.js index 73d5e544..11cf8951 100644 --- a/src/library_egl.js +++ b/src/library_egl.js @@ -264,6 +264,26 @@ var LibraryEGL = { return 0; } + // EGL 1.4 spec says default EGL_CONTEXT_CLIENT_VERSION is GLES1, but this is not supported by Emscripten. + // So user must pass EGL_CONTEXT_CLIENT_VERSION == 2 to initialize EGL. + var glesContextVersion = 1; + for(;;) { + var param = {{{ makeGetValue('contextAttribs', '0', 'i32') }}}; + if (!param) break; + var value = {{{ makeGetValue('contextAttribs', '4', 'i32') }}}; + if (param == 0x3098 /*EGL_CONTEXT_CLIENT_VERSION*/) { + glesContextVersion = value; + } + contextAttribs += 8; + } + if (glesContextVersion != 2) { +#if GL_ASSERTIONS + Module.printErr('When initializing GLES2/WebGL1 via EGL, one must pass EGL_CONTEXT_CLIENT_VERSION = 2 to GL context attributes! GLES version ' + glesContextVersion + ' is not supported!'); +#endif + EGL.setErrorCode(0x3005 /* EGL_BAD_CONFIG */); + return 0; /* EGL_NO_CONTEXT */ + } + _glutInitDisplayMode(0x92 /* GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE */); EGL.windowID = _glutCreateWindow(); if (EGL.windowID != 0) { |