From 259694605e03fc323aef45570d58fc27c7b14f77 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Sat, 9 Sep 2017 13:07:08 -0400 Subject: [PATCH] Support GLTracer and GL debug in Android --- .../com/jme3/system/android/OGLESContext.java | 10 ++++++++-- .../java/com/jme3/renderer/opengl/GLTracer.java | 15 ++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java b/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java index 35c3c3911..508e81065 100644 --- a/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java +++ b/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java @@ -53,9 +53,11 @@ import com.jme3.input.dummy.DummyKeyInput; import com.jme3.input.dummy.DummyMouseInput; import com.jme3.renderer.android.AndroidGL; import com.jme3.renderer.opengl.GL; +import com.jme3.renderer.opengl.GLDebugES; import com.jme3.renderer.opengl.GLExt; import com.jme3.renderer.opengl.GLFbo; import com.jme3.renderer.opengl.GLRenderer; +import com.jme3.renderer.opengl.GLTracer; import com.jme3.system.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; @@ -195,8 +197,12 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex timer = new NanoTimer(); Object gl = new AndroidGL(); - // gl = GLTracer.createGlesTracer((GL)gl, (GLExt)gl); - // gl = new GLDebugES((GL)gl, (GLExt)gl); + if (settings.getBoolean("GraphicsDebug")) { + gl = new GLDebugES((GL) gl, (GLExt) gl, (GLFbo) gl); + } + if (settings.getBoolean("GraphicsTrace")) { + gl = GLTracer.createGlesTracer(gl, GL.class, GLFbo.class, GLExt.class); + } renderer = new GLRenderer((GL)gl, (GLExt)gl, (GLFbo)gl); renderer.initialize(); 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 f252d22dc..82d16910a 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 @@ -165,16 +165,17 @@ public final class GLTracer implements InvocationHandler { /** * Creates a tracer implementation that wraps OpenGL ES 2. - * + * * @param glInterface OGL object to wrap - * @param glInterfaceClass The interface to implement + * @param glInterfaceClasses The interface(s) to implement * @return A tracer that implements the given interface */ - public static Object createGlesTracer(Object glInterface, Class glInterfaceClass) { - IntMap constMap = generateConstantMap(GL.class, GLFbo.class, GLExt.class); - return Proxy.newProxyInstance(glInterface.getClass().getClassLoader(), - new Class[] { glInterfaceClass }, - new GLTracer(glInterface, constMap)); + public static Object createGlesTracer(Object glInterface, Class... glInterfaceClasses) { + IntMap constMap = generateConstantMap(GL.class, GL2.class, GL3.class, GLFbo.class, GLExt.class); + return Proxy.newProxyInstance( + glInterface.getClass().getClassLoader(), + glInterfaceClasses, + new GLTracer(glInterface, constMap)); } /**