aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2014-08-15 21:41:51 +0200
committerJulien Gouesse <[email protected]>2014-08-15 21:41:51 +0200
commitda7ffb486384319fcab9a5fedde0e2daeb1d2b30 (patch)
tree89f5038b9497f6a35cfc8503b2010b184e0dd64b /ardor3d-jogl
parent484c3fd153d5541c22399c60fb7dd0238e040459 (diff)
Drives the OpenGL-ES code path more robust, especially when dealing with the clips and the textures
Diffstat (limited to 'ardor3d-jogl')
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java4
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java20
2 files changed, 15 insertions, 9 deletions
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java
index dfd3c9c..b64258e 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java
@@ -73,7 +73,9 @@ public abstract class JoglClipStateUtil {
} else {
((DoubleBuffer) record.buf).put(state.getPlaneEquations(planeIndex));
record.buf.flip();
- gl.getGL2().glClipPlane(GL2ES1.GL_CLIP_PLANE0 + planeIndex, (DoubleBuffer) record.buf);
+ if (gl.isGL2()) {
+ gl.getGL2().glClipPlane(GL2ES1.GL_CLIP_PLANE0 + planeIndex, (DoubleBuffer) record.buf);
+ }
}
} else {
// TODO use this suggestion but take into account the good reference frame:
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java
index 63031ab..61beeaf 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java
@@ -1163,13 +1163,17 @@ public class JoglTextureStateUtil {
record.tmp_matrixBuffer.rewind();
texture.getTextureMatrix().toDoubleBuffer(record.tmp_matrixBuffer, true);
record.tmp_matrixBuffer.rewind();
- gl.getGL2().glLoadMatrixd(record.tmp_matrixBuffer);
-
+ if (gl.isGL2()) {
+ gl.getGL2().glLoadMatrixd(record.tmp_matrixBuffer);
+ }
+ // FIXME use JoglRendererRecord.getMaxtrixBackend() with float buffers, stop using doubles
record.units[unit].identityMatrix = false;
} else if (needsReset) {
checkAndSetUnit(unit, record, caps);
JoglRendererUtil.switchMode(matRecord, GL.GL_TEXTURE);
- gl.getGL2().glLoadIdentity();
+ if (gl.isGL2()) {
+ gl.getGL2().glLoadIdentity();
+ }
record.units[unit].identityMatrix = true;
}
// Switch back to the modelview matrix for further operations
@@ -1190,10 +1194,10 @@ public class JoglTextureStateUtil {
if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_SPHERE_MAP) {
checkAndSetUnit(unit, record, caps);
- gl.getGL2().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP);
+ gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP);
unitRecord.textureGenSMode = GL2.GL_SPHERE_MAP;
- gl.getGL2().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP);
+ gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP);
unitRecord.textureGenTMode = GL2.GL_SPHERE_MAP;
}
@@ -1203,13 +1207,13 @@ public class JoglTextureStateUtil {
// generate normals based texture coordinates
if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2ES1.GL_NORMAL_MAP) {
checkAndSetUnit(unit, record, caps);
- gl.getGL2().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP);
+ gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP);
unitRecord.textureGenSMode = GL2ES1.GL_NORMAL_MAP;
- gl.getGL2().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP);
+ gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP);
unitRecord.textureGenTMode = GL2ES1.GL_NORMAL_MAP;
- gl.getGL2().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP);
+ gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP);
unitRecord.textureGenRMode = GL2ES1.GL_NORMAL_MAP;
}