From 014d319c11b3795d3c6fd5956c6a686fae93c4c3 Mon Sep 17 00:00:00 2001 From: shadowislord Date: Fri, 23 Jan 2015 22:42:42 -0500 Subject: [PATCH] * Support desktop GL tracing in GLTracer --- .../com/jme3/renderer/opengl/GLTracer.java | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) 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 4127ca803..63bf90b5d 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 @@ -47,7 +47,6 @@ import java.util.HashMap; */ public final class GLTracer implements InvocationHandler { - private final GL gl; private final Object obj; private final IntMap constMap; private static final HashMap> nonEnumArgMap = new HashMap>(); @@ -70,6 +69,9 @@ public final class GLTracer implements InvocationHandler { noEnumArgs("glPixelStorei", 1); // noEnumArgs("glTexParameteri", 2); noEnumArgs("glTexImage2D", 1, 3, 4, 5); + noEnumArgs("glTexImage3D", 1, 3, 4, 5, 6); + noEnumArgs("glTexSubImage3D", 1, 2, 3, 4, 5, 6, 7); + noEnumArgs("glCompressedTexSubImage3D", 1, 2, 3, 4, 5, 6, 7); noEnumArgs("glDeleteTextures", 0); noEnumArgs("glBindBuffer", 1); @@ -107,8 +109,7 @@ public final class GLTracer implements InvocationHandler { noEnumArgs("glDeleteProgram", 0); } - public GLTracer(GL gl, Object obj, IntMap constMap) { - this.gl = gl; + public GLTracer(Object obj, IntMap constMap) { this.obj = obj; this.constMap = constMap; } @@ -134,29 +135,29 @@ public final class GLTracer implements InvocationHandler { /** * Creates a tracer implementation that wraps OpenGL ES 2. * - * @param gl OGL interface - * @param glext OGL extension interface - * @return A tracer that implements GL, GLFbo, and GLExt. + * @param glInterface OGL object to wrap + * @param glInterfaceClass The interface to implement + * @return A tracer that implements the given interface */ - public static GL createGlesTracer(GL gl, GLExt glext) { + public static Object createGlesTracer(Object glInterface, Class glInterfaceClass) { IntMap constMap = generateConstantMap(GL.class, GLExt.class); - return (GL) Proxy.newProxyInstance(glext.getClass().getClassLoader(), - new Class[] { GL.class, GLExt.class }, - new GLTracer(gl, glext, constMap)); + return Proxy.newProxyInstance(glInterface.getClass().getClassLoader(), + new Class[] { glInterfaceClass }, + new GLTracer(glInterface, constMap)); } /** * Creates a tracer implementation that wraps OpenGL 2+. * - * @param gl OGL interface - * @param glext OGL extension interface - * @return A tracer that implements GL, GL2, GL3, GLFbo, and GLExt. + * @param glInterface OGL object to wrap + * @param glInterfaceClass The interface to implement + * @return A tracer that implements the given interface */ - public static GL createDesktopGlTracer(GL3 gl, GLExt glext) { - IntMap constMap = generateConstantMap(GL3.class, GLExt.class); - return (GL) Proxy.newProxyInstance(glext.getClass().getClassLoader(), - new Class[] { GL3.class, GLExt.class }, - new GLTracer(gl, glext, constMap)); + public static Object createDesktopGlTracer(Object glInterface, Class glInterfaceClass) { + IntMap constMap = generateConstantMap(GL2.class, GLExt.class); + return Proxy.newProxyInstance(glInterface.getClass().getClassLoader(), + new Class[] { glInterfaceClass }, + new GLTracer(glInterface, constMap)); } private String translateInteger(String method, int value, int argIndex) {