summaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/opengl
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
commita2a815a5eb2092c49b1c2e911146ad02ad225205 (patch)
tree318f4eef8f10fea311d5a323253fb641138e70c5 /src/java/com/sun/gluegen/opengl
parent327d57dcc8f36e9dcce5764367e2bb759e207d92 (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')
-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 5235631be..542cd5224 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)