aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-04-03 13:33:47 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-04-04 00:57:45 -0400
commit018c575927380ac8a21735610623d2c178aa8f19 (patch)
tree479f0bc5ee0a5a77619db38c76317227b9d9c0ed /src
parentd8d7cc8e8a1f9571ad19a131c7dafbc499065cb4 (diff)
Fix texture pixel data size issues
Diffstat (limited to 'src')
-rw-r--r--src/library_gl.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 414520e0..ad8d8720 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -223,7 +223,7 @@ var LibraryGL = {
case 0x8033 /* GL_UNSIGNED_SHORT_4_4_4_4 */:
case 0x8034 /* GL_UNSIGNED_SHORT_5_5_5_1 */:
sizePerPixel = 2;
- pixels = new Uint16Array(new ArrayBuffer(Array_copy(pixels, width*height*sizePerPixel*2)));
+ pixels = new Uint16Array(new ArrayBuffer(Array_copy(pixels, width*height*sizePerPixel)));
break;
default:
throw 'Invalid type (' + type + ') passed to glTexImage2D';
@@ -256,13 +256,13 @@ var LibraryGL = {
default:
throw 'Invalid format (' + format + ') passed to glTexSubImage2D';
}
- pixels = new Uint8Array(Array_copy(pixels, (width-xoffset+1)*(height-yoffset+1)*sizePerPixel));
+ pixels = new Uint8Array(Array_copy(pixels, width*height*sizePerPixel));
break;
case 0x8363 /* GL_UNSIGNED_SHORT_5_6_5 */:
case 0x8033 /* GL_UNSIGNED_SHORT_4_4_4_4 */:
case 0x8034 /* GL_UNSIGNED_SHORT_5_5_5_1 */:
sizePerPixel = 2;
- pixels = new Uint16Array(new ArrayBuffer(Array_copy(pixels, (width-xoffset+1)*(height-yoffset+1)*sizePerPixel*2)));
+ pixels = new Uint16Array(new ArrayBuffer(Array_copy(pixels, width*height*sizePerPixel)));
break;
default:
throw 'Invalid type (' + type + ') passed to glTexSubImage2D';