Commits

Michael Ludwig committed bc3547f

Fix bug with FFP texture environment initialiation where the texture units would never be configured to use the COMBINE env mode.

Comments (0)

Files changed (2)

ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglFixedFunctionRenderer.java

             gl.glLightModeli(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SEPARATE_SPECULAR_COLOR);
             gl.glShadeModel(GL2.GL_SMOOTH);
 
+            for (int i = 0; i < FixedFunctionState.MAX_TEXTURES; i++) {
+                glActiveTexture(i);
+                gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_COMBINE);
+            }
+
             initialized = true;
         }
 

ferox-renderer-lwjgl/src/main/java/com/ferox/renderer/impl/lwjgl/LwjglFixedFunctionRenderer.java

 import com.ferox.renderer.impl.AbstractFixedFunctionRenderer;
 import com.ferox.renderer.impl.AbstractSurface;
 import com.ferox.renderer.impl.BufferUtil;
+import com.ferox.renderer.impl.FixedFunctionState;
 import com.ferox.renderer.impl.FixedFunctionState.ColorPurpose;
 import com.ferox.renderer.impl.FixedFunctionState.FogMode;
 import com.ferox.renderer.impl.FixedFunctionState.MatrixMode;
 
     @Override
     public void activate(AbstractSurface surface) {
+        super.activate(surface);
+
         if (!initialized) {
             // set initial state not actually tracked
             GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_DIFFUSE);
             GL11.glLightModeli(GL12.GL_LIGHT_MODEL_COLOR_CONTROL, GL12.GL_SEPARATE_SPECULAR_COLOR);
             GL11.glShadeModel(GL11.GL_SMOOTH);
 
+            for (int i = 0; i < FixedFunctionState.MAX_TEXTURES; i++) {
+                glActiveTexture(i);
+                GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL13.GL_COMBINE);
+            }
+
             initialized = true;
         }
-
-        super.activate(surface);
     }
 
     @Override