diff --git a/core/src/processing/opengl/PShader.java b/core/src/processing/opengl/PShader.java index 2abc47647..81e561123 100644 --- a/core/src/processing/opengl/PShader.java +++ b/core/src/processing/opengl/PShader.java @@ -79,8 +79,6 @@ public class PShader { protected HashMap textures; protected HashMap texUnits; -// protected int firstTexUnit; - protected int lastTexUnit; // Direct buffers to pass shader data to GL protected IntBuffer intBuffer; @@ -554,7 +552,7 @@ public class PShader { protected void consumeUniforms() { if (uniformValues != null && 0 < uniformValues.size()) { - lastTexUnit = 0; //firstTexUnit; + int unit = 0; for (Integer loc: uniformValues.keySet()) { UniformValue val = uniformValues.get(loc); if (val.type == UniformValue.INT1) { @@ -634,13 +632,13 @@ public class PShader { if (texUnits == null) texUnits = new HashMap(); if (texUnits.containsKey(loc)) { - lastTexUnit = texUnits.get(loc); - pgl.uniform1i(loc, lastTexUnit); + unit = texUnits.get(loc); + pgl.uniform1i(loc, unit); } else { - texUnits.put(loc, lastTexUnit); - pgl.uniform1i(loc, lastTexUnit); + texUnits.put(loc, unit); + pgl.uniform1i(loc, unit); } - lastTexUnit++; + unit++; } } uniformValues.clear();