aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/gluegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/games/gluegen')
-rw-r--r--src/net/java/games/gluegen/opengl/BuildComposablePipeline.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java b/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java
index 230add51a..895de5d2d 100644
--- a/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/net/java/games/gluegen/opengl/BuildComposablePipeline.java
@@ -302,6 +302,9 @@ public class BuildComposablePipeline
output.print( " public " + getPipelineName() + "(" + baseName + " ");
output.println(getDownstreamObjectName() + ")");
output.println(" {");
+ output.println(" if (" + getDownstreamObjectName() + " == null) {");
+ output.println(" throw new IllegalArgumentException(\"null " + getDownstreamObjectName() + "\");");
+ output.println(" }");
output.print( " this." + getDownstreamObjectName());
output.println(" = " + getDownstreamObjectName() + ";");
output.println(" }");
@@ -374,6 +377,7 @@ public class BuildComposablePipeline
output.println();
output.println(" // Loop repeatedly to allow for distributed GL implementations,");
output.println(" // as detailed in the glGetError() specification");
+ output.println(" int recursionDepth = 10;");
output.println(" do {");
output.println(" switch (err) {");
output.println(" case GL_INVALID_ENUM: buf.append(\"GL_INVALID_ENUM \"); break;");
@@ -385,7 +389,7 @@ public class BuildComposablePipeline
output.println(" case GL_NO_ERROR: throw new InternalError(\"Should not be treating GL_NO_ERROR as error\");");
output.println(" default: throw new InternalError(\"Unknown glGetError() return value: \" + err);");
output.println(" }");
- output.println( " } while ((err = " +
+ output.println(" } while ((--recursionDepth >= 0) && (err = " +
getDownstreamObjectName() +
".glGetError()) != GL_NO_ERROR);");
output.println(" throw new GLException(buf.toString());");
@@ -459,6 +463,9 @@ public class BuildComposablePipeline
output.print( " public " + getPipelineName() + "(" + getBaseInterfaceName() + " ");
output.println(getDownstreamObjectName() + ", PrintStream " + getOutputStreamName() + ")");
output.println(" {");
+ output.println(" if (" + getDownstreamObjectName() + " == null) {");
+ output.println(" throw new IllegalArgumentException(\"null " + getDownstreamObjectName() + "\");");
+ output.println(" }");
output.print( " this." + getDownstreamObjectName());
output.println(" = " + getDownstreamObjectName() + ";");
output.print( " this." + getOutputStreamName());