Skip to content

Commit 4d16f21

Browse files
committed
re-init uniforms if setShader
1 parent 2c4d0d9 commit 4d16f21

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/gameobjects/shader/Shader.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,6 @@ var Shader = new Class({
285285

286286
this.setShader(fragSource, vertSource);
287287

288-
this.initUniforms();
289-
290288
this.projOrtho(0, renderer.width, renderer.height, 0);
291289
},
292290

@@ -311,6 +309,8 @@ var Shader = new Class({
311309
this.fragSource = fragSource;
312310
this.vertSource = vertSource;
313311

312+
this.initUniforms();
313+
314314
return this;
315315
},
316316

@@ -369,8 +369,6 @@ var Shader = new Class({
369369
var type = uniform.type;
370370
var data = map[type];
371371

372-
uniform.uniformLocation = gl.getUniformLocation(program, key);
373-
374372
if (type === 'sampler2D')
375373
{
376374
// this.initSampler2D(uniform);
@@ -380,6 +378,7 @@ var Shader = new Class({
380378
uniform.glMatrix = data.matrix;
381379
uniform.glValueLength = data.length;
382380
uniform.glFunc = data.func;
381+
uniform.uniformLocation = gl.getUniformLocation(program, key);
383382
}
384383
}
385384
},

0 commit comments

Comments
 (0)