aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-29 11:10:58 +0100
committerSven Gothel <[email protected]>2013-10-29 11:10:58 +0100
commitd83d54f2aaf9b8389a64fba7a8c05c495873d941 (patch)
treeec9cd517a171018e1242b407b7b429dfad8933eb /src
parent5dffa6a4895a06edc44de6fe335c35af291fbd19 (diff)
Bug 876: BuildComposablePipeline: getGL*() shall not return downstream.getGL*() [TraceGL* / DebugGL*] ; Simplify GLContextImpl's set Debug/Trace Pipeline
Regression of commit 0002fccdcd6383874b2813dc6bbe3e33f5f00924: "Trace/Debug shall utilize downstream identification for isGL*() and getGL*() methods." Using the downstream identification commit is right for the isGL*() case, however, getGL*() returned the downstream object which makes the caller loosing the pipeline! Instead, we shall produce !GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS: "if( isGL<type>() ) { return this; } throw new GLException("Not a <type> implementation");" or for GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS: "return this;"
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java33
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java14
2 files changed, 27 insertions, 20 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
index 703f832c3..b7a9c270e 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
@@ -83,12 +83,12 @@ public class BuildComposablePipeline {
public static final int GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS = 1 << 4;
int mode;
- private String outputDir;
- private String outputPackage;
- private String outputName;
- private Class<?> classToComposeAround;
- private Class<?> classPrologOpt;
- private Class<?> classDownstream;
+ private final String outputDir;
+ private final String outputPackage;
+ private final String outputName;
+ private final Class<?> classToComposeAround;
+ private final Class<?> classPrologOpt;
+ private final Class<?> classDownstream;
// Only desktop OpenGL has immediate mode glBegin / glEnd
private boolean hasImmediateMode;
// Desktop OpenGL and GLES1 have GL_STACK_OVERFLOW and GL_STACK_UNDERFLOW errors
@@ -590,7 +590,7 @@ public class BuildComposablePipeline {
output.println(" @Override");
output.println(" public String toString() {");
output.println(" StringBuilder sb = new StringBuilder();");
- output.println(" sb.append(\"" + getOutputName() + " [ implementing " + baseInterfaceClass.getName() + ",\\n\\t\");");
+ output.println(" sb.append(\"" + getOutputName() + " [this 0x\"+Integer.toHexString(hashCode())+\" implementing " + baseInterfaceClass.getName() + ",\\n\\t\");");
if (null != prologClassOpt) {
output.println(" sb.append(\" prolog: \"+" + getPrologObjectNameOpt() + ".toString()+\",\\n\\t\");");
}
@@ -646,7 +646,10 @@ public class BuildComposablePipeline {
* Emits all of the isGL* methods.
*/
protected void emitGLIsMethods(PrintWriter output) {
- emitGLIsMethod(output, "GL");
+ output.println(" @Override");
+ output.println(" public final boolean isGL() {");
+ output.println(" return true;");
+ output.println(" }");
emitGLIsMethod(output, "GL4bc");
emitGLIsMethod(output, "GL4");
emitGLIsMethod(output, "GL3bc");
@@ -697,15 +700,16 @@ public class BuildComposablePipeline {
protected void emitGLGetMethod(PrintWriter output, String type) {
output.println(" @Override");
output.println(" public final javax.media.opengl." + type + " get" + type + "() {");
- if( 0 != (GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS & getMode() ) ) {
- final Class<?> clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type);
- if (clazz.isAssignableFrom(baseInterfaceClass)) {
+ final Class<?> clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type);
+ if (clazz.isAssignableFrom(baseInterfaceClass)) {
+ if( 0 != (GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS & getMode() ) ) {
output.println(" return this;");
} else {
+ output.println(" if( is" + type + "() ) { return this; }");
output.println(" throw new GLException(\"Not a " + type + " implementation\");");
}
} else {
- output.println(" return " + getDownstreamObjectName() + ".get" + type + "();");
+ output.println(" throw new GLException(\"Not a " + type + " implementation\");");
}
output.println(" }");
}
@@ -714,7 +718,10 @@ public class BuildComposablePipeline {
* Emits all of the getGL* methods.
*/
protected void emitGLGetMethods(PrintWriter output) {
- emitGLGetMethod(output, "GL");
+ output.println(" @Override");
+ output.println(" public final javax.media.opengl.GL getGL() {");
+ output.println(" return this;");
+ output.println(" }");
emitGLGetMethod(output, "GL4bc");
emitGLGetMethod(output, "GL4");
emitGLGetMethod(output, "GL3bc");
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 377ebd9f5..4e5465906 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -280,11 +280,11 @@ public abstract class GLContextImpl extends GLContext {
@Override
public GL setGL(GL gl) {
- if(DEBUG) {
- String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"<null>";
- String sgl2 = (null!=gl)?gl.getClass().getSimpleName()+", "+gl.toString():"<null>";
- Exception e = new Exception("Info: setGL (OpenGL "+getGLVersion()+"): "+getThreadName()+", "+sgl1+" -> "+sgl2);
- e.printStackTrace();
+ if( DEBUG ) {
+ final String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"<null>";
+ final String sgl2 = (null!=gl)?gl.getClass().getSimpleName()+", "+gl.toString():"<null>";
+ System.err.println("Info: setGL (OpenGL "+getGLVersion()+"): "+getThreadName()+", "+sgl1+" -> "+sgl2);
+ Thread.dumpStack();
}
this.gl = gl;
return gl;
@@ -600,13 +600,13 @@ public abstract class GLContextImpl extends GLContext {
glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() );
if(DEBUG_GL) {
- gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
+ setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
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 } ) );
+ setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
}
forceDrawableAssociation = true;