Example #1
0
    @Override
    public void prepare(Object texObj, float alpha, int fbufWidth, int fbufHeight) {
      ctx.checkGLError("textureShader.prepare start");
      boolean wasntAlreadyActive = super.prepare(fbufWidth, fbufHeight);
      if (wasntAlreadyActive) {
        glActiveTexture(GL_TEXTURE0);
        glUniform1i(uTexture, 0);
      }

      int tex = (Integer) texObj;
      if (wasntAlreadyActive || tex != lastTex || alpha != lastAlpha) {
        flush();
        glUniform1f(uAlpha, alpha);
        lastAlpha = alpha;
        lastTex = tex;
        ctx.checkGLError("textureShader.prepare end");
      }
    }