summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2006-02-12 21:02:36 +0000
committerKenneth Russel <[email protected]>2006-02-12 21:02:36 +0000
commit32cfd6cb53ba54db4793f046ed0eb4616486f277 (patch)
tree51b187e9eb3cec972e2ce29e6b55cdc055157973 /src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
parent38d11fa12ee90faa614c1649f18435714629eda8 (diff)
Added checking of whether the correct GLContext is current to the
DebugGL pipeline. Fixed dependencies in JOGL and JOAL build.xml files so that generated code gets automatically rebuilt if GlueGen is updated. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@15 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java')
-rw-r--r--src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
index 5235631..542cd52 100644
--- a/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/java/com/sun/gluegen/opengl/BuildComposablePipeline.java
@@ -307,6 +307,11 @@ public class BuildComposablePipeline
output.println(" }");
output.print( " this." + getDownstreamObjectName());
output.println(" = " + getDownstreamObjectName() + ";");
+ output.println(" // Fetch GLContext object for better error checking (if possible)");
+ output.println(" // FIXME: should probably put this method in GL rather than GLImpl");
+ output.println(" if (" + getDownstreamObjectName() + " instanceof com.sun.opengl.impl.GLImpl) {");
+ output.println(" _context = ((com.sun.opengl.impl.GLImpl) " + getDownstreamObjectName() + ").getContext();");
+ output.println(" }");
output.println(" }");
output.println();
}
@@ -398,8 +403,18 @@ public class BuildComposablePipeline
output.println(" /** True if the pipeline is inside a glBegin/glEnd pair.*/");
output.println(" private boolean insideBeginEndPair = false;");
output.println();
-
+ output.println(" private void checkContext() {");
+ output.println(" GLContext currentContext = GLContext.getCurrent();");
+ output.println(" if (currentContext == null) {");
+ output.println(" throw new GLException(\"No OpenGL context is current on this thread\");");
+ output.println(" }");
+ output.println(" if ((_context != null) && (_context != currentContext)) {");
+ output.println(" throw new GLException(\"This GL object is being incorrectly used with a different GLContext than that which created it\");");
+ output.println(" }");
+ output.println(" }");
+ output.println(" private GLContext _context;");
}
+
protected void emitClassDocComment(PrintWriter output)
{
output.println("/** <P> Composable pipline which wraps an underlying {@link GL} implementation,");
@@ -415,6 +430,7 @@ public class BuildComposablePipeline
protected void preDownstreamCallHook(PrintWriter output, Method m)
{
+ output.println(" checkContext();");
}
protected void postDownstreamCallHook(PrintWriter output, Method m)