diff options
author | Remi Papillie <remi.papillie@gmail.com> | 2013-10-10 22:07:29 +0200 |
---|---|---|
committer | Remi Papillie <remi.papillie@gmail.com> | 2013-10-13 12:41:28 +0200 |
commit | ad25f01ab4c2dde8017304be3c216511b07f1eaf (patch) | |
tree | e0d3fe80e8d31151b1f48a816f8d441af394db49 /src/library_sdl.js | |
parent | 53f960effd98267f951d6ce110c0b3fac61df059 (diff) |
Implemented SDL_GL_SetAttribute and SDL_GL_GetAttribute.
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r-- | src/library_sdl.js | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 27f2c0da..bc4136d4 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -43,6 +43,29 @@ var LibrarySDL = { GL: false, // Set to true if we call SDL_SetVideoMode with SDL_OPENGL, and if so, we do not create 2D canvases&contexts for blitting // Note that images loaded before SDL_SetVideoMode will not get this optimization + // all possible GL attributes, with their default value + glAttributes: { + 0: 3, /* SDL_GL_RED_SIZE */ + 1: 3, /* SDL_GL_GREEN_SIZE */ + 2: 2, /* SDL_GL_BLUE_SIZE */ + 3: 0, /* SDL_GL_ALPHA_SIZE */ + 4: 0, /* SDL_GL_BUFFER_SIZE */ + 5: 1, /* SDL_GL_DOUBLEBUFFER */ + 6: 16, /* SDL_GL_DEPTH_SIZE */ + 7: 0, /* SDL_GL_STENCIL_SIZE */ + 8: 0, /* SDL_GL_ACCUM_RED_SIZE */ + 9: 0, /* SDL_GL_ACCUM_GREEN_SIZE */ + 10: 0, /* SDL_GL_ACCUM_BLUE_SIZE */ + 11: 0, /* SDL_GL_ACCUM_ALPHA_SIZE */ + 12: 0, /* SDL_GL_STEREO */ + 13: 0, /* SDL_GL_MULTISAMPLEBUFFERS */ + 14: 0, /* SDL_GL_MULTISAMPLESAMPLES */ + 15: 1, /* SDL_GL_ACCELERATED_VISUAL */ + 16: 0, /* SDL_GL_RETAINED_BACKING */ + 17: 0, /* SDL_GL_CONTEXT_MAJOR_VERSION */ + 18: 0 /* SDL_GL_CONTEXT_MINOR_VERSION */ + }, + keyboardState: null, keyboardMap: {}, @@ -2240,7 +2263,21 @@ var LibrarySDL = { // GL SDL_GL_SetAttribute: function(attr, value) { - console.log('TODO: SDL_GL_SetAttribute'); + if (!(attr in SDL.glAttributes)) { + throw "Unknown SDL GL attribute. Please check if your SDL version is supported."; + } + + SDL.glAttributes[attr] = value; + }, + + SDL_GL_GetAttribute: function(attr, value) { + if (!(attr in SDL.glAttributes)) { + throw "Unknown SDL GL attribute. Please check if your SDL version is supported."; + } + + if (value) {{{ makeSetValue('value', '0', 'SDL.glAttributes[attr]', 'i32') }}}; + + return 0; }, SDL_GL_GetProcAddress__deps: ['emscripten_GetProcAddress'], |