diff options
Diffstat (limited to 'src')
69 files changed, 941 insertions, 741 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/Launcher0.java b/src/demos/com/jogamp/opengl/demos/Launcher0.java index d9d66d434..2eff980ca 100644 --- a/src/demos/com/jogamp/opengl/demos/Launcher0.java +++ b/src/demos/com/jogamp/opengl/demos/Launcher0.java @@ -203,8 +203,11 @@ public class Launcher0 { if(waitForKey) { glWindow.addGLEventListener(new GLEventListener() { + @Override public void init(final GLAutoDrawable drawable) { } + @Override public void dispose(final GLAutoDrawable drawable) { } + @Override public void display(final GLAutoDrawable drawable) { final GLAnimatorControl actrl = drawable.getAnimator(); if(waitForKey && actrl.getTotalFPSFrames() == 60*3) { @@ -213,22 +216,24 @@ public class Launcher0 { waitForKey = false; } } + @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); } - final Animator animator = useAnimator ? new Animator() : null; + final Animator animator = useAnimator ? new Animator(0 /* w/o AWT */) : null; if( useAnimator ) { - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } glWindow.addWindowListener(new WindowAdapter() { + @Override public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getBounds()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); NEWTDemoListener.setTitle(glWindow); } + @Override public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getBounds()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); NEWTDemoListener.setTitle(glWindow); diff --git a/src/demos/com/jogamp/opengl/demos/android/MovieCubeActivity0a.java b/src/demos/com/jogamp/opengl/demos/android/MovieCubeActivity0a.java index cdaf39f2b..e9572d6ff 100644 --- a/src/demos/com/jogamp/opengl/demos/android/MovieCubeActivity0a.java +++ b/src/demos/com/jogamp/opengl/demos/android/MovieCubeActivity0a.java @@ -87,7 +87,7 @@ public class MovieCubeActivity0a extends NewtBaseActivity { scrn.addReference(); try { - final Animator anim = new Animator(); + final Animator anim = new Animator(0 /* w/o AWT */); // Main final GLWindow glWindowMain = GLWindow.create(scrn, capsMain); diff --git a/src/demos/com/jogamp/opengl/demos/android/MovieCubeActivity0b.java b/src/demos/com/jogamp/opengl/demos/android/MovieCubeActivity0b.java index 1b4696180..06ae92bc4 100644 --- a/src/demos/com/jogamp/opengl/demos/android/MovieCubeActivity0b.java +++ b/src/demos/com/jogamp/opengl/demos/android/MovieCubeActivity0b.java @@ -89,7 +89,7 @@ public class MovieCubeActivity0b extends NewtBaseActivity { scrn.addReference(); try { - final Animator anim = new Animator(); + final Animator anim = new Animator(0 /* w/o AWT */); // Main final GLWindow glWindowMain = GLWindow.create(scrn, capsMain); diff --git a/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity0.java b/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity0.java index c80afab89..6316e1bba 100644 --- a/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity0.java +++ b/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity0.java @@ -87,7 +87,7 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0); scrn.addReference(); - final Animator anim = new Animator(); + final Animator anim = new Animator(0 /* w/o AWT */); // Main final GLWindow glWindowMain = GLWindow.create(scrn, capsMain); diff --git a/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity1.java b/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity1.java index 287f8b3de..23bbf6971 100644 --- a/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity1.java +++ b/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity1.java @@ -113,7 +113,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0); scrn.addReference(); - final Animator anim = new Animator(); + final Animator anim = new Animator(0 /* w/o AWT */); // Main final GLWindow glWindowMain = GLWindow.create(scrn, capsMain); diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java index 2bbb9de05..d170d204f 100644 --- a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java +++ b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java @@ -788,7 +788,7 @@ public class MovieSimple implements GLEventListener { final MovieSimple[] mss = new MovieSimple[windowCount]; final GLWindow[] windows = new GLWindow[windowCount]; for(int i=0; i<windowCount; i++) { - final Animator anim = new Animator(); + final Animator anim = new Animator(0 /* w/o AWT */); anim.start(); windows[i] = GLWindow.create(caps); windows[i].addWindowListener(new WindowAdapter() { diff --git a/src/demos/com/jogamp/opengl/demos/av/StereoDemo01.java b/src/demos/com/jogamp/opengl/demos/av/StereoDemo01.java index 139c9f140..1097b37d8 100644 --- a/src/demos/com/jogamp/opengl/demos/av/StereoDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/av/StereoDemo01.java @@ -271,9 +271,8 @@ public class StereoDemo01 { window.setAutoSwapBufferMode(useAutoSwap); window.setUndecorated(true); - final Animator animator = useAnimator ? new Animator() : null; + final Animator animator = useAnimator ? new Animator(0 /* w/o AWT */) : null; if( useAnimator ) { - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java index 5e2ac39ca..070371713 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java @@ -135,7 +135,7 @@ public class GPURegionNewtDemo { window.setVisible(true); //FPSAnimator animator = new FPSAnimator(60); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(60, System.err); animator.add(window); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java index 5952326c8..06f39d8ba 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java @@ -162,7 +162,7 @@ public class GPUTextNewtDemo { } // FPSAnimator animator = new FPSAnimator(60); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(60, null); animator.add(window); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java index a8d82fcc4..c927b8639 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java @@ -119,7 +119,7 @@ public class FontView01 { } System.out.println("Requested: " + caps); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1*60, null); // System.err); final GLWindow window = GLWindow.create(caps); window.setSize(options.surface_width, options.surface_height); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java index 6acb50af7..905bb7d15 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java @@ -118,7 +118,7 @@ public class UILayoutBox01 { final GLProfile reqGLP = GLProfile.get(options.glProfileName); System.err.println("GLProfile: "+reqGLP); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLCapabilities caps = new GLCapabilities(reqGLP); caps.setAlphaBits(4); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java index 2bd9c0dfb..32cf213c6 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java @@ -118,7 +118,7 @@ public class UILayoutGrid01 { final GLProfile reqGLP = GLProfile.get(options.glProfileName); System.err.println("GLProfile: "+reqGLP); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLCapabilities caps = new GLCapabilities(reqGLP); caps.setAlphaBits(4); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java index 9c8177699..ad038cada 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java @@ -84,7 +84,7 @@ public class UISceneDemo00 { scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); scene.addShape(shape); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLCapabilities caps = new GLCapabilities(reqGLP); caps.setAlphaBits(4); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java index 1bebb8e40..64c677d48 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java @@ -93,7 +93,7 @@ public class UISceneDemo01 { scene.setPMVMatrixSetup(new MyPMVMatrixSetup()); scene.addShape(shape); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLCapabilities caps = new GLCapabilities(reqGLP); caps.setAlphaBits(4); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java index c9ae88a8d..59e4ca4c3 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java @@ -101,7 +101,7 @@ public class UISceneDemo01b { scene.setPMVMatrixSetup(new MyPMVMatrixSetup()); scene.addShape(shape); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLCapabilities caps = new GLCapabilities(reqGLP); caps.setAlphaBits(4); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java index 7e74f1db5..51d8f38a1 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java @@ -105,7 +105,7 @@ public class UISceneDemo02 { scene.addShape(destText); scene.addShape(movingGlyph); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1*60, null); // System.err); final GLCapabilities caps = new GLCapabilities(reqGLP); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java index 0c00508d8..61cd4fc76 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java @@ -136,7 +136,7 @@ public class UISceneDemo03 { // scene.setFrustumCullingEnabled(true); glyphGroup.setFrustumCullingEnabled(true); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1 * 60, null); // System.err); final GLCapabilities caps = new GLCapabilities(reqGLP); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java index 805d9dafc..4a9f447b7 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java @@ -145,7 +145,7 @@ public class UISceneDemo03b { scene.setFrustumCullingEnabled(true); glyphGroup.setFrustumCullingEnabled(true); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1 * 60, null); // System.err); final GLCapabilities caps = new GLCapabilities(reqGLP); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java index 30babc583..12cb2cb1a 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java @@ -158,7 +158,7 @@ public class UISceneDemo10 { window.addGLEventListener(scene); scene.attachInputListenerTo(window); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(5*60, null); animator.add(window); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java index 6c20247c2..6a6cfe4cb 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java @@ -101,7 +101,7 @@ public class UISceneDemo11 { scene.addShape(groupA0); scene.setFrustumCullingEnabled(true); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLCapabilities caps = new GLCapabilities(reqGLP); caps.setAlphaBits(4); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java index 436bab31a..f95ec6494 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java @@ -175,7 +175,7 @@ public class UISceneDemo20 implements GLEventListener { final UISceneDemo20 scene = new UISceneDemo20(fontfilename, filmURL, options.renderModes, DEBUG, TRACE); window.addGLEventListener(scene); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(5*60, null); animator.add(window); @@ -722,7 +722,6 @@ public class UISceneDemo20 implements GLEventListener { button.addMouseListener(dragZoomRotateListener); final ALAudioSink[] alAudioSink = { null }; - final com.jogamp.openal.sound3d.Listener audioListener = new com.jogamp.openal.sound3d.Listener(); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java index c3d12c8d3..19db00cbe 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java @@ -141,7 +141,7 @@ public class UISceneDemoU01a { font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_SERIF); System.err.println("Font: "+font.getFullFamilyName()); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLCapabilities caps = new GLCapabilities(reqGLP); caps.setAlphaBits(4); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java index 28dfe1068..7d39003dd 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java @@ -119,7 +119,7 @@ public class UIShapeDemo01 implements GLEventListener { window.addGLEventListener(uiGLListener); window.setVisible(true); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(5*60, null); animator.add(window); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java index e26b1dbaa..b1b3825f8 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java @@ -132,7 +132,7 @@ public class UITypeDemo01 implements GLEventListener { window.addGLEventListener(uiGLListener); window.setVisible(true); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); // animator.setUpdateFPSFrames(60, System.err); animator.add(window); diff --git a/src/demos/com/jogamp/opengl/demos/ios/Hello.java b/src/demos/com/jogamp/opengl/demos/ios/Hello.java index 5750c7b90..f7463140a 100644 --- a/src/demos/com/jogamp/opengl/demos/ios/Hello.java +++ b/src/demos/com/jogamp/opengl/demos/ios/Hello.java @@ -209,7 +209,7 @@ public class Hello { ", isCAEAGLLayer "+IOSUtil.isCAEAGLLayer(caeaglLayer)); } - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); // animator.setExclusiveContext(exclusiveContext); animator.setUpdateFPSFrames(60, System.err); animator.add(glWindow); diff --git a/src/demos/com/jogamp/opengl/demos/ios/Hello1.java b/src/demos/com/jogamp/opengl/demos/ios/Hello1.java index 5dc7b14a2..6d1e9899a 100644 --- a/src/demos/com/jogamp/opengl/demos/ios/Hello1.java +++ b/src/demos/com/jogamp/opengl/demos/ios/Hello1.java @@ -202,7 +202,7 @@ public class Hello1 { System.out.println("Choosen demo "+demo.getClass().getName()); glad.addGLEventListener(demo); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); // animator.setExclusiveContext(exclusiveContext); animator.setUpdateFPSFrames(60, System.err); animator.add(glad); diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 10b0b6b5a..b03b6956b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -45,6 +45,7 @@ import com.jogamp.common.util.InterruptSource; import com.jogamp.common.util.SourcedInterruptedException; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; /** <P> An Animator can be attached to one or more {@link GLAutoDrawable}s to drive their display() methods in a loop. </P> @@ -69,46 +70,100 @@ public class Animator extends AnimatorBase { volatile boolean stopIssued; /** - * Creates a new, empty Animator. + * Creates a new, empty Animator instance + * while expecting an AWT rendering thread if AWT is available. + * + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #Animator(int, ThreadGroup, GLAutoDrawable) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) */ public Animator() { - super(); - if(DEBUG) { - System.err.println("Animator created"); - } + this(MODE_EXPECT_AWT_RENDERING_THREAD, null, null); + } + + /** + * Creates a new, empty Animator instance + * with given modeBits. + * <p> + * Passing {@link AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD} is considered default. + * However, passing {@code 0} is recommended if not using AWT in your application. + * </p> + * + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #Animator(int, ThreadGroup, GLAutoDrawable) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) + */ + public Animator(final int modeBits) { + this(modeBits, null, null); } /** * Creates a new Animator w/ an associated ThreadGroup. + * <p> + * This ctor variant expects an AWT rendering thread if AWT is available. + * </p> + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #Animator(int, ThreadGroup, GLAutoDrawable) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) */ public Animator(final ThreadGroup tg) { - super(); - setThreadGroup(tg); - if(DEBUG) { - System.err.println("Animator created, ThreadGroup: "+threadGroup); - } + this(MODE_EXPECT_AWT_RENDERING_THREAD, tg, null); } /** * Creates a new Animator for a particular drawable. + * <p> + * This ctor variant expects an AWT rendering thread if AWT is available. + * </p> + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #Animator(int, ThreadGroup, GLAutoDrawable) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) */ public Animator(final GLAutoDrawable drawable) { - super(); - add(drawable); - if(DEBUG) { - System.err.println("Animator created, w/ "+drawable); - } + this(MODE_EXPECT_AWT_RENDERING_THREAD, null, drawable); } /** * Creates a new Animator w/ an associated ThreadGroup for a particular drawable. + * <p> + * This ctor variant expects an AWT rendering thread if AWT is available. + * </p> + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #Animator(int, ThreadGroup, GLAutoDrawable) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) */ public Animator(final ThreadGroup tg, final GLAutoDrawable drawable) { - super(); - setThreadGroup(tg); - add(drawable); + this(MODE_EXPECT_AWT_RENDERING_THREAD, tg, drawable); + } + + /** + * Creates a new Animator w/ an associated ThreadGroup for a particular drawable. + * <p> + * Passing {@link AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD} is considered default. + * However, passing {@code 0} is recommended if not using AWT in your application. + * </p> + * @param modeBits pass {@link AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD} if an AWT rendering thread is expected, otherwise {@code 0}. + * @param tg desired {@link ThreadGroup} or {@code null} + * @param drawable {@link #add(GLAutoDrawable) added} {@link GLAutoDrawable} or {@code null} + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) + */ + public Animator(final int modeBits, final ThreadGroup tg, final GLAutoDrawable drawable) { + super(modeBits); + if( null != tg ) { + setThreadGroup(tg); + } + if( null != drawable ) { + add(drawable); + } if(DEBUG) { - System.err.println("Animator created, ThreadGroup: "+threadGroup+" and "+drawable); + System.err.println("Animator created, modeBits 0x"+Integer.toHexString(modeBits)+", ThreadGroup: "+threadGroup+" and "+drawable); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java index c2da68cd9..6c776b064 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java @@ -129,10 +129,28 @@ public abstract class AnimatorBase implements GLAnimatorControl { * Creates a new, empty Animator instance * while expecting an AWT rendering thread if AWT is available. * + * @see #AnimatorBase(int) * @see GLProfile#isAWTAvailable() + * @see #setModeBits(boolean, int) */ public AnimatorBase() { - modeBits = MODE_EXPECT_AWT_RENDERING_THREAD; // default! + this( MODE_EXPECT_AWT_RENDERING_THREAD ); // default! + } + + /** + * Creates a new, empty Animator instance + * with given modeBits. + * <p> + * Passing {@link #MODE_EXPECT_AWT_RENDERING_THREAD} is considered default. + * However, passing {@code 0} is recommended if not using AWT in your application. + * </p> + * + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see GLProfile#isAWTAvailable() + * @see #setModeBits(boolean, int) + */ + public AnimatorBase(final int modeBits) { + this.modeBits = modeBits; drawablesEmpty = true; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java index 320873ede..b4dc139d4 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java @@ -44,7 +44,7 @@ import java.util.TimerTask; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLException; - +import com.jogamp.opengl.GLProfile; import com.jogamp.common.ExceptionUtils; /** @@ -71,32 +71,99 @@ public class FPSAnimator extends AnimatorBase { return "FPS" + prefix + "Animator" ; } - /** Creates an FPSAnimator with a given target frames-per-second - value. Equivalent to <code>FPSAnimator(null, fps)</code>. */ + /** + * Creates an FPSAnimator with a given target frames-per-second + * value. Equivalent to <code>FPSAnimator(null, fps)</code>. + * <p> + * This ctor variant expects an AWT rendering thread if AWT is available. + * </p> + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #FPSAnimator(int, GLAutoDrawable, int, boolean) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) + */ public FPSAnimator(final int fps) { - this(null, fps); + this(MODE_EXPECT_AWT_RENDERING_THREAD, null, fps, false); } - /** Creates an FPSAnimator with a given target frames-per-second - value and a flag indicating whether to use fixed-rate - scheduling. Equivalent to <code>FPSAnimator(null, fps, - scheduleAtFixedRate)</code>. */ + /** + * Creates an FPSAnimator with modeBits, see {@link AnimatorBase#AnimatorBase(int)} + * and a given target frames-per-second value. + * + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #FPSAnimator(int, GLAutoDrawable, int, boolean) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) + */ + public FPSAnimator(final int modeBits, final int fps) { + this(modeBits, null, fps, false); + } + + /** + * Creates an FPSAnimator with a given target frames-per-second + * value and a flag indicating whether to use fixed-rate + * scheduling. Equivalent to <code>FPSAnimator(null, fps, + * scheduleAtFixedRate)</code>. + * <p> + * This ctor variant expects an AWT rendering thread if AWT is available. + * </p> + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #FPSAnimator(int, GLAutoDrawable, int, boolean) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) + */ public FPSAnimator(final int fps, final boolean scheduleAtFixedRate) { - this(null, fps, scheduleAtFixedRate); + this(MODE_EXPECT_AWT_RENDERING_THREAD, null, fps, scheduleAtFixedRate); } - /** Creates an FPSAnimator with a given target frames-per-second - value and an initial drawable to animate. Equivalent to - <code>FPSAnimator(null, fps, false)</code>. */ + /** + * Creates an FPSAnimator with a given target frames-per-second + * value and an initial drawable to animate. Equivalent to + * <code>FPSAnimator(null, fps, false)</code>. + * <p> + * This ctor variant expects an AWT rendering thread if AWT is available. + * </p> + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #FPSAnimator(int, GLAutoDrawable, int, boolean) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) + */ public FPSAnimator(final GLAutoDrawable drawable, final int fps) { - this(drawable, fps, false); + this(MODE_EXPECT_AWT_RENDERING_THREAD, drawable, fps, false); } - /** Creates an FPSAnimator with a given target frames-per-second - value, an initial drawable to animate, and a flag indicating - whether to use fixed-rate scheduling. */ + /** + * Creates an FPSAnimator with a given target frames-per-second + * value, an initial drawable to animate, and a flag indicating + * whether to use fixed-rate scheduling. + * <p> + * This ctor variant expects an AWT rendering thread if AWT is available. + * </p> + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #FPSAnimator(int, GLAutoDrawable, int, boolean) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) + */ public FPSAnimator(final GLAutoDrawable drawable, final int fps, final boolean scheduleAtFixedRate) { - super(); + this(MODE_EXPECT_AWT_RENDERING_THREAD, drawable, fps, scheduleAtFixedRate); + } + + /** + * Creates an FPSAnimator with modeBits, see {@link AnimatorBase#AnimatorBase(int)}, a given target frames-per-second + * value, an initial drawable to animate, and a flag indicating + * whether to use fixed-rate scheduling. + * + * @param modeBits pass {@link AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD} if an AWT rendering thread is expected, otherwise {@code 0}. + * @param drawable {@link #add(GLAutoDrawable) added} {@link GLAutoDrawable} or {@code null} + * @param fps target frames per seconds + * @param scheduleAtFixedRate flag indicating fixed rate scheduling + * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD + * @see #FPSAnimator(int, GLAutoDrawable, int, boolean) + * @see GLProfile#isAWTAvailable() + * @see AnimatorBase#setModeBits(boolean, int) + */ + public FPSAnimator(final int modeBits, final GLAutoDrawable drawable, final int fps, final boolean scheduleAtFixedRate) { + super(modeBits); this.fps = fps; if (drawable != null) { add(drawable); diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java index 055e38020..6a49f8921 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java @@ -207,8 +207,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { glWindow.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); // glAnimator = new FPSAnimator(canvas, 60); - glAnimator = new Animator(); - glAnimator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); // No AWT thread involved! + glAnimator = new Animator(0 /* w/o AWT */); glAnimator.setThreadGroup(tg); glAnimator.add(glWindow); glAnimator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java index 23da67b3c..9a4ee19ef 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -247,7 +247,7 @@ public class TestTextRendererNEWT10 extends UITestCase { window.addGLEventListener(textGLListener); - final Animator anim = new Animator(); + final Animator anim = new Animator(0 /* w/o AWT */); anim.add(window); anim.start(); anim.setUpdateFPSFrames(60, null); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java index 27524a535..0fa29e190 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java @@ -76,7 +76,7 @@ public class TestBug669RecursiveGLContext01NEWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(pro); final GLWindow window = GLWindow.create(caps); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); if(anim) { animator.add(window); } @@ -107,16 +107,20 @@ public class TestBug669RecursiveGLContext01NEWT extends UITestCase { Assert.assertEquals(true, context.isCurrent()); // still current } + @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } + @Override public void init(final GLAutoDrawable drawable) { } + @Override public void dispose(final GLAutoDrawable drawable) { } + @Override public void display(final GLAutoDrawable drawable) { - final GLContextImpl context = (GLContextImpl)drawable.getContext(); - makeCurrentRecursive(context, 1); - releaseRecursive(context, 2); + final GLContextImpl context = (GLContextImpl)drawable.getContext(); + makeCurrentRecursive(context, 1); + releaseRecursive(context, 2); } }); window.addGLEventListener(new GearsES2()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java index 3acc07d8d..69301137d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java @@ -80,8 +80,8 @@ public class TestBug669RecursiveGLContext02NEWT extends UITestCase { final GLWindow window1 = GLWindow.create(caps); - final Animator animator1 = new Animator(); - final Animator animator2 = new Animator(); + final Animator animator1 = new Animator(0 /* w/o AWT */); + final Animator animator2 = new Animator(0 /* w/o AWT */); if(anim) { animator1.add(window1); animator2.add(window2); @@ -92,15 +92,19 @@ public class TestBug669RecursiveGLContext02NEWT extends UITestCase { window1.setPosition(250, 0); window1.setSize(200, 200); window1.addGLEventListener(new GLEventListener() { - public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } + @Override + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } - public void init(final GLAutoDrawable drawable) { } + @Override + public void init(final GLAutoDrawable drawable) { } - public void dispose(final GLAutoDrawable drawable) { } + @Override + public void dispose(final GLAutoDrawable drawable) { } - public void display(final GLAutoDrawable drawable) { - window2.display(); - } + @Override + public void display(final GLAutoDrawable drawable) { + window2.display(); + } }); window1.addGLEventListener(new GearsES2()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java index b0b9b53e4..fa2e7d009 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java @@ -176,8 +176,11 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { glWindow.addGLEventListener(mixerDemo); glWindow.addGLEventListener(new GLEventListener() { int i=0, c=0; + @Override public void init(final GLAutoDrawable drawable) {} + @Override public void dispose(final GLAutoDrawable drawable) {} + @Override public void display(final GLAutoDrawable drawable) { if(mainRun) return; @@ -200,6 +203,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { } } } + @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { fbod1.setSurfaceSize(width, height); fbod2.setSurfaceSize(width, height); @@ -210,7 +214,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { animator0.add(fbod1); animator0.add(fbod2); - final Animator animator1 = new Animator(); + final Animator animator1 = new Animator(0 /* w/o AWT */); animator1.add(glWindow); final QuitAdapter quitAdapter = new QuitAdapter(); @@ -221,9 +225,11 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { + @Override public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } + @Override public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java index 2bc512fa0..c3ac0d619 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java @@ -162,8 +162,11 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { glWindow.addGLEventListener(mixerDemo); glWindow.addGLEventListener(new GLEventListener() { int i=0, c=0; + @Override public void init(final GLAutoDrawable drawable) {} + @Override public void dispose(final GLAutoDrawable drawable) {} + @Override public void display(final GLAutoDrawable drawable) { if(mainRun) return; @@ -186,10 +189,11 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { } } } + @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); - final Animator animator1 = new Animator(); + final Animator animator1 = new Animator(0 /* w/o AWT */); animator1.add(fbod1); animator1.add(glWindow); @@ -201,9 +205,11 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { + @Override public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } + @Override public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java index 4432fad3e..8d05c6ee2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java @@ -100,6 +100,7 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase { }; window.setWindowDestroyNotifyAction( new Runnable() { + @Override public void run() { glad.windowDestroyNotifyOp(); } } ); @@ -124,9 +125,8 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase { window.addKeyListener(quitAdapter); window.addWindowListener(quitAdapter); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(60, System.err); - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.add(glad); animator.start(); Assert.assertTrue(animator.isStarted()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java index 2ac493dbc..2b875fe14 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java @@ -72,6 +72,7 @@ public class TestNVSwapGroupNEWT extends UITestCase { final GearsES2 gears = new GearsES2(1); glWindow.addGLEventListener(new GLEventListener() { + @Override public void init(final GLAutoDrawable drawable) { final int[] maxVals = new int[] { -1, -1 } ; final GLContext glc = drawable.getContext(); @@ -84,8 +85,11 @@ public class TestNVSwapGroupNEWT extends UITestCase { } } } + @Override public void dispose(final GLAutoDrawable drawable) {} + @Override public void display(final GLAutoDrawable drawable) {} + @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }); @@ -108,7 +112,7 @@ public class TestNVSwapGroupNEWT extends UITestCase { final int swap_group = 9999; final int swap_barrier = 9999; - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLWindow f1 = runTestGL(animator, 0, 0, swap_group, swap_barrier); final InsetsImmutable insets = f1.getInsets(); final GLWindow f2 = runTestGL(animator, width+insets.getTotalWidth(), 0, swap_group, swap_barrier); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java index 263e78def..9b26a2e16 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java @@ -116,7 +116,7 @@ public class TestSharedContextListNEWT extends UITestCase { @Test public void test01() throws InterruptedException { initShared(); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLWindow f1 = runTestGL(animator, 0, 0, true, false); final InsetsImmutable insets = f1.getInsets(); final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java index 095b03207..f4e2d0754 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java @@ -119,11 +119,11 @@ public class TestSharedContextListNEWT2 extends UITestCase { public void test01() throws InterruptedException { initShared(); - final GLWindow f1 = runTestGL(new Animator(), 0, 0, true, false); + final GLWindow f1 = runTestGL(new Animator(0 /* w/o AWT */), 0, 0, true, false); final InsetsImmutable insets = f1.getInsets(); - final GLWindow f2 = runTestGL(new Animator(), f1.getX()+width+insets.getTotalWidth(), + final GLWindow f2 = runTestGL(new Animator(0 /* w/o AWT */), f1.getX()+width+insets.getTotalWidth(), f1.getY()+0, true, false); - final GLWindow f3 = runTestGL(new Animator(), f1.getX()+0, + final GLWindow f3 = runTestGL(new Animator(0 /* w/o AWT */), f1.getX()+0, f1.getY()+height+insets.getTotalHeight(), true, false); try { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java index a6406d4a0..3fd5415d6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java @@ -156,7 +156,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { @Test public void test01() throws InterruptedException { initShared(); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLWindow f1 = runTestGL(animator, 0, 0, true, false); final InsetsImmutable insets = f1.getInsets(); final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java index 88099f578..2b7118ed4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java @@ -110,7 +110,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { testCommonAnimatorSharedImpl(true); } private void testCommonAnimatorSharedImpl(final boolean useMappedBuffers) throws InterruptedException { - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); // // 1st diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java index 7b06fcc5d..63dff5b91 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java @@ -176,7 +176,7 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { @Test public void test01CommonAnimatorSharedOnscreen() throws InterruptedException { initShared(true); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLWindow f1 = runTestGL(animator, 0, 0, true, false); final InsetsImmutable insets = f1.getInsets(); final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), @@ -209,9 +209,9 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { @Test public void test02EachWithAnimatorSharedOnscreen() throws InterruptedException { initShared(true); - final Animator animator1 = new Animator(); - final Animator animator2 = new Animator(); - final Animator animator3 = new Animator(); + final Animator animator1 = new Animator(0 /* w/o AWT */); + final Animator animator2 = new Animator(0 /* w/o AWT */); + final Animator animator3 = new Animator(0 /* w/o AWT */); final GLWindow f1 = runTestGL(animator1, 0, 0, true, false); final InsetsImmutable insets = f1.getInsets(); final GLWindow f2 = runTestGL(animator2, f1.getX()+width+insets.getTotalWidth(), @@ -247,7 +247,7 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { @Test public void test11CommonAnimatorSharedOffscreen() throws InterruptedException { initShared(false); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLWindow f1 = runTestGL(animator, 0, 0, true, false); final InsetsImmutable insets = f1.getInsets(); final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), @@ -280,9 +280,9 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { @Test public void test12EachWithAnimatorSharedOffscreen() throws InterruptedException { initShared(false); - final Animator animator1 = new Animator(); - final Animator animator2 = new Animator(); - final Animator animator3 = new Animator(); + final Animator animator1 = new Animator(0 /* w/o AWT */); + final Animator animator2 = new Animator(0 /* w/o AWT */); + final Animator animator3 = new Animator(0 /* w/o AWT */); final GLWindow f1 = runTestGL(animator1, 0, 0, true, false); final InsetsImmutable insets = f1.getInsets(); final GLWindow f2 = runTestGL(animator2, f1.getX()+width+insets.getTotalWidth(), diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java index 05ee9bab4..e4dd026db 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java @@ -104,7 +104,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { } public void syncedOneAnimator(final boolean destroyCleanOrder) throws InterruptedException { - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.start(); final GearsES2 g1 = new GearsES2(0); @@ -222,7 +222,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { } public void asyncEachAnimator(final boolean destroyCleanOrder) throws InterruptedException { - final Animator a1 = new Animator(); + final Animator a1 = new Animator(0 /* w/o AWT */); final GearsES2 g1 = new GearsES2(0); g1.setSyncObjects(g1); // this is master, since rendered we must use it as sync final GLWindow f1 = createGLWindow(0, 0, g1); @@ -231,7 +231,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { final InsetsImmutable insets = f1.getInsets(); - final Animator a2 = new Animator(); + final Animator a2 = new Animator(0 /* w/o AWT */); final GearsES2 g2 = new GearsES2(0); g2.setSharedGears(g1); // also uses master g1 as sync, if required final GLWindow f2 = createGLWindow(f1.getX()+width+insets.getTotalWidth(), @@ -241,7 +241,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { a2.start(); f2.setVisible(true); - final Animator a3 = new Animator(); + final Animator a3 = new Animator(0 /* w/o AWT */); final GearsES2 g3 = new GearsES2(0); g3.setSharedGears(g1); // also uses master g1 as sync, if required final GLWindow f3 = createGLWindow(f1.getX()+0, diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java index 685ecf308..6291bc87b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java @@ -112,7 +112,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { } public void syncedOneAnimator(final boolean destroyCleanOrder, final boolean useMappedBuffers) throws InterruptedException { - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.start(); final GearsES2 g1 = new GearsES2(0); @@ -265,7 +265,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { } public void asyncEachAnimator(final boolean destroyCleanOrder, final boolean useMappedBuffers) throws InterruptedException { - final Animator a1 = new Animator(); + final Animator a1 = new Animator(0 /* w/o AWT */); final GearsES2 g1 = new GearsES2(0); g1.setSyncObjects(g1); // this is master, since rendered we must use it as sync g1.setUseMappedBuffers(useMappedBuffers); @@ -276,7 +276,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { final InsetsImmutable insets = f1.getInsets(); - final Animator a2 = new Animator(); + final Animator a2 = new Animator(0 /* w/o AWT */); final GearsES2 g2 = new GearsES2(0); g2.setSharedGears(g1); // also uses master g1 as sync, if required final GLWindow f2 = createGLWindow(f1.getX()+width+insets.getTotalWidth(), @@ -306,7 +306,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true, null)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); - final Animator a3 = new Animator(); + final Animator a3 = new Animator(0 /* w/o AWT */); final GearsES2 g3 = new GearsES2(0); g3.setSharedGears(g1); // also uses master g1 as sync, if required final GLWindow f3 = createGLWindow(f1.getX()+0, diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java index 840d732c0..6be45ba5f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java @@ -96,7 +96,7 @@ public class TestSharedContextVBOES2NEWT4 extends UITestCase { @Test public void test01() throws InterruptedException { - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.start(); final GearsES2 g1 = new GearsES2(0); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT5.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT5.java index 8317bb0c1..2d039d3ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT5.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT5.java @@ -101,7 +101,7 @@ public class TestSharedContextVBOES2NEWT5 extends UITestCase { public void asyncEachAnimator(final boolean destroyCleanOrder, final int loops) throws InterruptedException { // master - final Animator a1 = new Animator(); + final Animator a1 = new Animator(0 /* w/o AWT */); final GearsES2 g1 = new GearsES2(0); g1.setVerbose(false); g1.setSyncObjects(g1); // this is master, since rendered we must use it as sync @@ -130,7 +130,7 @@ public class TestSharedContextVBOES2NEWT5 extends UITestCase { final GLWindow[] sf = new GLWindow[slaveCount]; final GLContext[] sc = new GLContext[slaveCount]; for(int i=0; i<slaveCount; i++) { - final Animator a2 = new Animator(); + final Animator a2 = new Animator(0 /* w/o AWT */); final GearsES2 g2 = new GearsES2(0); g2.setVerbose(false); g2.setSharedGears(g1); // also uses master g1 as sync, if required diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java index 4ee80946e..1b72eda9b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java @@ -82,7 +82,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { @Test public void test01SyncedOneAnimator() throws InterruptedException, InvocationTargetException { final GLCapabilities caps = new GLCapabilities(null); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.start(); Assert.assertEquals(true, animator.isStarted()); Assert.assertEquals(true, animator.isPaused()); @@ -162,7 +162,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { @Test public void test02AsyncEachAnimator() throws InterruptedException, InvocationTargetException { final GLCapabilities caps = new GLCapabilities(null); - final Animator a1 = new Animator(); + final Animator a1 = new Animator(0 /* w/o AWT */); final GearsES2 g1 = new GearsES2(0); final GLWindow c1 = createGLWindow(caps, 0, 0, g1); a1.add(c1); @@ -172,7 +172,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { Assert.assertEquals(true, a1.isAnimating()); c1.setVisible(true); - final Animator a2 = new Animator(); + final Animator a2 = new Animator(0 /* w/o AWT */); final GearsES2 g2 = new GearsES2(0); final GLWindow c2 = createGLWindow(caps, c1.getX()+width, c1.getY()+0, g2); a2.add(c2); @@ -182,7 +182,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { Assert.assertEquals(true, a2.isAnimating()); c2.setVisible(true); - final Animator a3 = new Animator(); + final Animator a3 = new Animator(0 /* w/o AWT */); final GearsES2 g3 = new GearsES2(0); final GLWindow c3 = createGLWindow(caps, c1.getX()+0, c1.getY()+height, g3); a3.add(c3); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java index a90dc0a5a..fdfb90944 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java @@ -45,7 +45,7 @@ public class TestExclusiveContext01VSyncAnimNEWT extends ExclusiveContextBase00N @Override protected AnimatorBase createAnimator() { - return new Animator(); + return new Animator(0 /* w/o AWT */); } public static void main(final String args[]) throws IOException { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java index 08d385dc3..e328d1544 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java @@ -45,7 +45,7 @@ public class TestExclusiveContext11VSyncAnimNEWT extends ExclusiveContextBase10N @Override protected AnimatorBase createAnimator() { - return new Animator(); + return new Animator(0 /* w/o AWT */); } public static void main(final String args[]) throws IOException { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java index 393bff746..12c2b16ce 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java @@ -111,6 +111,7 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { }; window.setWindowDestroyNotifyAction( new Runnable() { + @Override public void run() { glad.windowDestroyNotifyOp(); } } ); @@ -170,7 +171,7 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { glad1.addGLEventListener(snapshotGLEventListener); snapshotGLEventListener.setMakeSnapshot(); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.add(glad1); animator.add(glad2); animator.start(); @@ -231,7 +232,7 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { glWindow2.setPosition(2*64+width, 64); glWindow2.addWindowListener(quitAdapter); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.add(glWindow1); animator.add(glWindow2); animator.start(); @@ -308,7 +309,7 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { glWindow2.addGLEventListener(snapshotGLEventListener2); glWindow2.addWindowListener(quitAdapter); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.add(glWindow1); animator.add(glWindow2); animator.start(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java index df712ee4e..a975db79b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java @@ -164,7 +164,7 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase { private void testGLADDelegateImpl(final GLCapabilities caps) throws InterruptedException { final GLEventListenerCounter glelCounter = new GLEventListenerCounter(); final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.start(); final GLEventListenerState glls1; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java index 35970bc1e..8195dc807 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java @@ -87,608 +87,608 @@ import com.jogamp.opengl.test.junit.util.UITestCase; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { - static int framesPerTest = 240; // frames + static int framesPerTest = 240; // frames - static class MiniPApplet extends Applet implements MouseMotionListener, KeyListener { - private static final long serialVersionUID = 1L; + static class MiniPApplet extends Applet implements MouseMotionListener, KeyListener { + private static final long serialVersionUID = 1L; - ///////////////////////////////////////////////////////////// - // - // Test parameters + ///////////////////////////////////////////////////////////// + // + // Test parameters - public int frameRate = 120; - public int numSamples = 4; + public int frameRate = 120; + public int numSamples = 4; - public boolean fullScreen = false; - public boolean useAnimator = true; - public boolean resizeableFrame = true; + public boolean fullScreen = false; + public boolean useAnimator = true; + public boolean resizeableFrame = true; - public boolean restartCanvas = true; - public int restartTimeout = 100; // in number of frames. + public boolean restartCanvas = true; + public int restartTimeout = 100; // in number of frames. - public boolean printThreadInfo = false; - public boolean printEventInfo = false; + public boolean printThreadInfo = false; + public boolean printEventInfo = false; - ///////////////////////////////////////////////////////////// - // - // Internal variables + ///////////////////////////////////////////////////////////// + // + // Internal variables - int width; - int height; + int width; + int height; - String OPENGL_VENDOR; - String OPENGL_RENDERER; - String OPENGL_VERSION; - String OPENGL_EXTENSIONS; + String OPENGL_VENDOR; + String OPENGL_RENDERER; + String OPENGL_VERSION; + String OPENGL_EXTENSIONS; - int currentSamples = -1; + int currentSamples = -1; - private Frame frame; - private GLProfile profile; - private GLCapabilities capabilities; - private GLCanvas canvas; + private Frame frame; + private GLProfile profile; + private GLCapabilities capabilities; + private GLCanvas canvas; - private SimpleListener listener; - private CustomAnimator animator; + private SimpleListener listener; + private CustomAnimator animator; - private long beforeTime; - private long overSleepTime; - private final long frameRatePeriod = 1000000000L / frameRate; + private long beforeTime; + private long overSleepTime; + private final long frameRatePeriod = 1000000000L / frameRate; - private boolean initialized = false; - private boolean osxCALayerAWTModBug = false; - boolean justInitialized = true; + private boolean initialized = false; + private boolean osxCALayerAWTModBug = false; + boolean justInitialized = true; - private double theta = 0; - private double s = 0; - private double c = 0; + private double theta = 0; + private double s = 0; + private double c = 0; - private long millisOffset; - private int fcount, lastm; - private float frate; - private final int fint = 3; + private long millisOffset; + private int fcount, lastm; + private float frate; + private final int fint = 3; - private boolean setFramerate = false; - private boolean restarted = false; + private boolean setFramerate = false; + private boolean restarted = false; - private int frameCount = 0; + private int frameCount = 0; - void run() throws InterruptedException, InvocationTargetException { - // Thread loop = new Thread("Animation Thread") { - // public void run() { + void run() throws InterruptedException, InvocationTargetException { + // Thread loop = new Thread("Animation Thread") { + // public void run() { frameCount = 0; while ( frameCount < framesPerTest ) { - if (!initialized) { - setup(); - } - - if (restartCanvas && restartTimeout == frameCount) { - restart(); - } - - if (useAnimator) { - animator.requestRender(); - } else { - canvas.display(); - } - - clock(); - - frameCount++; - if( null == frame ) { - break; - } + if (!initialized) { + setup(); + } + + if (restartCanvas && restartTimeout == frameCount) { + restart(); + } + + if (useAnimator) { + animator.requestRender(); + } else { + canvas.display(); + } + + clock(); + + frameCount++; + if( null == frame ) { + break; + } } dispose(); - // } - // }; - // loop.start(); - } - - void setup() throws InterruptedException, InvocationTargetException { - if (printThreadInfo) System.out.println("Current thread at setup(): " + Thread.currentThread()); - - millisOffset = System.currentTimeMillis(); - - final VersionNumber version170 = new VersionNumber(1, 7, 0); - osxCALayerAWTModBug = Platform.OSType.MACOS == Platform.getOSType() && - 0 > Platform.getJavaVersionNumber().compareTo(version170); - System.err.println("OSX CALayer AWT-Mod Bug "+osxCALayerAWTModBug); - System.err.println("OSType "+Platform.getOSType()); - System.err.println("Java Version "+Platform.getJavaVersionNumber()); - - // Frame setup ---------------------------------------------------------- - - width = 300; - height = 300; - final MiniPApplet applet = this; - - final GraphicsEnvironment environment = - GraphicsEnvironment.getLocalGraphicsEnvironment(); - final GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); - frame = new Frame(displayDevice.getDefaultConfiguration()); - - final Rectangle fullScreenRect; - if (fullScreen) { - final DisplayMode mode = displayDevice.getDisplayMode(); - fullScreenRect = new Rectangle(0, 0, mode.getWidth(), mode.getHeight()); - } else { - fullScreenRect = null; + // } + // }; + // loop.start(); } - // All AWT Mods on AWT-EDT, especially due to the follow-up complicated code! - AWTEDTExecutor.singleton.invoke(true, new Runnable() { - @Override - public void run() { - frame.setTitle("MiniPApplet"); - } } ); - if (fullScreen) { - try { - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - frame.setUndecorated(true); - frame.setBackground(Color.GRAY); - frame.setBounds(fullScreenRect); - frame.setVisible(true); - }}); - } catch (final Throwable t) { - t.printStackTrace(); - Assume.assumeNoException(t); - } - } - try { - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - frame.setLayout(null); - frame.add(applet); + + void setup() throws InterruptedException, InvocationTargetException { + if (printThreadInfo) System.out.println("Current thread at setup(): " + Thread.currentThread()); + + millisOffset = System.currentTimeMillis(); + + final VersionNumber version170 = new VersionNumber(1, 7, 0); + osxCALayerAWTModBug = Platform.OSType.MACOS == Platform.getOSType() && + 0 > Platform.getJavaVersionNumber().compareTo(version170); + System.err.println("OSX CALayer AWT-Mod Bug "+osxCALayerAWTModBug); + System.err.println("OSType "+Platform.getOSType()); + System.err.println("Java Version "+Platform.getJavaVersionNumber()); + + // Frame setup ---------------------------------------------------------- + + width = 300; + height = 300; + final MiniPApplet applet = this; + + final GraphicsEnvironment environment = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + final GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); + frame = new Frame(displayDevice.getDefaultConfiguration()); + + final Rectangle fullScreenRect; if (fullScreen) { - frame.invalidate(); + final DisplayMode mode = displayDevice.getDisplayMode(); + fullScreenRect = new Rectangle(0, 0, mode.getWidth(), mode.getHeight()); } else { - frame.pack(); + fullScreenRect = null; } - frame.setResizable(resizeableFrame); + // All AWT Mods on AWT-EDT, especially due to the follow-up complicated code! + AWTEDTExecutor.singleton.invoke(true, new Runnable() { + @Override + public void run() { + frame.setTitle("MiniPApplet"); + } } ); if (fullScreen) { - // After the pack(), the screen bounds are gonna be 0s - frame.setBounds(fullScreenRect); - applet.setBounds((fullScreenRect.width - applet.width) / 2, - (fullScreenRect.height - applet.height) / 2, - applet.width, applet.height); - } else { - final Insets insets = frame.getInsets(); - - final int windowW = applet.width + insets.left + insets.right; - final int windowH = applet.height + insets.top + insets.bottom; - final int locationX = 100; - final int locationY = 100; + try { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame.setUndecorated(true); + frame.setBackground(Color.GRAY); + frame.setBounds(fullScreenRect); + frame.setVisible(true); + }}); + } catch (final Throwable t) { + t.printStackTrace(); + Assume.assumeNoException(t); + } + } + try { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame.setLayout(null); + frame.add(applet); + if (fullScreen) { + frame.invalidate(); + } else { + frame.pack(); + } + frame.setResizable(resizeableFrame); + if (fullScreen) { + // After the pack(), the screen bounds are gonna be 0s + frame.setBounds(fullScreenRect); + applet.setBounds((fullScreenRect.width - applet.width) / 2, + (fullScreenRect.height - applet.height) / 2, + applet.width, applet.height); + } else { + final Insets insets = frame.getInsets(); + + final int windowW = applet.width + insets.left + insets.right; + final int windowH = applet.height + insets.top + insets.bottom; + final int locationX = 100; + final int locationY = 100; + + frame.setSize(windowW, windowH); + frame.setLocation(locationX, locationY); + + final int usableWindowH = windowH - insets.top - insets.bottom; + applet.setBounds((windowW - width)/2, insets.top + (usableWindowH - height)/2, width, height); + } + }}); + } catch (final Throwable t) { + t.printStackTrace(); + Assume.assumeNoException(t); + } - frame.setSize(windowW, windowH); - frame.setLocation(locationX, locationY); - final int usableWindowH = windowH - insets.top - insets.bottom; - applet.setBounds((windowW - width)/2, insets.top + (usableWindowH - height)/2, width, height); + frame.add(this); + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(final WindowEvent e) { + try { + dispose(); + } catch (final Exception ex) { + Assume.assumeNoException(ex); + } + } + }); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + frame.setVisible(true); + } } ); + + // Canvas setup ---------------------------------------------------------- + + profile = GLProfile.getDefault(); + capabilities = new GLCapabilities(profile); + capabilities.setSampleBuffers(true); + capabilities.setNumSamples(numSamples); + capabilities.setDepthBits(24); + // capabilities.setStencilBits(8); // No Stencil on OSX w/ hw-accel ! + capabilities.setAlphaBits(8); + + canvas = new GLCanvas(capabilities); + canvas.setBounds(0, 0, width, height); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + MiniPApplet.this.setLayout(new BorderLayout()); + MiniPApplet.this.add(canvas, BorderLayout.CENTER); + MiniPApplet.this.validate(); + } } ); + canvas.addMouseMotionListener(this); + canvas.addKeyListener(this); + + // Setting up animation + listener = new SimpleListener(); + canvas.addGLEventListener(listener); + if (useAnimator) { + animator = new CustomAnimator(canvas); + animator.start(); } - }}); - } catch (final Throwable t) { - t.printStackTrace(); - Assume.assumeNoException(t); + initialized = true; } + void restart() throws InterruptedException, InvocationTargetException { + System.out.println("Restarting surface..."); - frame.add(this); - frame.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(final WindowEvent e) { - try { - dispose(); - } catch (final Exception ex) { - Assume.assumeNoException(ex); - } - } - }); + // Stopping animation, removing current canvas. + if (useAnimator) { + animator.stop(); + animator.remove(canvas); + } + canvas.disposeGLEventListener(listener, true); + this.remove(canvas); - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - frame.setVisible(true); - } } ); + capabilities = new GLCapabilities(profile); + capabilities.setSampleBuffers(true); + capabilities.setNumSamples(numSamples); - // Canvas setup ---------------------------------------------------------- + canvas = new GLCanvas(capabilities); + canvas.setBounds(0, 0, width, height); - profile = GLProfile.getDefault(); - capabilities = new GLCapabilities(profile); - capabilities.setSampleBuffers(true); - capabilities.setNumSamples(numSamples); - capabilities.setDepthBits(24); - // capabilities.setStencilBits(8); // No Stencil on OSX w/ hw-accel ! - capabilities.setAlphaBits(8); + // Setting up animation again + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + MiniPApplet.this.setLayout(new BorderLayout()); + MiniPApplet.this.add(canvas, BorderLayout.CENTER); + MiniPApplet.this.validate(); + } } ); + canvas.addMouseMotionListener(this); + canvas.addKeyListener(this); - canvas = new GLCanvas(capabilities); - canvas.setBounds(0, 0, width, height); + canvas.addGLEventListener(listener); + if (useAnimator) { + animator.add(canvas); + animator.start(); + } - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - MiniPApplet.this.setLayout(new BorderLayout()); - MiniPApplet.this.add(canvas, BorderLayout.CENTER); - MiniPApplet.this.validate(); - } } ); - canvas.addMouseMotionListener(this); - canvas.addKeyListener(this); - - // Setting up animation - listener = new SimpleListener(); - canvas.addGLEventListener(listener); - if (useAnimator) { - animator = new CustomAnimator(canvas); - animator.start(); + setFramerate = false; + restarted = true; + + System.out.println("Done"); } - initialized = true; - } - void restart() throws InterruptedException, InvocationTargetException { - System.out.println("Restarting surface..."); + void dispose() throws InterruptedException, InvocationTargetException { + if( null == frame ) { + return; + } - // Stopping animation, removing current canvas. - if (useAnimator) { - animator.stop(); - animator.remove(canvas); + // Stopping animation, removing current canvas. + if (useAnimator) { + animator.stop(); + animator.remove(canvas); + } + canvas.removeGLEventListener(listener); + if( EventQueue.isDispatchThread() ) { + MiniPApplet.this.remove(canvas); + frame.remove(MiniPApplet.this); + frame.validate(); + frame.dispose(); + frame = null; + } else { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + MiniPApplet.this.remove(canvas); + frame.remove(MiniPApplet.this); + frame.validate(); + frame.dispose(); + frame = null; + }}); + } } - canvas.disposeGLEventListener(listener, true); - this.remove(canvas); - capabilities = new GLCapabilities(profile); - capabilities.setSampleBuffers(true); - capabilities.setNumSamples(numSamples); + void draw(final GL2 gl) { + if( !osxCALayerAWTModBug || !justInitialized ) { + AWTEDTExecutor.singleton.invoke(true, new Runnable() { + @Override + public void run() { + frame.setTitle("frame " + frameCount); + } } ); + } - canvas = new GLCanvas(capabilities); - canvas.setBounds(0, 0, width, height); + if (printThreadInfo) System.out.println("Current thread at draw(): " + Thread.currentThread()); + + if (OPENGL_VENDOR == null) { + OPENGL_VENDOR = gl.glGetString(GL.GL_VENDOR); + OPENGL_RENDERER = gl.glGetString(GL.GL_RENDERER); + OPENGL_VERSION = gl.glGetString(GL.GL_VERSION); + OPENGL_EXTENSIONS = gl.glGetString(GL.GL_EXTENSIONS); + System.out.println(OPENGL_VENDOR); + System.out.println(OPENGL_RENDERER); + System.out.println(OPENGL_VERSION); + System.out.println(OPENGL_EXTENSIONS); + + final int[] temp = { 0 }; + gl.glGetIntegerv(GL.GL_MAX_SAMPLES, temp, 0); + System.out.println("Maximum number of samples supported by the hardware: " + temp[0]); + System.out.println("Frame: "+frame); + System.out.println("Applet: "+MiniPApplet.this); + System.out.println("GLCanvas: "+canvas); + System.out.println("GLDrawable: "+canvas.getDelegatedDrawable()); + } - // Setting up animation again - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - MiniPApplet.this.setLayout(new BorderLayout()); - MiniPApplet.this.add(canvas, BorderLayout.CENTER); - MiniPApplet.this.validate(); - } } ); - canvas.addMouseMotionListener(this); - canvas.addKeyListener(this); - - canvas.addGLEventListener(listener); - if (useAnimator) { - animator.add(canvas); - animator.start(); - } + if (currentSamples == -1) { + final int[] temp = { 0 }; + gl.glGetIntegerv(GL.GL_SAMPLES, temp, 0); + currentSamples = temp[0]; + if (numSamples != currentSamples) { + System.err.println("Requested sampling level " + numSamples + " not supported. Using " + currentSamples + " samples instead."); + } + } - setFramerate = false; - restarted = true; + if (!setFramerate) { + if (60 < frameRate) { + // Disables vsync + gl.setSwapInterval(0); + } else if (30 < frameRate) { + gl.setSwapInterval(1); + } else { + gl.setSwapInterval(2); + } + setFramerate = true; + } - System.out.println("Done"); - } + if (restarted) { + final int[] temp = { 0 }; + gl.glGetIntegerv(GL.GL_SAMPLES, temp, 0); + if (numSamples != temp[0]) { + System.err.println("Multisampling level requested " + numSamples + " not supported. Using " + temp[0] + "samples instead."); + } + } - void dispose() throws InterruptedException, InvocationTargetException { - if( null == frame ) { - return; + gl.glClearColor(0, 0, 0, 1); + gl.glClear(GL.GL_COLOR_BUFFER_BIT); + + theta += 0.01; + s = Math.sin(theta); + c = Math.cos(theta); + + gl.glBegin(GL.GL_TRIANGLES); + gl.glColor3f(1, 0, 0); + gl.glVertex2d(-c, -c); + gl.glColor3f(0, 1, 0); + gl.glVertex2d(0, c); + gl.glColor3f(0, 0, 1); + gl.glVertex2d(s, -s); + gl.glEnd(); + + gl.glFlush(); + + fcount += 1; + final int m = (int) (System.currentTimeMillis() - millisOffset); + if (m - lastm > 1000 * fint) { + frate = (float)(fcount) / fint; + fcount = 0; + lastm = m; + System.err.println("fps: " + frate); + } } - // Stopping animation, removing current canvas. - if (useAnimator) { - animator.stop(); - animator.remove(canvas); - } - canvas.removeGLEventListener(listener); - if( EventQueue.isDispatchThread() ) { - MiniPApplet.this.remove(canvas); - frame.remove(MiniPApplet.this); - frame.validate(); - frame.dispose(); - frame = null; - } else { - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - MiniPApplet.this.remove(canvas); - frame.remove(MiniPApplet.this); - frame.validate(); - frame.dispose(); - frame = null; - }}); + void clock() { + final long afterTime = Clock.currentNanos(); + final long timeDiff = afterTime - beforeTime; + final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; + + if (sleepTime > 0) { // some time left in this cycle + try { + Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L)); + } catch (final InterruptedException ex) { } + + overSleepTime = (Clock.currentNanos() - afterTime) - sleepTime; + + } else { // sleepTime <= 0; the frame took longer than the period + overSleepTime = 0L; + } + + beforeTime = Clock.currentNanos(); } - } - void draw(final GL2 gl) { - if( !osxCALayerAWTModBug || !justInitialized ) { - AWTEDTExecutor.singleton.invoke(true, new Runnable() { - @Override - public void run() { - frame.setTitle("frame " + frameCount); - } } ); + class SimpleListener implements GLEventListener { + @Override + public void display(final GLAutoDrawable drawable) { + draw(drawable.getGL().getGL2()); + justInitialized = false; + } + + @Override + public void dispose(final GLAutoDrawable drawable) { } + + @Override + public void init(final GLAutoDrawable drawable) { + justInitialized = true; + } + + @Override + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) { } } - if (printThreadInfo) System.out.println("Current thread at draw(): " + Thread.currentThread()); - - if (OPENGL_VENDOR == null) { - OPENGL_VENDOR = gl.glGetString(GL.GL_VENDOR); - OPENGL_RENDERER = gl.glGetString(GL.GL_RENDERER); - OPENGL_VERSION = gl.glGetString(GL.GL_VERSION); - OPENGL_EXTENSIONS = gl.glGetString(GL.GL_EXTENSIONS); - System.out.println(OPENGL_VENDOR); - System.out.println(OPENGL_RENDERER); - System.out.println(OPENGL_VERSION); - System.out.println(OPENGL_EXTENSIONS); - - final int[] temp = { 0 }; - gl.glGetIntegerv(GL.GL_MAX_SAMPLES, temp, 0); - System.out.println("Maximum number of samples supported by the hardware: " + temp[0]); - System.out.println("Frame: "+frame); - System.out.println("Applet: "+MiniPApplet.this); - System.out.println("GLCanvas: "+canvas); - System.out.println("GLDrawable: "+canvas.getDelegatedDrawable()); + @Override + public void mouseDragged(final MouseEvent ev) { + if (printEventInfo) { + System.err.println("Mouse dragged event: " + ev); + } } - if (currentSamples == -1) { - final int[] temp = { 0 }; - gl.glGetIntegerv(GL.GL_SAMPLES, temp, 0); - currentSamples = temp[0]; - if (numSamples != currentSamples) { - System.err.println("Requested sampling level " + numSamples + " not supported. Using " + currentSamples + " samples instead."); - } + @Override + public void mouseMoved(final MouseEvent ev) { + if (printEventInfo) { + System.err.println("Mouse moved event: " + ev); + } } - if (!setFramerate) { - if (60 < frameRate) { - // Disables vsync - gl.setSwapInterval(0); - } else if (30 < frameRate) { - gl.setSwapInterval(1); - } else { - gl.setSwapInterval(2); - } - setFramerate = true; + @Override + public void keyPressed(final KeyEvent ev) { + if (printEventInfo) { + System.err.println("Key pressed event: " + ev); + } } - if (restarted) { - final int[] temp = { 0 }; - gl.glGetIntegerv(GL.GL_SAMPLES, temp, 0); - if (numSamples != temp[0]) { - System.err.println("Multisampling level requested " + numSamples + " not supported. Using " + temp[0] + "samples instead."); - } + @Override + public void keyReleased(final KeyEvent ev) { + if (printEventInfo) { + System.err.println("Key released event: " + ev); + } } - gl.glClearColor(0, 0, 0, 1); - gl.glClear(GL.GL_COLOR_BUFFER_BIT); - - theta += 0.01; - s = Math.sin(theta); - c = Math.cos(theta); - - gl.glBegin(GL.GL_TRIANGLES); - gl.glColor3f(1, 0, 0); - gl.glVertex2d(-c, -c); - gl.glColor3f(0, 1, 0); - gl.glVertex2d(0, c); - gl.glColor3f(0, 0, 1); - gl.glVertex2d(s, -s); - gl.glEnd(); - - gl.glFlush(); - - fcount += 1; - final int m = (int) (System.currentTimeMillis() - millisOffset); - if (m - lastm > 1000 * fint) { - frate = (float)(fcount) / fint; - fcount = 0; - lastm = m; - System.err.println("fps: " + frate); + @Override + public void keyTyped(final KeyEvent ev) { + if (printEventInfo) { + System.err.println("Key typed event: " + ev); + } } - } - void clock() { - final long afterTime = Clock.currentNanos(); - final long timeDiff = afterTime - beforeTime; - final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; + /** An Animator subclass which renders one frame at the time + * upon calls to the requestRender() method. + **/ + public static class CustomAnimator extends AnimatorBase { + private Timer timer = null; + private TimerTask task = null; + private volatile boolean shouldRun; - if (sleepTime > 0) { // some time left in this cycle - try { - Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L)); - } catch (final InterruptedException ex) { } + @Override + protected String getBaseName(final String prefix) { + return "Custom" + prefix + "Animator" ; + } - overSleepTime = (Clock.currentNanos() - afterTime) - sleepTime; + /** Creates an CustomAnimator with an initial drawable to + * animate. */ + public CustomAnimator(final GLAutoDrawable drawable) { + if (drawable != null) { + add(drawable); + } + } - } else { // sleepTime <= 0; the frame took longer than the period - overSleepTime = 0L; - } + public synchronized void requestRender() { + shouldRun = true; + } - beforeTime = Clock.currentNanos(); - } + @Override + public final synchronized boolean isStarted() { + return (timer != null); + } - class SimpleListener implements GLEventListener { - @Override - public void display(final GLAutoDrawable drawable) { - draw(drawable.getGL().getGL2()); - justInitialized = false; - } + @Override + public final synchronized boolean isAnimating() { + return (timer != null) && (task != null); + } - @Override - public void dispose(final GLAutoDrawable drawable) { } + private void startTask() { + if(null != task) { + return; + } - @Override - public void init(final GLAutoDrawable drawable) { - justInitialized = true; - } + task = new TimerTask() { + private boolean firstRun = true; + @Override + public void run() { + if (firstRun) { + Thread.currentThread().setName("OPENGL"); + firstRun = false; + } + if(CustomAnimator.this.shouldRun) { + CustomAnimator.this.animThread = Thread.currentThread(); + // display impl. uses synchronized block on the animator instance + display(); + synchronized (this) { + // done with current frame. + shouldRun = false; + } + } + } + }; - @Override - public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) { } - } + fpsCounter.resetFPSCounter(); + shouldRun = false; - @Override - public void mouseDragged(final MouseEvent ev) { - if (printEventInfo) { - System.err.println("Mouse dragged event: " + ev); - } - } + timer.schedule(task, 0, 1); + } - @Override - public void mouseMoved(final MouseEvent ev) { - if (printEventInfo) { - System.err.println("Mouse moved event: " + ev); - } - } + @Override + public synchronized boolean start() { + if (timer != null) { + return false; + } + timer = new Timer(); + startTask(); + return true; + } - @Override - public void keyPressed(final KeyEvent ev) { - if (printEventInfo) { - System.err.println("Key pressed event: " + ev); - } - } + /** Stops this CustomAnimator. */ + @Override + public synchronized boolean stop() { + if (timer == null) { + return false; + } + shouldRun = false; + if(null != task) { + task.cancel(); + task = null; + } + if(null != timer) { + timer.cancel(); + timer = null; + } + animThread = null; + try { + Thread.sleep(20); // ~ 1/60 hz wait, since we can't ctrl stopped threads / holding the lock is OK here! + } catch (final InterruptedException e) { } + return true; + } - @Override - public void keyReleased(final KeyEvent ev) { - if (printEventInfo) { - System.err.println("Key released event: " + ev); + @Override + public final synchronized boolean isPaused() { return false; } + @Override + public synchronized boolean resume() { return false; } + @Override + public synchronized boolean pause() { return false; } } - } + } - @Override - public void keyTyped(final KeyEvent ev) { - if (printEventInfo) { - System.err.println("Key typed event: " + ev); + @Test + public void test00() { + TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet mini; + try { + final Class<?> c = Thread.currentThread().getContextClassLoader().loadClass(TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet.class.getName()); + mini = (TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet) c.newInstance(); + } catch (final Exception e) { + throw new RuntimeException(e); + } + if (mini != null) { + try { + mini.run(); + } catch (final Exception ex) { + Assume.assumeNoException(ex); + } } - } - - /** An Animator subclass which renders one frame at the time - * upon calls to the requestRender() method. - **/ - public static class CustomAnimator extends AnimatorBase { - private Timer timer = null; - private TimerTask task = null; - private volatile boolean shouldRun; - - @Override - protected String getBaseName(final String prefix) { - return "Custom" + prefix + "Animator" ; - } - - /** Creates an CustomAnimator with an initial drawable to - * animate. */ - public CustomAnimator(final GLAutoDrawable drawable) { - if (drawable != null) { - add(drawable); - } - } - - public synchronized void requestRender() { - shouldRun = true; - } - - @Override - public final synchronized boolean isStarted() { - return (timer != null); - } - - @Override - public final synchronized boolean isAnimating() { - return (timer != null) && (task != null); - } - - private void startTask() { - if(null != task) { - return; - } - - task = new TimerTask() { - private boolean firstRun = true; - @Override - public void run() { - if (firstRun) { - Thread.currentThread().setName("OPENGL"); - firstRun = false; - } - if(CustomAnimator.this.shouldRun) { - CustomAnimator.this.animThread = Thread.currentThread(); - // display impl. uses synchronized block on the animator instance - display(); - synchronized (this) { - // done with current frame. - shouldRun = false; - } - } - } - }; - - fpsCounter.resetFPSCounter(); - shouldRun = false; - - timer.schedule(task, 0, 1); - } - - @Override - public synchronized boolean start() { - if (timer != null) { - return false; - } - timer = new Timer(); - startTask(); - return true; - } - - /** Stops this CustomAnimator. */ - @Override - public synchronized boolean stop() { - if (timer == null) { - return false; - } - shouldRun = false; - if(null != task) { - task.cancel(); - task = null; - } - if(null != timer) { - timer.cancel(); - timer = null; - } - animThread = null; - try { - Thread.sleep(20); // ~ 1/60 hz wait, since we can't ctrl stopped threads / holding the lock is OK here! - } catch (final InterruptedException e) { } - return true; - } - - @Override - public final synchronized boolean isPaused() { return false; } - @Override - public synchronized boolean resume() { return false; } - @Override - public synchronized boolean pause() { return false; } - } - } - - @Test - public void test00() { - TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet mini; - try { - final Class<?> c = Thread.currentThread().getContextClassLoader().loadClass(TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet.class.getName()); - mini = (TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet) c.newInstance(); - } catch (final Exception e) { - throw new RuntimeException(e); - } - if (mini != null) { - try { - mini.run(); - } catch (final Exception ex) { - Assume.assumeNoException(ex); - } } - } - public static void main(final String args[]) { - for(int i=0; i<args.length; i++) { - if(args[i].equals("-frames")) { - framesPerTest = MiscUtils.atoi(args[++i], framesPerTest); + public static void main(final String args[]) { + for(int i=0; i<args.length; i++) { + if(args[i].equals("-frames")) { + framesPerTest = MiscUtils.atoi(args[++i], framesPerTest); + } } + org.junit.runner.JUnitCore.main(TestGLCanvasAWTActionDeadlock02AWT.class.getName()); } - org.junit.runner.JUnitCore.main(TestGLCanvasAWTActionDeadlock02AWT.class.getName()); - } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java index a49c22f64..8ec400c00 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java @@ -76,8 +76,7 @@ public class TestOlympicES1NEWT extends UITestCase { final SnapshotGLEventListener snap = new SnapshotGLEventListener(); glWindow.addGLEventListener(snap); - final Animator animator = new Animator(); - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setExclusiveContext(exclusiveContext); final QuitAdapter quitAdapter = new QuitAdapter(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java index 47afb8d19..ae27bef3e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java @@ -228,9 +228,8 @@ public class TestGearsES2NEWT extends UITestCase { }); } - final Animator animator = useAnimator ? new Animator() : null; + final Animator animator = useAnimator ? new Animator(0 /* w/o AWT */) : null; if( useAnimator ) { - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java index fb3d82f9a..f88da18d3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java @@ -127,6 +127,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { glw.setSize(new_sz.getWidth(), new_sz.getHeight()); if( null != frame ) { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { frame.pack(); } } ); @@ -139,6 +140,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { static void setComponentSize(final Frame frame, final Component comp, final DimensionImmutable new_sz) { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { final java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight()); comp.setMinimumSize(d); @@ -156,6 +158,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { static void setFrameSize(final Frame frame, final boolean frameLayout, final DimensionImmutable new_sz) { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { final java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight()); frame.setSize(d); @@ -280,16 +283,17 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { public void componentHidden(final ComponentEvent e) { } }); - final Animator animator = useAnimator ? new Animator() : null; + final Animator animator = useAnimator ? new Animator(0 /* w/o AWT */) : null; if( useAnimator ) { - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } glWindow.addWindowListener(new WindowAdapter() { + @Override public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } + @Override public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } @@ -304,14 +308,15 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { } SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - if( ResizeBy.Frame == resizeBy ) { - frame.validate(); - } else { - frame.pack(); - } - frame.setVisible(true); - } + @Override + public void run() { + if( ResizeBy.Frame == resizeBy ) { + frame.validate(); + } else { + frame.pack(); + } + frame.setVisible(true); + } }); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null)); Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null)); @@ -351,9 +356,10 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { } Assert.assertEquals(null, glWindow.getExclusiveContextThread()); SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.dispose(); - } + @Override + public void run() { + frame.dispose(); + } }); glWindow.destroy(); Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null)); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java index aa7ae90ef..3600d5782 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java @@ -193,8 +193,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase { final GearsES2 demo = new GearsES2(swapInterval); glWindow.addGLEventListener(demo); - final Animator animator = new Animator(); - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setExclusiveContext(exclusiveContext); final QuitAdapter quitAdapter = new QuitAdapter(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java index 262d71092..88fcf57d9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java @@ -102,7 +102,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase { final SnapshotGLEventListener snap = new SnapshotGLEventListener(); glWindow.addGLEventListener(snap); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final QuitAdapter quitAdapter = new QuitAdapter(); glWindow.addKeyListener(quitAdapter); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java index 2c5b6028c..5f615d853 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java @@ -68,9 +68,8 @@ public class TestLandscapeES2NEWT extends UITestCase { snap.setPostSNDetail(demo.getClass().getSimpleName()); glWindow.addGLEventListener(snap); - final Animator animator = useAnimator ? new Animator() : null; + final Animator animator = useAnimator ? new Animator(0 /* w/o AWT */) : null; if( useAnimator ) { - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } @@ -82,17 +81,20 @@ public class TestLandscapeES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addKeyListener(new KeyAdapter() { + @Override public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } if(e.getKeyChar()=='f') { glWindow.invokeOnNewThread(null, false, new Runnable() { + @Override public void run() { glWindow.setFullscreen(!glWindow.isFullscreen()); } } ); } else if(e.getKeyChar()=='d') { glWindow.invokeOnNewThread(null, false, new Runnable() { + @Override public void run() { glWindow.setUndecorated(!glWindow.isUndecorated()); } } ); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java index c5bbecbc7..8f6a75d9e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java @@ -107,16 +107,17 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { frame.add(newtCanvasAWT); frame.setTitle("Gears NewtCanvasAWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval+", size "+wsize); - final Animator animator = useAnimator ? new Animator() : null; + final Animator animator = useAnimator ? new Animator(0 /* w/o AWT */) : null; if( useAnimator ) { - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } glWindow.addWindowListener(new WindowAdapter() { + @Override public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } + @Override public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } @@ -134,10 +135,11 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { } SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.validate(); - frame.setVisible(true); - } + @Override + public void run() { + frame.validate(); + frame.setVisible(true); + } }); if( useAnimator ) { @@ -159,9 +161,10 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { animator.stop(); } SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.dispose(); - } + @Override + public void run() { + frame.dispose(); + } }); glWindow.destroy(); // removeNotify does not destroy GLWindow } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java index 0b2d42bcf..c689bdaf3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java @@ -155,8 +155,7 @@ public class TestGearsES2SWT extends UITestCase { final GearsES2 demo = new GearsES2(swapInterval); canvas.addGLEventListener(demo); - final Animator animator = new Animator(); - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setExclusiveContext(exclusiveContext); animator.add(canvas); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java index 78bc99dd1..c9e206262 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestGLCanvasSWTNewtCanvasSWTPosInTabs.java @@ -130,30 +130,32 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { try {
if( null != display ) {
display.syncExec(new Runnable() {
- public void run() {
- if( null != sash ) {
- sash.dispose();
- }
- if( null != tab1Comp ) {
- tab1Comp.dispose();
- }
- if( null != tabFolder ) {
- tabFolder.dispose();
- }
- if( null != composite ) {
- composite.dispose();
- }
- if( null != shell ) {
- shell.dispose();
- }
- }});
+ @Override
+ public void run() {
+ if( null != sash ) {
+ sash.dispose();
+ }
+ if( null != tab1Comp ) {
+ tab1Comp.dispose();
+ }
+ if( null != tabFolder ) {
+ tabFolder.dispose();
+ }
+ if( null != composite ) {
+ composite.dispose();
+ }
+ if( null != shell ) {
+ shell.dispose();
+ }
+ }});
}
SWTAccessor.invokeOnOSTKThread(true, new Runnable() {
- public void run() {
- if( null != display ) {
- display.dispose();
- }
- }});
+ @Override
+ public void run() {
+ if( null != display ) {
+ display.dispose();
+ }
+ }});
}
catch( final Throwable throwable ) {
throwable.printStackTrace();
@@ -174,6 +176,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { throws InterruptedException
{
SWTAccessor.invokeOnOSTKThread(true, new Runnable() {
+ @Override
public void run() {
display = new Display();
Assert.assertNotNull( display );
@@ -181,6 +184,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { }});
display.syncExec(new Runnable() {
+ @Override
public void run() {
shell = new Shell( display );
Assert.assertNotNull( shell );
@@ -240,6 +244,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { glad1.addGLEventListener(demo1);
display.syncExec(new Runnable() {
+ @Override
public void run() {
if( !addComposite ) {
tabItem1.setControl(canvas1);
@@ -265,8 +270,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { tabItem2.setControl(sash);
} } );
- final Animator animator = new Animator();
- animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD);
+ final Animator animator = new Animator(0 /* w/o AWT */);
animator.add(glad1);
final GLWindow glWindow2;
@@ -307,6 +311,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { // Index 0 -> newtCanvasSWT1 ( glWindow1 )
// Index 1 -> newtCanvasSWT2 ( glWindow2 )
display.syncExec(new Runnable() {
+ @Override
public void run() {
final Listener swtListener0 = new Listener() {
@Override
@@ -335,6 +340,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { animator.add(glad2);
display.syncExec(new Runnable() {
+ @Override
public void run() {
if( focusOnTab1 ) {
canvas1.setFocus();
@@ -353,12 +359,14 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { glWindow2.addWindowListener(quitAdapter);
final WindowListener wl = new WindowAdapter() {
+ @Override
public void windowResized(final WindowEvent e) {
final GLWindow glWindow = ( e.getSource() instanceof GLWindow ) ? (GLWindow)e.getSource() : null;
if( null != glWindow ) {
System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
}
}
+ @Override
public void windowMoved(final WindowEvent e) {
final GLWindow glWindow = ( e.getSource() instanceof GLWindow ) ? (GLWindow)e.getSource() : null;
if( null != glWindow ) {
@@ -370,6 +378,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { glWindow2.addWindowListener(wl);
final KeyListener kl = new KeyAdapter() {
+ @Override
public void keyReleased(final KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
@@ -378,6 +387,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { if( null != glWindow ) {
if(e.getKeyChar()=='f') {
glWindow.invokeOnNewThread(null, false, new Runnable() {
+ @Override
public void run() {
final Thread t = glWindow.setExclusiveContextThread(null);
System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
@@ -413,12 +423,14 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { animator.setUpdateFPSFrames(60, null);
display.syncExec(new Runnable() {
+ @Override
public void run() {
shell.open();
} } );
Assert.assertEquals(true, GLTestUtil.waitForRealized( focusOnTab1 ? glad1 : glad2, true, waitAction));
display.syncExec(new Runnable() {
+ @Override
public void run() {
final Canvas canvas = focusOnTab1 ? canvas1 : canvas2;
System.err.println("Canvas pixel-units pos/siz.0: pos "+SWTAccessor.getLocationInPixels(canvas)+", size "+SWTAccessor.getSizeInPixels(canvas));
@@ -444,13 +456,14 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { generalWaitAction.run();
}
display.syncExec( new Runnable() {
- public void run() {
- shell.setSize( rwsize.getWidth(), rwsize.getHeight() );
- final Canvas canvas = focusOnTab1 ? canvas1 : canvas2;
- System.err.println("Canvas pixel-units pos/siz.1: pos "+SWTAccessor.getLocationInPixels(canvas)+", size "+SWTAccessor.getSizeInPixels(canvas));
- System.err.println("Canvas window-units pos/siz.1: pos "+canvas.getLocation()+", size "+canvas.getSize());
- System.err.println("Canvas LOS.1: "+canvas.toDisplay(0, 0));
- } } );
+ @Override
+ public void run() {
+ shell.setSize( rwsize.getWidth(), rwsize.getHeight() );
+ final Canvas canvas = focusOnTab1 ? canvas1 : canvas2;
+ System.err.println("Canvas pixel-units pos/siz.1: pos "+SWTAccessor.getLocationInPixels(canvas)+", size "+SWTAccessor.getSizeInPixels(canvas));
+ System.err.println("Canvas window-units pos/siz.1: pos "+canvas.getLocation()+", size "+canvas.getSize());
+ System.err.println("Canvas LOS.1: "+canvas.toDisplay(0, 0));
+ } } );
if( useNewtCanvasSWT ) {
final GLWindow glWindow = focusOnTab1 ? glWindow1 : glWindow2;
final NewtCanvasSWT newtCanvasSWT = focusOnTab1 ? newtCanvasSWT1 : newtCanvasSWT2;
@@ -471,6 +484,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { Assert.assertTrue( "NewtCanvasAWT2 LOS "+pNatWinLOS+" not >= sash-right "+pSashRightClient, pNatWinLOS.compareTo(pSashRightClient) >= 0 );
} else {
display.syncExec(new Runnable() {
+ @Override
public void run() {
final org.eclipse.swt.graphics.Point los = glCanvas2.toDisplay(0, 0);
pGLWinLOS[0] = new Point(los.x, los.y);
@@ -501,12 +515,14 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { try {
if( useNewtCanvasSWT ) {
display.syncExec( new Runnable() {
- public void run() {
- newtCanvasSWT1.dispose();
- } } );
+ @Override
+ public void run() {
+ newtCanvasSWT1.dispose();
+ } } );
glWindow1.destroy();
Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow1, false, null));
display.syncExec( new Runnable() {
+ @Override
public void run() {
newtCanvasSWT2.dispose();
} } );
@@ -514,6 +530,7 @@ public class TestGLCanvasSWTNewtCanvasSWTPosInTabs extends UITestCase { Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow2, false, null));
} else {
display.syncExec( new Runnable() {
+ @Override
public void run() {
glCanvas1.dispose();
glCanvas2.dispose();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java index 68c25fca2..d967e7e71 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java @@ -93,11 +93,13 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { @Before public void init() { SWTAccessor.invokeOnOSTKThread(true, new Runnable() { + @Override public void run() { display = new Display(); Assert.assertNotNull( display ); }}); display.syncExec(new Runnable() { + @Override public void run() { shell = new Shell( display ); Assert.assertNotNull( shell ); @@ -115,14 +117,16 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { Assert.assertNotNull( composite ); try { display.syncExec(new Runnable() { - public void run() { - composite.dispose(); - shell.dispose(); - }}); + @Override + public void run() { + composite.dispose(); + shell.dispose(); + }}); SWTAccessor.invokeOnOSTKThread(true, new Runnable() { - public void run() { - display.dispose(); - }}); + @Override + public void run() { + display.dispose(); + }}); } catch( final Throwable throwable ) { throwable.printStackTrace(); @@ -141,23 +145,28 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { canvas.addGLEventListener( demo ); canvas.addGLEventListener(new GLEventListener() { - int displayCount = 0; - public void init(final GLAutoDrawable drawable) { } - public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } - public void display(final GLAutoDrawable drawable) { - if(displayCount < 3) { - snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null); - } - } - public void dispose(final GLAutoDrawable drawable) { } + int displayCount = 0; + @Override + public void init(final GLAutoDrawable drawable) { } + @Override + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } + @Override + public void display(final GLAutoDrawable drawable) { + if(displayCount < 3) { + snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null); + } + } + @Override + public void dispose(final GLAutoDrawable drawable) { } }); display.syncExec(new Runnable() { - public void run() { - shell.setText( getSimpleTestName(".") ); - shell.setSize( 640, 480 ); - shell.open(); - } } ); + @Override + public void run() { + shell.setText( getSimpleTestName(".") ); + shell.setSize( 640, 480 ); + shell.open(); + } } ); final Animator anim = new Animator(); if(doAnimation) { @@ -180,9 +189,10 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { anim.stop(); display.syncExec(new Runnable() { - public void run() { - canvas.dispose(); - } } ); + @Override + public void run() { + canvas.dispose(); + } } ); } @Test diff --git a/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java index a5cd38909..4365d891c 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java @@ -64,7 +64,7 @@ public class DemoCreateAndDisposeOnCloseNEWT { caps.setBackgroundOpaque(true); caps.setDoubleBuffered(true); caps.setDepthBits(16); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLWindow glWindow = GLWindow.create(caps); animator.add(glWindow); glWindow.addGLEventListener(new GLEventListener() { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java index 709bad2a0..aa5b6d8cb 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java @@ -75,7 +75,7 @@ public class TestGLWindowInvisiblePointer01NEWT extends UITestCase { final GLWindow window1 = createWindow(null, caps); // local Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(true,window1.isVisible()); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1, null); animator.add(window1); animator.start(); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java index ec121f601..e198383de 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java @@ -88,7 +88,7 @@ public class TestGLWindowWarpPointer01NEWT extends UITestCase { final GLWindow window1 = createWindow(null, caps); // local Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(true,window1.isVisible()); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1, null); animator.add(window1); animator.start(); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java index 48700ab13..bbf43a4a4 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java @@ -149,7 +149,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); final GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */, true /* vsync */); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1, null); Assert.assertTrue(animator.start()); Thread.sleep(250); // give animator a chance to become paused @@ -191,7 +191,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { final RectangleImmutable screenBoundsInWinU = screen.getViewportInWindowUnits(); window2.setPosition(screenBoundsInWinU.getWidth()-width, 0); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1, null); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); // zero drawables @@ -258,7 +258,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { final RectangleImmutable screen2BoundsInWinU = screen2.getViewportInWindowUnits(); window2.setPosition(screen2BoundsInWinU.getWidth()-width, 0); - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1, null); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java index e4438893f..414b35ddd 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java @@ -89,7 +89,7 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { @Test public void testRemoteWindow01() throws InterruptedException { - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLProfile glpLocal = GLProfile.getGL2ES1(); Assert.assertNotNull(glpLocal); final GLCapabilities capsLocal = new GLCapabilities(glpLocal); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java index 8e2d191b2..31e70cbca 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java @@ -107,8 +107,7 @@ public class TestWindowAndPointerIconNEWT extends SingletonJunitCase { glWindow.setPointerIcon(pointerIcon); System.err.println("Set PointerIcon: "+glWindow.getPointerIcon()); - final Animator animator = new Animator(); - animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); + final Animator animator = new Animator(0 /* w/o AWT */); animator.add(glWindow); animator.start(); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java index d24a95ffa..d26eac1bb 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java @@ -89,7 +89,7 @@ public class TestTranslucentChildWindowBug632NEWT extends UITestCase { @Test public void testWindow00() throws InterruptedException { - final Animator animator = new Animator(); + final Animator animator = new Animator(0 /* w/o AWT */); final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); |