Moved program uniforms

Moved program uniforms locations to the PixiShader rather than the
glProgram
This commit is contained in:
Mat Groves 2013-11-03 17:50:39 +00:00
parent f8094acb2b
commit c165b2ebbd
3 changed files with 15 additions and 15 deletions

View file

@ -3847,8 +3847,8 @@ PIXI.PixiShader.prototype.init = function()
{
// get the uniform locations..
program[key] = gl.getUniformLocation(program, key);
// program[key] =
this.uniforms[key].uniformLocation = gl.getUniformLocation(program, key);
}
@ -3868,21 +3868,21 @@ PIXI.PixiShader.prototype.syncUniforms = function()
// need to grow this!
if(type == "f")
{
gl.uniform1f(this.program[key], this.uniforms[key].value);
gl.uniform1f(this.uniforms[key].uniformLocation, this.uniforms[key].value);
}
if(type == "f2")
{
// console.log(this.program[key])
gl.uniform2f(this.program[key], this.uniforms[key].value.x, this.uniforms[key].value.y);
gl.uniform2f(this.uniforms[key].uniformLocation, this.uniforms[key].value.x, this.uniforms[key].value.y);
}
else if(type == "f4")
{
// console.log(this.uniforms[key].value)
gl.uniform4fv(this.program[key], this.uniforms[key].value);
gl.uniform4fv(this.uniforms[key].uniformLocation, this.uniforms[key].value);
}
else if(type == "mat4")
{
gl.uniformMatrix4fv(this.program[key], false, this.uniforms[key].value);
gl.uniformMatrix4fv(this.uniforms[key].uniformLocation, false, this.uniforms[key].value);
}
else if(type == "sampler2D")
{
@ -3892,7 +3892,7 @@ PIXI.PixiShader.prototype.syncUniforms = function()
gl.activeTexture(gl.TEXTURE1);
gl.bindTexture(gl.TEXTURE_2D, texture.baseTexture._glTexture);
gl.uniform1i(this.program[key], 1);
gl.uniform1i(this.uniforms[key].uniformLocation, 1);
// activate texture..
// gl.uniformMatrix4fv(this.program[key], false, this.uniforms[key].value);