From af3a0c70ce4fd94d930b9b5b06f6398235456519 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Sat, 9 Sep 2017 13:16:21 -0400 Subject: [PATCH] Move glFramebufferTextureLayer to GLFbo --- .../src/main/java/com/jme3/renderer/android/AndroidGL.java | 5 +++++ jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java | 1 - .../main/java/com/jme3/renderer/opengl/GLDebugDesktop.java | 6 ------ .../src/main/java/com/jme3/renderer/opengl/GLDebugES.java | 7 +++++++ .../src/main/java/com/jme3/renderer/opengl/GLFbo.java | 1 + .../src/main/java/com/jme3/renderer/opengl/GLRenderer.java | 2 +- .../src/main/java/com/jme3/renderer/opengl/GLTracer.java | 1 + jme3-ios/src/main/java/com/jme3/renderer/ios/IosGL.java | 5 +++++ jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGL.java | 6 ------ .../src/main/java/com/jme3/renderer/jogl/JoglGLFbo.java | 5 +++++ .../src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java | 5 ----- .../main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java | 6 ++++++ .../main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java | 5 +++++ .../src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java | 7 ------- .../main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java | 6 ++++++ .../main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java | 5 +++++ 16 files changed, 47 insertions(+), 26 deletions(-) diff --git a/jme3-android/src/main/java/com/jme3/renderer/android/AndroidGL.java b/jme3-android/src/main/java/com/jme3/renderer/android/AndroidGL.java index 3541eaa63..44e931104 100644 --- a/jme3-android/src/main/java/com/jme3/renderer/android/AndroidGL.java +++ b/jme3-android/src/main/java/com/jme3/renderer/android/AndroidGL.java @@ -561,4 +561,9 @@ public class AndroidGL implements GL, GLExt, GLFbo { public void glBlendEquationSeparate(int colorMode, int alphaMode) { GLES20.glBlendEquationSeparate(colorMode, alphaMode); } + + @Override + public void glFramebufferTextureLayerEXT(int target, int attachment, int texture, int level, int layer) { + throw new UnsupportedOperationException("OpenGL ES 2 does not support texture arrays"); + } } diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java index 9b01e46a5..b3e112545 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java @@ -86,7 +86,6 @@ public interface GL3 extends GL2 { public void glBindFragDataLocation(int param1, int param2, String param3); /// GL3+ public void glBindVertexArray(int param1); /// GL3+ public void glDeleteVertexArrays(IntBuffer arrays); /// GL3+ - public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5); /// GL3+ public void glGenVertexArrays(IntBuffer param1); /// GL3+ public String glGetString(int param1, int param2); /// GL3+ } diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLDebugDesktop.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLDebugDesktop.java index 44dc3687a..a945a1d85 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLDebugDesktop.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLDebugDesktop.java @@ -95,12 +95,6 @@ public class GLDebugDesktop extends GLDebugES implements GL2, GL3, GL4 { checkError(); } - @Override - public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) { - gl3.glFramebufferTextureLayer(param1, param2, param3, param4, param5); - checkError(); - } - public void glBlendEquationSeparate(int colorMode, int alphaMode) { gl.glBlendEquationSeparate(colorMode, alphaMode); checkError(); diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLDebugES.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLDebugES.java index 412d738f5..8746d57ed 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLDebugES.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLDebugES.java @@ -598,8 +598,15 @@ public class GLDebugES extends GLDebug implements GL, GLFbo, GLExt { return sync; } + @Override public void glBlendEquationSeparate(int colorMode, int alphaMode) { gl.glBlendEquationSeparate(colorMode, alphaMode); checkError(); } + + @Override + public void glFramebufferTextureLayerEXT(int param1, int param2, int param3, int param4, int param5) { + glfbo.glFramebufferTextureLayerEXT(param1, param2, param3, param4, param5); + checkError(); + } } diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLFbo.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLFbo.java index 737019ce2..97a579203 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLFbo.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLFbo.java @@ -89,6 +89,7 @@ public interface GLFbo { public void glDeleteRenderbuffersEXT(IntBuffer param1); public void glFramebufferRenderbufferEXT(int param1, int param2, int param3, int param4); public void glFramebufferTexture2DEXT(int param1, int param2, int param3, int param4, int param5); + public void glFramebufferTextureLayerEXT(int target, int attachment, int texture, int level, int layer); public void glGenFramebuffersEXT(IntBuffer param1); public void glGenRenderbuffersEXT(IntBuffer param1); public void glGenerateMipmapEXT(int param1); 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 97c6af85e..902ef3842 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 @@ -1581,7 +1581,7 @@ public final class GLRenderer implements Renderer { image.getId(), 0); } else { - gl3.glFramebufferTextureLayer(GLFbo.GL_FRAMEBUFFER_EXT, + glfbo.glFramebufferTextureLayerEXT(GLFbo.GL_FRAMEBUFFER_EXT, convertAttachmentSlot(rb.getSlot()), image.getId(), 0, 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 3bfad2c06..ae3f17a8c 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 @@ -112,6 +112,7 @@ public final class GLTracer implements InvocationHandler { noEnumArgs("glRenderbufferStorageMultisampleEXT", 1, 3, 4); noEnumArgs("glFramebufferRenderbufferEXT", 3); noEnumArgs("glFramebufferTexture2DEXT", 3, 4); + noEnumArgs("glFramebufferTextureLayerEXT", 2, 3, 4); noEnumArgs("glBlitFramebufferEXT", 0, 1, 2, 3, 4, 5, 6, 7, 8); noEnumArgs("glCreateProgram", -1); diff --git a/jme3-ios/src/main/java/com/jme3/renderer/ios/IosGL.java b/jme3-ios/src/main/java/com/jme3/renderer/ios/IosGL.java index 95e8a213b..826ce82a2 100644 --- a/jme3-ios/src/main/java/com/jme3/renderer/ios/IosGL.java +++ b/jme3-ios/src/main/java/com/jme3/renderer/ios/IosGL.java @@ -611,4 +611,9 @@ public class IosGL implements GL, GLExt, GLFbo { public Object glFenceSync(int condition, int flags) { throw new UnsupportedOperationException("OpenGL ES 2 does not support sync fences"); } + + @Override + public void glFramebufferTextureLayerEXT(int target, int attachment, int texture, int level, int layer) { + throw new UnsupportedOperationException("OpenGL ES 2 does not support texture arrays"); + } } diff --git a/jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGL.java b/jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGL.java index e927b4bb7..e6435e5c5 100644 --- a/jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGL.java +++ b/jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGL.java @@ -634,10 +634,4 @@ public class JoglGL implements GL, GL2, GL3, GL4 { checkLimit(arrays); GLContext.getCurrentGL().getGL2ES3().glDeleteVertexArrays(arrays.limit(), arrays); } - - @Override - public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) { - GLContext.getCurrentGL().getGL3().glFramebufferTextureLayer(param1, param2, param3, param4, param5); - } - } diff --git a/jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGLFbo.java b/jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGLFbo.java index 2691d2e24..b3451be25 100644 --- a/jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGLFbo.java +++ b/jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGLFbo.java @@ -94,4 +94,9 @@ public class JoglGLFbo implements GLFbo { public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) { GLContext.getCurrentGL().glRenderbufferStorage(param1, param2, param3, param4); } + + @Override + public void glFramebufferTextureLayerEXT(int param1, int param2, int param3, int param4, int param5) { + GLContext.getCurrentGL().getGL3().glFramebufferTextureLayer(param1, param2, param3, param4, param5); + } } diff --git a/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java b/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java index c2694988c..5a74e06f0 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java +++ b/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java @@ -493,9 +493,4 @@ public final class LwjglGL implements GL, GL2, GL3, GL4 { checkLimit(arrays); ARBVertexArrayObject.glDeleteVertexArrays(arrays); } - - @Override - public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) { - GL30.glFramebufferTextureLayer(param1, param2, param3, param4, param5); - } } diff --git a/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java b/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java index 40571f5ed..8f746b4d4 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java +++ b/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java @@ -7,6 +7,7 @@ import java.nio.IntBuffer; import org.lwjgl.opengl.EXTFramebufferBlit; import org.lwjgl.opengl.EXTFramebufferMultisample; import org.lwjgl.opengl.EXTFramebufferObject; +import org.lwjgl.opengl.EXTTextureArray; /** * Implements GLFbo via GL_EXT_framebuffer_object. @@ -95,4 +96,9 @@ public final class LwjglGLFboEXT implements GLFbo { public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) { EXTFramebufferObject.glRenderbufferStorageEXT(param1, param2, param3, param4); } + + @Override + public void glFramebufferTextureLayerEXT(int target, int attachment, int texture, int level, int layer) { + EXTTextureArray.glFramebufferTextureLayerEXT(target, attachment, texture, level, layer); + } } diff --git a/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java b/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java index 14e0cc9e6..bec41d17f 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java +++ b/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java @@ -93,4 +93,9 @@ public final class LwjglGLFboGL3 implements GLFbo { public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) { GL30.glRenderbufferStorage(param1, param2, param3, param4); } + + @Override + public void glFramebufferTextureLayerEXT(int param1, int param2, int param3, int param4, int param5) { + GL30.glFramebufferTextureLayer(param1, param2, param3, param4, param5); + } } diff --git a/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java b/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java index a905c9f01..915b185d1 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java @@ -36,8 +36,6 @@ import com.jme3.renderer.opengl.GL; import com.jme3.renderer.opengl.GL2; import com.jme3.renderer.opengl.GL3; import com.jme3.renderer.opengl.GL4; -import com.jme3.system.NativeLibraryLoader; -import com.jme3.system.Platform; import org.lwjgl.opengl.*; import java.nio.*; @@ -519,9 +517,4 @@ public class LwjglGL implements GL, GL2, GL3, GL4 { checkLimit(arrays); ARBVertexArrayObject.glDeleteVertexArrays(arrays); } - - @Override - public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) { - GL30.glFramebufferTextureLayer(param1, param2, param3, param4, param5); - } } diff --git a/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java b/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java index 5d9fe8dc1..ce2ebe806 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboEXT.java @@ -39,6 +39,7 @@ import org.lwjgl.opengl.EXTFramebufferObject; import java.nio.Buffer; import java.nio.IntBuffer; +import org.lwjgl.opengl.EXTTextureArray; /** * Implements GLFbo via GL_EXT_framebuffer_object. @@ -127,4 +128,9 @@ public class LwjglGLFboEXT implements GLFbo { public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) { EXTFramebufferObject.glRenderbufferStorageEXT(param1, param2, param3, param4); } + + @Override + public void glFramebufferTextureLayerEXT(int target, int attachment, int texture, int level, int layer) { + EXTTextureArray.glFramebufferTextureLayerEXT(target, attachment, texture, level, layer); + } } diff --git a/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java b/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java index 5a7a9825e..39ed0a647 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/renderer/lwjgl/LwjglGLFboGL3.java @@ -125,4 +125,9 @@ public class LwjglGLFboGL3 implements GLFbo { public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) { GL30.glRenderbufferStorage(param1, param2, param3, param4); } + + @Override + public void glFramebufferTextureLayerEXT(int param1, int param2, int param3, int param4, int param5) { + GL30.glFramebufferTextureLayer(param1, param2, param3, param4, param5); + } }