diff options
author | Kenneth Russel <[email protected]> | 2005-05-07 00:45:19 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-05-07 00:45:19 +0000 |
commit | c5640e88c4aade6fed25dfef302ca29968e02573 (patch) | |
tree | fcb44db9d876dabcc543cd21329acf827c130a08 /src/net/java/games/gluegen | |
parent | bf3544c279ea1734dfed827c1fdbe7fa7ca9dbad (diff) |
Fixed Issue 151: starting up the Animator before the GLJPanel has been shown result in an error
The root cause of this error was the fact that
WindowsPbufferGLContext.destroyImpl() uses WGL extensions to clean up
resources associated with the pbuffer. Because these extensions are in
the public WGL interface, they are wrapped by the DebugGL. However, an
OpenGL context is not current at the time these routines are called,
and it is illegal to call glGetError() at those points. The DebugGL
pipeline was implicitly calling glGetError() after each of those
calls, leading to the failure.
This bug unmasked a couple of others. The code in the DebugGL needed a
recursion count to make sure that glGetError() didn't get called in an
infinite loop. Also, as a side effect of the fix for Issue 160,
calling getGL() on the GLJPanel outside of GLEventListener.init() was
causing a NullPointerException to be thrown. The GLJPanel has been
fixed to return null in this case, and the specification of
GLDrawable.getGL() has been improved. In order to make the behavior
between the GLCanvas and GLJPanel similar, the GL object is now reset
in the GLDrawable each time the underlying OpenGL context is
recreated. This allows end users to set up e.g. the DebugGL
unconditionally in their GLEventListener.init() method. The JOGL demos
have been changed to reflect this.
The test case in the bug report will be updated with code similar to
the originally submitted test case (i.e., the Animator is started
early) but which now works.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@264 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/gluegen')
-rw-r--r-- | src/net/java/games/gluegen/opengl/BuildComposablePipeline.java | 9 |
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()); |