diff options
Diffstat (limited to 'src')
8 files changed, 98 insertions, 69 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index f81d2f2d0..eafc52ef8 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -341,8 +341,11 @@ public class GLRendererQuirks { */ public static final int BuggyColorRenderbuffer = 18; - /** Number of quirks known. */ - public static final int COUNT = 19; + /** @deprecated Use {@link #getCount()}, this value is no more valid! */ + public static final int COUNT = 18; + + /** Return the number of known quirks. */ + public static final int getCount() { return 19; } private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval", "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard", @@ -509,7 +512,7 @@ public class GLRendererQuirks { } sb.append("["); boolean first=true; - for(int i=0; i<COUNT; i++) { + for(int i=0; i<getCount(); i++) { final int testmask = 1 << i; if( 0 != ( _bitmask & testmask ) ) { if(!first) { sb.append(", "); } @@ -531,8 +534,8 @@ public class GLRendererQuirks { * @throws IllegalArgumentException if quirk is out of range */ public static void validateQuirk(final int quirk) throws IllegalArgumentException { - if( !( 0 <= quirk && quirk < COUNT ) ) { - throw new IllegalArgumentException("Quirks must be in range [0.."+COUNT+"[, but quirk: "+quirk); + if( !( 0 <= quirk && quirk < getCount() ) ) { + throw new IllegalArgumentException("Quirks must be in range [0.."+getCount()+"[, but quirk: "+quirk); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 03c566d7d..e199dc045 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -58,13 +58,22 @@ import javax.media.opengl.GLException; * </p> */ public class Animator extends AnimatorBase { + /** @deprecated no more used */ protected ThreadGroup threadGroup; - private Runnable runnable; - private boolean runAsFastAsPossible; + /** @deprecated no more used */ protected boolean isAnimating; - protected volatile boolean pauseIssued; + /** @deprecated no more used */ + protected boolean pauseIssued; + /** @deprecated no more used */ protected volatile boolean stopIssued; + private ThreadGroup threadGroup2; + private Runnable runnable; + private boolean runAsFastAsPossible; + boolean isAnimating2; + volatile boolean pauseIssued2; + volatile boolean stopIssued2; + /** * Creates a new, empty Animator. */ @@ -82,7 +91,7 @@ public class Animator extends AnimatorBase { super(); setThreadGroup(tg); if(DEBUG) { - System.err.println("Animator created, ThreadGroup: "+threadGroup); + System.err.println("Animator created, ThreadGroup: "+threadGroup2); } } @@ -105,7 +114,7 @@ public class Animator extends AnimatorBase { setThreadGroup(tg); add(drawable); if(DEBUG) { - System.err.println("Animator created, ThreadGroup: "+threadGroup+" and "+drawable); + System.err.println("Animator created, ThreadGroup: "+threadGroup2+" and "+drawable); } } @@ -142,19 +151,19 @@ public class Animator extends AnimatorBase { } fpsCounter.resetFPSCounter(); animThread = Thread.currentThread(); - isAnimating = false; + isAnimating2 = false; // 'waitForStartedCondition' wake-up is handled below! } - while (!stopIssued) { + while (!stopIssued2) { synchronized (Animator.this) { // Pause; Also don't consume CPU unless there is work to be done and not paused boolean ectCleared = false; - while ( !stopIssued && ( pauseIssued || drawablesEmpty ) ) { + while ( !stopIssued2 && ( pauseIssued2 || drawablesEmpty ) ) { if( drawablesEmpty ) { - pauseIssued = true; + pauseIssued2 = true; } - final boolean wasPaused = pauseIssued; + final boolean wasPaused = pauseIssued2; if (DEBUG) { System.err.println("Animator pause on " + animThread.getName() + ": " + toString()); } @@ -165,11 +174,11 @@ public class Animator extends AnimatorBase { display(); // propagate exclusive context -> off! } catch (final UncaughtAnimatorException dre) { caughtException = dre; - stopIssued = true; + stopIssued2 = true; break; // end pause loop } } - isAnimating = false; + isAnimating2 = false; Animator.this.notifyAll(); try { Animator.this.wait(); @@ -183,22 +192,22 @@ public class Animator extends AnimatorBase { } } } - if (!stopIssued && !isAnimating) { + if (!stopIssued2 && !isAnimating2) { // Wakes up 'waitForStartedCondition' sync // - and - // Resume from pause or drawablesEmpty, // implies !pauseIssued and !drawablesEmpty - isAnimating = true; + isAnimating2 = true; setDrawablesExclCtxState(exclusiveContext); // may re-enable exclusive context Animator.this.notifyAll(); } } // sync Animator.this - if ( !pauseIssued && !stopIssued ) { + if ( !pauseIssued2 && !stopIssued2 ) { try { display(); } catch (final UncaughtAnimatorException dre) { caughtException = dre; - stopIssued = true; + stopIssued2 = true; break; // end animation loop } if ( !runAsFastAsPossible ) { @@ -237,12 +246,17 @@ public class Animator extends AnimatorBase { caughtException.printStackTrace(); } } - stopIssued = false; - pauseIssued = false; - isAnimating = false; + stopIssued2 = false; + pauseIssued2 = false; + isAnimating2 = false; if( null != caughtException ) { flushGLRunnables = true; - throwCaughtException = !handleUncaughtException(caughtException); + if( null != uncaughtExceptionHandler ) { + handleUncaughtException(caughtException); + throwCaughtException = false; + } else { + throwCaughtException = true; + } } animThread = null; Animator.this.notifyAll(); @@ -261,12 +275,12 @@ public class Animator extends AnimatorBase { @Override public final synchronized boolean isAnimating() { - return animThread != null && isAnimating ; + return animThread != null && isAnimating2 ; } @Override public final synchronized boolean isPaused() { - return animThread != null && pauseIssued ; + return animThread != null && pauseIssued2 ; } /** @@ -279,7 +293,7 @@ public class Animator extends AnimatorBase { if ( isStarted() ) { throw new GLException("Animator already started."); } - threadGroup = tg; + threadGroup2 = tg; } @Override @@ -293,10 +307,10 @@ public class Animator extends AnimatorBase { fpsCounter.resetFPSCounter(); final String threadName = getThreadName()+"-"+baseName; Thread thread; - if(null==threadGroup) { + if(null==threadGroup2) { thread = new Thread(runnable, threadName); } else { - thread = new Thread(threadGroup, runnable, threadName); + thread = new Thread(threadGroup2, runnable, threadName); } thread.setDaemon(false); // force to be non daemon, regardless of parent thread if(DEBUG) { @@ -309,7 +323,7 @@ public class Animator extends AnimatorBase { private final Condition waitForStartedCondition = new Condition() { @Override public boolean eval() { - return !isStarted() || (!drawablesEmpty && !isAnimating) ; + return !isStarted() || (!drawablesEmpty && !isAnimating2) ; } }; @Override @@ -317,7 +331,7 @@ public class Animator extends AnimatorBase { if ( !isStarted() ) { return false; } - stopIssued = true; + stopIssued2 = true; return finishLifecycleAction(waitForStoppedCondition, 0); } private final Condition waitForStoppedCondition = new Condition() { @@ -328,31 +342,31 @@ public class Animator extends AnimatorBase { @Override public final synchronized boolean pause() { - if ( !isStarted() || pauseIssued ) { + if ( !isStarted() || pauseIssued2 ) { return false; } - pauseIssued = true; + pauseIssued2 = true; return finishLifecycleAction(waitForPausedCondition, 0); } private final Condition waitForPausedCondition = new Condition() { @Override public boolean eval() { // end waiting if stopped as well - return isStarted() && isAnimating; + return isStarted() && isAnimating2; } }; @Override public final synchronized boolean resume() { - if ( !isStarted() || !pauseIssued ) { + if ( !isStarted() || !pauseIssued2 ) { return false; } - pauseIssued = false; + pauseIssued2 = false; return finishLifecycleAction(waitForResumeCondition, 0); } private final Condition waitForResumeCondition = new Condition() { @Override public boolean eval() { // end waiting if stopped as well - return isStarted() && ( !drawablesEmpty && !isAnimating || drawablesEmpty && !pauseIssued ) ; + return isStarted() && ( !drawablesEmpty && !isAnimating2 || drawablesEmpty && !pauseIssued2 ) ; } }; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java index bc159ef5c..3d5935457 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java @@ -525,17 +525,12 @@ public abstract class AnimatorBase implements GLAnimatorControl { /** * Should be called in case of an uncaught exception * from within the animator thread, throws given exception if no handler has been installed. - * @return {@code true} if handled, otherwise {@code false}. In case of {@code false}, - * caller needs to propagate the exception. */ - protected final synchronized boolean handleUncaughtException(final UncaughtAnimatorException ue) { + protected final synchronized void handleUncaughtException(final UncaughtAnimatorException ue) { if( null != uncaughtExceptionHandler ) { try { uncaughtExceptionHandler.uncaughtException(this, ue.getGLAutoDrawable(), ue.getCause()); } catch (final Throwable t) { /* ignore intentionally */ } - return true; - } else { - return false; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java index 54d40f285..7abe987ac 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java @@ -240,7 +240,12 @@ public class FPSAnimator extends AnimatorBase { isAnimating = false; if( null != caughtException ) { flushGLRunnables = true; - throwCaughtException = !handleUncaughtException(caughtException); + if( null != uncaughtExceptionHandler ) { + handleUncaughtException(caughtException); + throwCaughtException = false; + } else { + throwCaughtException = true; + } } animThread = null; FPSAnimator.this.notifyAll(); diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java index 01db60b2e..a90a40e4d 100644 --- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java @@ -78,16 +78,17 @@ import com.jogamp.opengl.GLRendererQuirks; public interface GLFBODrawable extends GLDrawable { // public enum DoubleBufferMode { NONE, TEXTURE, FBO }; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support - /** FBO Mode Bit: Use a {@link TextureAttachment} for the {@link #getColorbuffer(int) render colorbuffer} ({@link #FBOMODE_DEFAULT default}), see {@link #setFBOMode(int)}. */ + /** FBO Mode Bit: Use a {@link TextureAttachment} for the {@link #getColorbuffer(int) render colorbuffer}, see {@link #setFBOMode(int)}. */ public static final int FBOMODE_USE_TEXTURE = 1 << 0; /** - * FBO Mode Bit: Use a depth renderbuffer ({@link #FBOMODE_DEFAULT default}), see {@link #setFBOMode(int)}. - * @deprecated Use {@link GLCapabilities#setDepthBits(int)}! + * @deprecated Use {@link GLCapabilities#setDepthBits(int)}, this bit is w/o function now. */ public static final int FBOMODE_USE_DEPTH = 1 << 1; - /** FBO Default Mode Bit: {@link #FBOMODE_USE_TEXTURE}. */ - public static final int FBOMODE_DEFAULT = FBOMODE_USE_TEXTURE; + /** + * @deprecated Use dedicated values, e.g. {@link #FBOMODE_USE_TEXTURE}. + */ + public static final int FBOMODE_DEFAULT = FBOMODE_USE_TEXTURE | FBOMODE_USE_DEPTH; /** * @return <code>true</code> if initialized, i.e. a {@link GLContext} is bound and made current once, otherwise <code>false</code>. @@ -97,7 +98,7 @@ public interface GLFBODrawable extends GLDrawable { /** * Set the FBO mode bits used for FBO creation. * <p> - * See {@link #FBOMODE_DEFAULT} values. + * See {@link #FBOMODE_USE_TEXTURE}. * </p> * <p> * If {@link GLRendererQuirks#BuggyColorRenderbuffer} is set, @@ -206,8 +207,9 @@ public interface GLFBODrawable extends GLDrawable { * </p> * <p> * Depending on the {@link #setFBOMode(int) fbo mode} the resulting {@link Colorbuffer} - * is either a {@link TextureAttachment} ({@link #FBOMODE_DEFAULT default}) or a {@link ColorAttachment}, - * see {@link Colorbuffer#isTextureAttachment()}. + * is either a {@link TextureAttachment} if {@link #FBOMODE_USE_TEXTURE} is set, + * otherwise a {@link ColorAttachment}. + * See {@link Colorbuffer#isTextureAttachment()}. * </p> * @param bufferName {@link GL#GL_FRONT} and {@link GL#GL_BACK} are valid buffer names * @return the named {@link Colorbuffer} diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index fdd5aa5e9..cc8ebcac9 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -107,7 +107,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { final FBObject fbo = new FBObject(); fbos[idx] = fbo; - final boolean useDepth = depthBits > 0 || 0 != ( FBOMODE_USE_DEPTH & fboModeBits ); + final boolean useDepth = depthBits > 0; final boolean useStencil = stencilBits > 0; fbo.init(gl, width, height, samples); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java index a46c5a750..327fecd25 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java @@ -76,7 +76,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); caps.setDoubleBuffered(false); - testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_DEFAULT, new GearsES2(0)); + testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_USE_TEXTURE, new GearsES2(0)); } @Test public void test01b_GL2ES2_Demo1_SingleBuffer_NoTex() throws InterruptedException { @@ -99,7 +99,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); caps.setDoubleBuffered(true); // default - testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_DEFAULT, new GearsES2(0)); + testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_USE_TEXTURE, new GearsES2(0)); } @Test @@ -108,7 +108,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(glp); caps.setSampleBuffers(true); caps.setNumSamples(4); - testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_DEFAULT, new MultisampleDemoES2(true)); + testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_USE_TEXTURE, new MultisampleDemoES2(true)); } @Test public void test03b_GL2ES2_Demo2MSAA4_NoTex() throws InterruptedException { @@ -136,7 +136,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(glp); caps.setSampleBuffers(true); caps.setNumSamples(4); - testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_DEFAULT, demo); + testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_USE_TEXTURE, demo); } @Test @@ -144,7 +144,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { if( GLProfile.isAvailable(GLProfile.GLES2) ) { final GLProfile glp = GLProfile.get(GLProfile.GLES2); final GLCapabilities caps = new GLCapabilities(glp); - testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_DEFAULT, new GearsES2(0)); + testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_USE_TEXTURE, new GearsES2(0)); } else { System.err.println("EGL ES2 n/a"); } @@ -157,7 +157,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(glp); caps.setSampleBuffers(true); caps.setNumSamples(4); - testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_DEFAULT, new GearsES2(0)); + testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_USE_TEXTURE, new GearsES2(0)); } else { System.err.println("EGL ES2 n/a"); } @@ -168,7 +168,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { if( GLProfile.isAvailable(GLProfile.GL3) ) { final GLProfile glp = GLProfile.get(GLProfile.GL3); final GLCapabilities caps = new GLCapabilities(glp); - testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_DEFAULT, new GearsES2(0)); + testGLFBODrawableImpl(caps, GLFBODrawable.FBOMODE_USE_TEXTURE, new GearsES2(0)); } else { System.err.println("GL3 n/a"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java index 403a93687..865758485 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java @@ -55,16 +55,10 @@ public class TestVersionSemanticsNOUI extends JunitTracer { static final JogampVersion curVersion = JoglVersion.getInstance(); static final VersionNumberString curVersionNumber = new VersionNumberString(curVersion.getImplementationVersion()); - static final Set<String> excludesDefault, excludeV221toV222; + static final Set<String> excludesDefault; static { excludesDefault = new HashSet<String>(); excludesDefault.add("^\\Qjogamp/\\E.*$"); - - excludeV221toV222 = new HashSet<String>(); - excludeV221toV222.add("^\\Qjogamp/\\E.*$"); - excludeV221toV222.add("^\\Qcom/jogamp/opengl/GLRendererQuirks\\E$"); // COUNT increased by one - excludeV221toV222.add("^\\Qcom/jogamp/opengl/util/Animator\\E$"); // pauseIssued -> volatile - excludeV221toV222.add("^\\Qjavax/media/opengl/GLFBODrawable\\E$"); // FBOMODE_DEFAULT (removed USE_DEPTH) } @@ -109,6 +103,22 @@ public class TestVersionSemanticsNOUI extends JunitTracer { } @Test + public void testVersionV220V222() throws IllegalArgumentException, IOException, URISyntaxException { + // static final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.NON_BACKWARD_COMPATIBLE; + final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.BACKWARD_COMPATIBLE_USER; + + final VersionNumberString preVersionNumber = new VersionNumberString("2.2.0"); + final File previousJar = new File("lib/v"+preVersionNumber.getVersionString()+"/"+jarFile); + + final ClassLoader currentCL = TestVersionSemanticsNOUI.class.getClassLoader(); + + VersionSemanticsUtil.testVersion(diffCriteria, expectedCompatibilityType, + previousJar, preVersionNumber, + curVersion.getClass(), currentCL, curVersionNumber, + excludesDefault); + } + + @Test public void testVersionV221V222() throws IllegalArgumentException, IOException, URISyntaxException { // static final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.NON_BACKWARD_COMPATIBLE; final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.BACKWARD_COMPATIBLE_USER; @@ -121,7 +131,7 @@ public class TestVersionSemanticsNOUI extends JunitTracer { VersionSemanticsUtil.testVersion(diffCriteria, expectedCompatibilityType, previousJar, preVersionNumber, curVersion.getClass(), currentCL, curVersionNumber, - excludeV221toV222); + excludesDefault); } public static void main(final String args[]) throws IOException { |