From 99230cc04b6d0143088129ccc1a20d5c8799ca67 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Mon, 9 Jun 2014 16:42:33 +0200
Subject: GraphUI: Fix using multiple texture units w/ opt. colorTexUnit in
 GLRegion

The texture unit has to be updated always,
since program maybe used by multiple regions and diff. texUnits
---
 .../classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java    | 7 ++-----
 .../classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java    | 7 ++-----
 src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java   | 9 +++------
 3 files changed, 7 insertions(+), 16 deletions(-)

(limited to 'src/jogl/classes/jogamp/graph/curve/opengl')

diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index d870644f3..a9aa8cfb0 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -515,11 +515,8 @@ public class VBORegion2PMSAAES2  extends GLRegion {
             final Texture tex = frame.getTexture();
             tex.bind(gl);
             tex.enable(gl); // nop on core
-            final int colorTexUnit = colorTexSeq.getTextureUnit();
-            if( colorTexUnit != gcu_ColorTexUnit.intValue() ) {
-                gcu_ColorTexUnit.setData(colorTexUnit);
-                gl.glUniform(gcu_ColorTexUnit);
-            }
+            gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit());
+            gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions
             gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions
             gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
             tex.disable(gl); // nop on core
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index cea292210..68a7b6dbd 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -634,11 +634,8 @@ public class VBORegion2PVBAAES2  extends GLRegion {
             final Texture tex = frame.getTexture();
             tex.bind(gl);
             tex.enable(gl); // nop on core
-            final int colorTexUnit = colorTexSeq.getTextureUnit();
-            if( colorTexUnit != gcu_ColorTexUnit.intValue() ) {
-                gcu_ColorTexUnit.setData(colorTexUnit);
-                gl.glUniform(gcu_ColorTexUnit);
-            }
+            gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit());
+            gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions
             gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions
             gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
             tex.disable(gl); // nop on core
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 24d53c1a2..8265b014a 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -241,12 +241,9 @@ public class VBORegionSPES2 extends GLRegion {
             final Texture tex = frame.getTexture();
             tex.bind(gl);
             tex.enable(gl); // nop on core
-            final int colorTexUnit = colorTexSeq.getTextureUnit();
-            if( colorTexUnit != gcu_ColorTexUnit.intValue() ) {
-                gcu_ColorTexUnit.setData(colorTexUnit);
-                gl.glUniform(gcu_ColorTexUnit);
-            }
-            gl.glUniform(gcu_ColorTexBBox); // FIXME: Only if changed!
+            gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit());
+            gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions
+            gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions
             gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
             tex.disable(gl); // nop on core
         } else {
-- 
cgit v1.2.3