diff options
author | Chien Yang <[email protected]> | 2006-10-05 22:14:50 +0000 |
---|---|---|
committer | Chien Yang <[email protected]> | 2006-10-05 22:14:50 +0000 |
commit | 9eef9af05c78cdad57526c633aa3b31fc74f7aaa (patch) | |
tree | f8b8740093a1e01da136c30652fae43db5ccc9d7 /src/classes | |
parent | c71e697cf3cf62c93e4b889e7de1ad20b147e7d0 (diff) |
Work around to Issue 324 : Lockup Java3D program and throw exception using JOGL renderer
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@711 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes')
-rw-r--r-- | src/classes/jogl/javax/media/j3d/JoglPipeline.java | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/classes/jogl/javax/media/j3d/JoglPipeline.java b/src/classes/jogl/javax/media/j3d/JoglPipeline.java index 568b676..7f7b47b 100644 --- a/src/classes/jogl/javax/media/j3d/JoglPipeline.java +++ b/src/classes/jogl/javax/media/j3d/JoglPipeline.java @@ -6929,9 +6929,28 @@ class JoglPipeline extends Pipeline { // Apparently we are supposed to make the context current at // this point and set up a bunch of properties - if (context.makeCurrent() == GLContext.CONTEXT_NOT_CURRENT) { - throw new IllegalRenderingStateException("Unable to make new context current"); - } + + // Work around for some low end graphics driver bug, such as Intel Chipset. + // Issue 324 : Lockup Java3D program and throw exception using JOGL renderer + boolean failed = false; + int failCount = 0; + int MAX_FAIL_COUNT = 5; + do { + failed = false; + int res = context.makeCurrent(); + if (res == GLContext.CONTEXT_NOT_CURRENT) { + // System.err.println("makeCurrent fail : " + failCount); + failed = true; + ++failCount; + try { + Thread.sleep(100); + } catch (InterruptedException e) { + } + } + } while (failed && (failCount < MAX_FAIL_COUNT)); + if (failCount == MAX_FAIL_COUNT) { + throw new IllegalRenderingStateException("Unable to make new context current after " + failCount + "tries"); + } GL gl = context.getGL(); JoglContext ctx = new JoglContext(context); |