aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_gl.js7
-rw-r--r--src/library_sdl.js30
2 files changed, 27 insertions, 10 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index d1c21fa1..45fc8585 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -63,8 +63,15 @@ var LibraryGL = {
glBindTexture: function(target, texture) {
Module.ctxGL.bindTexture(target, GL.textures[texture]);
},
+
};
+// Ignored stubs for fixed-function pipeline. We will need to emulate this
+'begin end matrixMode loadIdentity ortho color3f texCoord2f vertex2f blendFunc pushMatrix popMatrix translatef scalef'.split(' ').forEach(function(name_) {
+ var cName = 'gl' + name_[0].toUpperCase() + name_.substr(1);
+ LibraryGL[cName] = function(){};
+});
+
// Simple pass-through functions
[[0, 'shadeModel fogi fogfv'],
[1, 'clearDepth depthFunc enable disable frontFace cullFace'],
diff --git a/src/library_sdl.js b/src/library_sdl.js
index bfeaf870..0b4d736d 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -12,7 +12,12 @@ mergeInto(Library, {
surfaces: {},
structs: {
- PixelFormat: Runtime.generateStructInfo([['void*', 'palette'], ['i8', 'BitsPerPixel'], ['i8', 'BytesPerPixel']])
+ PixelFormat: Runtime.generateStructInfo([
+ ['void*', 'palette'], ['i8', 'BitsPerPixel'], ['i8', 'BytesPerPixel'],
+ ['i8', 'Rloss'], ['i8', 'Gloss'], ['i8', 'Bloss'], ['i8', 'Aloss'],
+ ['i8', 'Rshift'], ['i8', 'Gshift'], ['i8', 'Bshift'], ['i8', 'Ashift'],
+ ['i32', 'Rmask'], ['i32', 'Gmask'], ['i32', 'Bmask'], ['i32', 'Amask'] // Docs say i8, ./include/SDL_video.h says i32...
+ ])
},
makeSurface: function(width, height, flags) {
@@ -20,17 +25,22 @@ mergeInto(Library, {
var buffer = _malloc(width*height*4);
var pixelFormat = _malloc(18*QUANTUM_SIZE);
- {{{ makeSetValue('surf+QUANTUM_SIZE*0', '0', 'flags', 'i32') }}} // SDL_Surface.flags
- {{{ makeSetValue('surf+QUANTUM_SIZE*1', '0', 'pixelFormat', 'i32') }}} // SDL_Surface.format TODO
- {{{ makeSetValue('surf+QUANTUM_SIZE*2', '0', 'width', 'i32') }}} // SDL_Surface.w
- {{{ makeSetValue('surf+QUANTUM_SIZE*3', '0', 'height', 'i32') }}} // SDL_Surface.h
- {{{ makeSetValue('surf+QUANTUM_SIZE*4', '0', 'width*4', 'i32') }}} // SDL_Surface.pitch, assuming RGBA for now,
- // since that is what ImageData gives us in browsers
- {{{ makeSetValue('surf+QUANTUM_SIZE*5', '0', 'buffer', 'i32') }}} // SDL_Surface.pixels
+ {{{ makeSetValue('surf+QUANTUM_SIZE*0', '0', 'flags', 'i32') }}} // SDL_Surface.flags
+ {{{ makeSetValue('surf+QUANTUM_SIZE*1', '0', 'pixelFormat', 'void*') }}} // SDL_Surface.format TODO
+ {{{ makeSetValue('surf+QUANTUM_SIZE*2', '0', 'width', 'i32') }}} // SDL_Surface.w
+ {{{ makeSetValue('surf+QUANTUM_SIZE*3', '0', 'height', 'i32') }}} // SDL_Surface.h
+ {{{ makeSetValue('surf+QUANTUM_SIZE*4', '0', 'width*4', 'i16') }}} // SDL_Surface.pitch, assuming RGBA for now,
+ // since that is what ImageData gives us in browsers
+ {{{ makeSetValue('surf+QUANTUM_SIZE*5', '0', 'buffer', 'void*') }}} // SDL_Surface.pixels
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.palette', '0', '0', 'i32') }}} // TODO
- {{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.BitsPerPixel', '0', '32', 'i32') }}} // TODO
- {{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.BytesPerPixel', '0', '4', 'i32') }}} // TODO
+ {{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.BitsPerPixel', '0', '32', 'i8') }}} // TODO
+ {{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.BytesPerPixel', '0', '4', 'i8') }}} // TODO
+
+ {{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.Rmask', '0', '0xff', 'i32') }}}
+ {{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.Gmask', '0', '0xff', 'i32') }}}
+ {{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.Bmask', '0', '0xff', 'i32') }}}
+ {{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.Amask', '0', '0xff', 'i32') }}}
SDL.surfaces[surf] = {
width: width,