diff --git a/src/core/Shader.js b/src/core/Shader.js index 1fa984d..11857e6 100644 --- a/src/core/Shader.js +++ b/src/core/Shader.js @@ -25,9 +25,10 @@ * @param gl {WebGLRenderingContext} The current WebGL rendering context * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations. */ -var Shader = function(gl, vertexSrc, fragmentSrc) { - GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc)); +var Shader = function(gl, vertexSrc, fragmentSrc, attributeLocations) { + GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc), attributeLocations); }; Shader.prototype = Object.create(GLShader.prototype); diff --git a/src/core/Shader.js b/src/core/Shader.js index 1fa984d..11857e6 100644 --- a/src/core/Shader.js +++ b/src/core/Shader.js @@ -25,9 +25,10 @@ * @param gl {WebGLRenderingContext} The current WebGL rendering context * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations. */ -var Shader = function(gl, vertexSrc, fragmentSrc) { - GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc)); +var Shader = function(gl, vertexSrc, fragmentSrc, attributeLocations) { + GLShader.call(this, gl, checkPrecision(vertexSrc), checkPrecision(fragmentSrc), attributeLocations); }; Shader.prototype = Object.create(GLShader.prototype); diff --git a/src/core/sprites/webgl/generateMultiTextureShader.js b/src/core/sprites/webgl/generateMultiTextureShader.js index 38b06e2..4186bb3 100644 --- a/src/core/sprites/webgl/generateMultiTextureShader.js +++ b/src/core/sprites/webgl/generateMultiTextureShader.js @@ -23,7 +23,7 @@ fragmentSrc = fragmentSrc.replace(/%count%/gi, maxTextures); fragmentSrc = fragmentSrc.replace(/%forloop%/gi, generateSampleSrc(maxTextures)); - var shader = new Shader(gl, vertexSrc, fragmentSrc); + var shader = new Shader(gl, vertexSrc, fragmentSrc, {aVertexPosition:3, aColor:2, aTextureCoord:1, aTextureId:0}); var sampleValues = []; for (var i = 0; i < maxTextures; i++)