aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_gl.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 0d7d58d5..6daee6fc 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -386,7 +386,11 @@ var LibraryGL = {
throw 'Invalid type (' + type + ') passed to glTexSubImage2D';
}
var bytes = GL.computeImageSize(width, height, sizePerPixel, GL.unpackAlignment);
- pixels = {{{ makeHEAPView('U8', 'pixels', 'pixels+bytes') }}};
+ if (type == 0x1401 /* GL_UNSIGNED_BYTE */) {
+ pixels = {{{ makeHEAPView('U8', 'pixels', 'pixels+bytes') }}};
+ } else {
+ pixels = {{{ makeHEAPView('U16', 'pixels', 'pixels+bytes') }}};
+ }
} else {
pixels = null;
}