From 2638938d107242359b04482e1143c1c4870f6309 Mon Sep 17 00:00:00 2001 From: Mikola Lysenko Date: Sat, 5 Sep 2015 12:21:37 -0500 Subject: [PATCH] support uniform matrix arrays --- webgl.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/webgl.js b/webgl.js index 61c06c1a..6e909be0 100644 --- a/webgl.js +++ b/webgl.js @@ -3106,7 +3106,8 @@ function makeUniforms() { } else if(!!transpose || typeof v !== 'object' || v === null || - v.length !== i*i) { + !v.length || + v.length % i*i !== 0) { setError(this, gl.INVALID_VALUE) return } @@ -3116,10 +3117,25 @@ function makeUniforms() { if(!checkLocationActive(this, location)) { return } - return native.call(this, - location._|0, - !!transpose, - new Float32Array(v)) + + var data = new Float32Array(v) + if(v.length === i*i) { + return native.call(this, + location._|0, + !!transpose, + data) + } else if(location._array) { + var arrayLocs = location._array + for(var j=0; j