/** Called before each primitive to update the current color. */ public void prepare(int tex, int tint, boolean justActivated) { ctx.checkGLError("textureShader.prepare start"); boolean stateChanged = (tex != lastTex); if (!justActivated && stateChanged) { GLShader.this.flush(); ctx.checkGLError("textureShader.prepare flush"); } if (stateChanged) { lastTex = tex; ctx.checkGLError("textureShader.prepare end"); } if (justActivated) { ctx.activeTexture(GL20.GL_TEXTURE0); uTexture.bind(0); } }