aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java1
-rw-r--r--src/jogl/classes/javax/media/opengl/GLPipelineFactory.java29
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java14
4 files changed, 36 insertions, 20 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 47a453484..a3aa369dd 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -428,6 +428,7 @@ public abstract class GLContext {
public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); }
public final boolean isGLCoreProfile() { return ( 0 != ( CTX_PROFILE_CORE & ctxOptions ) ); }
public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); }
+ public final boolean isGLDebugEnabled() { return ( 0 != ( CTX_OPTION_DEBUG & ctxOptions ) ); }
public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); }
/**
diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
index 926651c1d..7a12e52c9 100644
--- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
@@ -39,6 +39,8 @@ package javax.media.opengl;
import java.lang.reflect.*;
import java.util.StringTokenizer;
+import com.jogamp.common.util.ReflectionUtil;
+
import jogamp.opengl.*;
/**
@@ -70,10 +72,10 @@ public class GLPipelineFactory {
* @param downstream is always the 1st argument for the upstream constructor
* @param additionalArgs additional arguments for the upstream constructor
*/
- public static final GL create(String pipelineClazzBaseName, Class reqInterface, GL downstream, Object[] additionalArgs) {
- Class downstreamClazz = downstream.getClass();
- Class upstreamClazz = null;
- Class interfaceClazz = null;
+ public static final GL create(String pipelineClazzBaseName, Class<?> reqInterface, GL downstream, Object[] additionalArgs) {
+ Class<?> downstreamClazz = downstream.getClass();
+ Class<?> upstreamClazz = null;
+ Class<?> interfaceClazz = null;
if(DEBUG) {
System.out.println("GLPipelineFactory: Start "+downstreamClazz.getName()+", req. Interface: "+reqInterface+" -> "+pipelineClazzBaseName);
@@ -83,7 +85,7 @@ public class GLPipelineFactory {
do {
// For all interfaces: right -> left == child -> parent
// It is important that this matches with the gluegen cfg file's 'Implements' clause !
- Class[] clazzes = downstreamClazz.getInterfaces();
+ Class<?>[] clazzes = downstreamClazz.getInterfaces();
for(int i=clazzes.length-1; null==upstreamClazz && i>=0; i--) {
if(DEBUG) {
System.out.println("GLPipelineFactory: Try "+downstreamClazz.getName()+" Interface["+i+"]: "+clazzes[i].getName());
@@ -124,7 +126,7 @@ public class GLPipelineFactory {
System.out.println("GLPipelineFactory: Got : "+ upstreamClazz.getName()+", base interface: "+interfaceClazz.getName());
}
- Class[] cstrArgTypes = new Class[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ;
+ Class<?>[] cstrArgTypes = new Class<?>[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ;
{
int i = 0;
cstrArgTypes[i++] = interfaceClazz;
@@ -132,13 +134,8 @@ public class GLPipelineFactory {
cstrArgTypes[i++] = additionalArgs[j].getClass();
}
}
- Constructor cstr = null;
- try {
- cstr = upstreamClazz.getDeclaredConstructor( cstrArgTypes );
- } catch(NoSuchMethodException nsme) {
- throw new GLException("Couldn't find pipeline constructor: " + upstreamClazz.getName() +
- " ( "+getArgsClassNameList(downstreamClazz, additionalArgs) +" )");
- }
+ // throws exception if cstr not found!
+ Constructor<?> cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes);
Object instance = null;
try {
Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ;
@@ -161,7 +158,7 @@ public class GLPipelineFactory {
return (GL) instance;
}
- private static final String getArgsClassNameList(Class arg0, Object[] args) {
+ private static final String getArgsClassNameList(Class<?> arg0, Object[] args) {
StringBuffer sb = new StringBuffer();
sb.append(arg0.getName());
if(args!=null) {
@@ -173,7 +170,7 @@ public class GLPipelineFactory {
return sb.toString();
}
- private static final Class getUpstreamClazz(Class downstreamClazz, String pipelineClazzBaseName) {
+ private static final Class<?> getUpstreamClazz(Class<?> downstreamClazz, String pipelineClazzBaseName) {
String downstreamClazzName = downstreamClazz.getName();
StringTokenizer st = new StringTokenizer(downstreamClazzName, ".");
@@ -183,7 +180,7 @@ public class GLPipelineFactory {
}
String upstreamClazzName = pipelineClazzBaseName+downstreamClazzBaseName;
- Class upstreamClazz = null;
+ Class<?> upstreamClazz = null;
try {
upstreamClazz = Class.forName(upstreamClazzName, true, GLPipelineFactory.class.getClassLoader());
} catch (Throwable e) { e.printStackTrace(); }
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 6f2786b03..99693aabe 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -380,7 +380,10 @@ public abstract class GLContextImpl extends GLContext {
if (null == getGLDrawable().getChosenGLCapabilities()) {
throw new GLException("drawable has no chosen GLCapabilities: "+getGLDrawable());
}
- additionalCtxCreationFlags |= DEBUG_GL ? GLContext.CTX_OPTION_DEBUG : 0 ;
+ if(DEBUG_GL) {
+ // only impacts w/ createContextARB(..)
+ additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG ;
+ }
}
lockConsiderFailFast();
@@ -408,14 +411,17 @@ public abstract class GLContextImpl extends GLContext {
// throws an GLException if not
getGLDrawable().getGLProfile().verifyEquality(gl.getGLProfile());
+ glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() );
+
if(DEBUG_GL) {
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
- glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener(true));
+ if(glDebugHandler.isEnabled()) {
+ glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener(true));
+ }
}
if(TRACE_GL) {
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
}
- glDebugHandler.init(0 != (additionalCtxCreationFlags & GLContext.CTX_OPTION_DEBUG));
}
/* FIXME: refactor dependence on Java 2D / JOGL bridge
diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
index 9ca573536..8ca0c016d 100644
--- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
+++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
@@ -99,9 +99,14 @@ public class GLDebugMessageHandler {
}
public void init(boolean enable) {
+ if(DEBUG) {
+ System.err.println("GLDebugMessageHandler.init("+enable+")");
+ }
init();
if(isAvailable()) {
enableImpl(enable);
+ } else if(DEBUG) {
+ System.err.println("GLDebugMessageHandler.init("+enable+") .. n/a");
}
}
@@ -111,6 +116,13 @@ public class GLDebugMessageHandler {
return;
}
+ if( !ctx.isGLDebugEnabled() ) {
+ if(DEBUG) {
+ System.err.println("GLDebugMessageHandler: GL DEBUG not set in ARB ctx options: "+ctx.getGLVersion());
+ }
+ return;
+ }
+
if( ctx.isExtensionAvailable(GL_ARB_debug_output) ) {
extName = GL_ARB_debug_output;
extType = EXT_ARB;
@@ -124,7 +136,7 @@ public class GLDebugMessageHandler {
if(0 == extType) {
if(DEBUG) {
- System.err.println("GLDebugMessageHandler: No extension available!");
+ System.err.println("GLDebugMessageHandler: No extension available! "+ctx.getGLVersion());
}
return;
}