diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-06-12 16:01:03 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-06-12 16:01:03 -0700 |
commit | 67c05b0b515907ac9b08a1e10904da450320714f (patch) | |
tree | 1616e85c1831c37100c7d0794ad56e3acd3b0803 | |
parent | 165c05e98c047c4ba9679c287ead18d211f68696 (diff) |
serialize typed arrays properly
-rw-r--r-- | src/webGLWorker.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/webGLWorker.js b/src/webGLWorker.js index adb6142e..37b844b6 100644 --- a/src/webGLWorker.js +++ b/src/webGLWorker.js @@ -571,10 +571,10 @@ function WebGLWorker() { commandBuffer.push('useProgram', 1, program.id); }; this.uniform4fv = function(location, data) { - commandBuffer.push('uniform4fv', 2, location.id, data); + commandBuffer.push('uniform4fv', 2, location.id, new Float32Array(data)); }; this.uniformMatrix4fv = function(location, transpose, data) { - commandBuffer.push('uniformMatrix4fv', 3, location.id, transpose, data); + commandBuffer.push('uniformMatrix4fv', 3, location.id, transpose, new Float32Array(data)); }; this.createBuffer = function() { var id = nextId++; @@ -585,6 +585,7 @@ function WebGLWorker() { commandBuffer.push('bindBuffer', 2, target, buffer.id); }; this.bufferData = function(target, something, usage) { + if (typeof something !== 'number') something = new Uint8Array(something); commandBuffer.push('bufferData', 3, target, something, usage); }; this.viewport = function(x, y, w, h) { |