diff options
4 files changed, 35 insertions, 5 deletions
diff --git a/src/net/java/joglutils/msg/elements/GLModelMatrixElement.java b/src/net/java/joglutils/msg/elements/GLModelMatrixElement.java index 24097bc..a63f8ae 100644 --- a/src/net/java/joglutils/msg/elements/GLModelMatrixElement.java +++ b/src/net/java/joglutils/msg/elements/GLModelMatrixElement.java @@ -86,12 +86,24 @@ public class GLModelMatrixElement extends ModelMatrixElement { // Recompute the complete modelview matrix Mat4f mat = ViewingMatrixElement.getInstance(state).getMatrix(); GL gl = GLU.getCurrentGL(); - gl.glLoadTransposeMatrixf(mat.getRowMajorData(), 0); + if (gl.isExtensionAvailable("GL_VERSION_1_3")) { + gl.glLoadTransposeMatrixf(mat.getRowMajorData(), 0); + } else { + float[] tmp = new float[16]; + mat.getColumnMajorData(tmp); + gl.glLoadMatrixf(tmp, 0); + } } public void multElt(Mat4f matrix) { super.multElt(matrix); GL gl = GLU.getCurrentGL(); - gl.glMultTransposeMatrixf(matrix.getRowMajorData(), 0); + if (gl.isExtensionAvailable("GL_VERSION_1_3")) { + gl.glMultTransposeMatrixf(matrix.getRowMajorData(), 0); + } else { + float[] tmp = new float[16]; + matrix.getColumnMajorData(tmp); + gl.glMultMatrixf(tmp, 0); + } } } diff --git a/src/net/java/joglutils/msg/elements/GLProjectionMatrixElement.java b/src/net/java/joglutils/msg/elements/GLProjectionMatrixElement.java index 6c8d7d2..3dfad8f 100644 --- a/src/net/java/joglutils/msg/elements/GLProjectionMatrixElement.java +++ b/src/net/java/joglutils/msg/elements/GLProjectionMatrixElement.java @@ -69,7 +69,13 @@ public class GLProjectionMatrixElement extends ProjectionMatrixElement { super.setElt(matrix); GL gl = GLU.getCurrentGL(); gl.glMatrixMode(GL.GL_PROJECTION); - gl.glLoadTransposeMatrixf(matrix.getRowMajorData(), 0); + if (gl.isExtensionAvailable("GL_VERSION_1_3")) { + gl.glLoadTransposeMatrixf(matrix.getRowMajorData(), 0); + } else { + float[] tmp = new float[16]; + matrix.getColumnMajorData(tmp); + gl.glLoadMatrixf(tmp, 0); + } gl.glMatrixMode(GL.GL_MODELVIEW); } } diff --git a/src/net/java/joglutils/msg/elements/GLViewingMatrixElement.java b/src/net/java/joglutils/msg/elements/GLViewingMatrixElement.java index 5848413..a24f53f 100644 --- a/src/net/java/joglutils/msg/elements/GLViewingMatrixElement.java +++ b/src/net/java/joglutils/msg/elements/GLViewingMatrixElement.java @@ -76,6 +76,12 @@ public class GLViewingMatrixElement extends ViewingMatrixElement { Mat4f mdl = ModelMatrixElement.getInstance(state).getMatrix(); temp.mul(matrix, mdl); GL gl = GLU.getCurrentGL(); - gl.glLoadTransposeMatrixf(temp.getRowMajorData(), 0); + if (gl.isExtensionAvailable("GL_VERSION_1_3")) { + gl.glLoadTransposeMatrixf(temp.getRowMajorData(), 0); + } else { + float[] tmp = new float[16]; + temp.getColumnMajorData(tmp); + gl.glLoadMatrixf(tmp, 0); + } } } diff --git a/src/net/java/joglutils/msg/nodes/TriangleSet.java b/src/net/java/joglutils/msg/nodes/TriangleSet.java index d7c55bb..ffa0ea3 100644 --- a/src/net/java/joglutils/msg/nodes/TriangleSet.java +++ b/src/net/java/joglutils/msg/nodes/TriangleSet.java @@ -92,7 +92,13 @@ public class TriangleSet extends TriangleBasedShape { // portion of the texture image gl.glMatrixMode(GL.GL_TEXTURE); gl.glPushMatrix(); - gl.glLoadTransposeMatrixf(getTextureMatrix(tex).getRowMajorData(), 0); + if (gl.isExtensionAvailable("GL_VERSION_1_3")) { + gl.glLoadTransposeMatrixf(getTextureMatrix(tex).getRowMajorData(), 0); + } else { + float[] tmp = new float[16]; + getTextureMatrix(tex).getColumnMajorData(tmp); + gl.glLoadMatrixf(tmp, 0); + } gl.glMatrixMode(GL.GL_MODELVIEW); } else if (haveTexCoords) { // Want to turn off the use of texture coordinates to avoid errors |