From 23700d5140c106ede658c3deec0fd0054b1c1116 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Sat, 9 Sep 2017 13:08:37 -0400 Subject: [PATCH] Don't use unsupported TEXTURE_{BASE,MAX}_LEVEL in GLES --- jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java | 2 -- jme3-core/src/main/java/com/jme3/renderer/opengl/GL2.java | 2 ++ .../main/java/com/jme3/renderer/opengl/GLRenderer.java | 8 ++++++-- .../src/main/java/com/jme3/renderer/opengl/GLTracer.java | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java index 5aa2cdb83..45e4ce715 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GL.java @@ -173,9 +173,7 @@ public interface GL { public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; - public static final int GL_TEXTURE_BASE_LEVEL = 0x813C; public static final int GL_TEXTURE_MAG_FILTER = 0x2800; - public static final int GL_TEXTURE_MAX_LEVEL = 0x813D; public static final int GL_TEXTURE_MIN_FILTER = 0x2801; public static final int GL_TEXTURE_WRAP_S = 0x2802; public static final int GL_TEXTURE_WRAP_T = 0x2803; diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GL2.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GL2.java index abf6a77d7..8f7bb2f84 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GL2.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GL2.java @@ -65,6 +65,8 @@ public interface GL2 extends GL { public static final int GL_STACK_OVERFLOW = 0x503; public static final int GL_STACK_UNDERFLOW = 0x504; public static final int GL_TEXTURE_3D = 0x806F; + public static final int GL_TEXTURE_BASE_LEVEL = 0x813C; + public static final int GL_TEXTURE_MAX_LEVEL = 0x813D; public static final int GL_POINT_SPRITE = 0x8861; public static final int GL_TEXTURE_COMPARE_FUNC = 0x884D; public static final int GL_TEXTURE_COMPARE_MODE = 0x884C; diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java index db018cc64..97c6af85e 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java @@ -2197,11 +2197,15 @@ public final class GLRenderer implements Renderer { } else if (img.hasMipmaps()) { // Image already has mipmaps, set the max level based on the // number of mipmaps we have. - gl.glTexParameteri(target, GL.GL_TEXTURE_MAX_LEVEL, img.getMipMapSizes().length - 1); + if (caps.contains(Caps.OpenGL20)) { + gl.glTexParameteri(target, GL2.GL_TEXTURE_MAX_LEVEL, img.getMipMapSizes().length - 1); + } } else { // Image does not have mipmaps and they are not required. // Specify that that the texture has no mipmaps. - gl.glTexParameteri(target, GL.GL_TEXTURE_MAX_LEVEL, 0); + if (caps.contains(Caps.OpenGL20)) { + gl.glTexParameteri(target, GL2.GL_TEXTURE_MAX_LEVEL, 0); + } } int imageSamples = img.getMultiSamples(); diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java index 003b97bef..3bfad2c06 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTracer.java @@ -366,8 +366,8 @@ public final class GLTracer implements InvocationHandler { printEnum(param); print(", "); - if (param == GL.GL_TEXTURE_BASE_LEVEL - || param == GL.GL_TEXTURE_MAX_LEVEL) { + if (param == GL2.GL_TEXTURE_BASE_LEVEL + || param == GL2.GL_TEXTURE_MAX_LEVEL) { printInt(value); } else { printEnum(value);