[libjogl2-java] 48/58: Imported Upstream version 2.1.3
Tony Mancill
tmancill at moszumanska.debian.org
Thu Sep 4 03:59:28 UTC 2014
This is an automated email from the git hooks/post-receive script.
tmancill pushed a commit to branch master
in repository libjogl2-java.
commit 8418f4c79e6137aee0076258ec86d74307c6126c
Author: tony mancill <tmancill at debian.org>
Date: Fri Aug 29 18:46:44 2014 -0700
Imported Upstream version 2.1.3
---
jnlp-files/Bug910-AppletLifecycleCheck.html | 32 +
jnlp-files/jogl-test-applets.html | 1 +
make/config/jogl/egl-CustomCCode.c | 26 +
make/config/jogl/egl-CustomJavaCode.java | 45 +
make/config/jogl/egl.cfg | 28 +-
make/config/jogl/eglext.cfg | 2 +
make/config/jogl/glx-CustomCCode.c | 25 +
make/config/jogl/glx-CustomJavaCode.java | 22 +
make/config/nativewindow/x11-CustomJavaCode.java | 15 +
make/resources/android/AndroidManifest-jogl.xml | 16 +-
make/resources/android/res-jogl/values/strings.xml | 6 +-
make/scripts/adb-logcat.sh | 2 +-
make/scripts/java-win.bat | 3 +-
make/scripts/make.jogl.all.linux-x86-clang.sh | 62 ++
make/scripts/make.jogl.all.linux-x86_64-clang.sh | 63 ++
make/scripts/make.jogl.all.macosx-clang.sh | 4 +-
make/scripts/tests-win.bat | 101 ++-
make/scripts/tests-x64-dbg.bat | 11 +-
make/scripts/tests.sh | 110 ++-
.../gluegen/opengl/BuildComposablePipeline.java | 2 +-
.../com/jogamp/graph/curve/opengl/Renderer.java | 2 +-
.../classes/com/jogamp/opengl/GLExtensions.java | 1 +
.../classes/com/jogamp/opengl/math/VectorUtil.java | 38 +-
.../classes/com/jogamp/opengl/util/Animator.java | 94 +-
.../com/jogamp/opengl/util/AnimatorBase.java | 152 ++--
.../com/jogamp/opengl/util/FPSAnimator.java | 57 +-
.../com/jogamp/opengl/util/TileRendererBase.java | 8 +-
.../com/jogamp/opengl/util/av/GLMediaPlayer.java | 8 +-
.../jogamp/opengl/util/awt/AWTGLPixelBuffer.java | 30 +-
.../com/jogamp/opengl/util/glsl/ShaderCode.java | 28 +-
.../opengl/util/texture/TextureSequence.java | 4 +-
src/jogl/classes/javax/media/opengl/GLBase.java | 2 +-
.../javax/media/opengl/GLDrawableFactory.java | 20 +-
src/jogl/classes/javax/media/opengl/GLProfile.java | 49 +-
.../javax/media/opengl/GLSharedContextSetter.java | 7 +-
.../classes/javax/media/opengl/awt/GLCanvas.java | 11 +-
.../classes/javax/media/opengl/awt/GLJPanel.java | 249 +++--
.../graph/curve/opengl/RegionRendererImpl01.java | 5 +-
.../graph/curve/opengl/TextRendererImpl01.java | 5 +-
.../jogamp/opengl/ExtensionAvailabilityCache.java | 68 +-
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 71 +-
.../jogamp/opengl/GLDrawableFactoryImpl.java | 53 +-
.../classes/jogamp/opengl/awt/AWTTilePainter.java | 21 +-
src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 30 +-
.../classes/jogamp/opengl/egl/EGLDisplayUtil.java | 2 +
.../classes/jogamp/opengl/egl/EGLDrawable.java | 4 +-
.../jogamp/opengl/egl/EGLDrawableFactory.java | 19 +-
.../jogamp/opengl/egl/EGLGLCapabilities.java | 7 +-
.../opengl/egl/EGLGraphicsConfiguration.java | 178 ++--
.../egl/EGLGraphicsConfigurationFactory.java | 50 +-
.../jogamp/opengl/egl/EGLUpstreamSurfaceHook.java | 2 +-
.../jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 32 +-
.../opengl/macosx/cgl/MacOSXCGLDrawable.java | 5 +-
.../macosx/cgl/MacOSXCGLDrawableFactory.java | 9 +-
.../macosx/cgl/MacOSXExternalCGLContext.java | 3 +-
.../jogamp/opengl/openal/av/ALAudioSink.java | 240 ++---
.../jogamp/opengl/util/av/GLMediaPlayerImpl.java | 283 ++++--
.../opengl/util/av/impl/FFMPEGMediaPlayer.java | 9 +-
.../opengl/windows/wgl/WGLGLCapabilities.java | 2 +-
.../opengl/windows/wgl/WindowsWGLContext.java | 40 +-
.../windows/wgl/WindowsWGLDrawableFactory.java | 10 +-
.../wgl/WindowsWGLGraphicsConfiguration.java | 7 +-
.../WindowsWGLGraphicsConfigurationFactory.java | 136 ++-
.../opengl/x11/glx/X11ExternalGLXContext.java | 3 +-
.../jogamp/opengl/x11/glx/X11GLXContext.java | 33 +-
.../opengl/x11/glx/X11GLXDrawableFactory.java | 5 +-
.../x11/glx/X11GLXGraphicsConfiguration.java | 144 ++-
.../glx/X11GLXGraphicsConfigurationFactory.java | 50 +-
src/jogl/native/libav/ffmpeg_impl_template.c | 24 +-
.../nativewindow/awt/AWTWindowClosingProtocol.java | 31 +-
.../com/jogamp/nativewindow/awt/JAWTWindow.java | 100 ++-
.../com/jogamp/nativewindow/swt/SWTAccessor.java | 8 +-
.../jogamp/nativewindow/x11/X11GraphicsDevice.java | 8 +-
.../media/nativewindow/DefaultGraphicsDevice.java | 18 +-
.../jogamp/nativewindow/windows/GDIUtil.java | 23 +-
.../nativewindow/windows/RegisteredClass.java | 17 +-
.../windows/RegisteredClassFactory.java | 40 +-
src/nativewindow/native/NativewindowCommon.c | 7 +
src/nativewindow/native/NativewindowCommon.h | 3 +
src/nativewindow/native/win32/GDImisc.c | 405 ++++++++-
src/nativewindow/native/x11/Xmisc.c | 21 +-
src/newt/classes/com/jogamp/newt/Window.java | 46 +-
.../classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 539 ++++++-----
.../jogamp/newt/awt/applet/JOGLNewtApplet1Run.java | 88 +-
.../jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 45 +-
.../classes/com/jogamp/newt/event/MouseEvent.java | 2 +
.../com/jogamp/newt/event/MouseListener.java | 2 +
.../com/jogamp/newt/event/awt/AWTAdapter.java | 46 +-
.../com/jogamp/newt/event/awt/AWTKeyAdapter.java | 26 +-
.../com/jogamp/newt/event/awt/AWTMouseAdapter.java | 56 +-
.../jogamp/newt/event/awt/AWTWindowAdapter.java | 73 +-
.../classes/com/jogamp/newt/opengl/GLWindow.java | 10 +
.../classes/com/jogamp/newt/swt/NewtCanvasSWT.java | 49 +-
src/newt/classes/jogamp/newt/WindowImpl.java | 620 ++++++++-----
.../newt/awt/event/AWTParentWindowAdapter.java | 107 ++-
.../newt/driver/android/NewtDebugActivity.java} | 29 +-
...auncher.java => NewtDebugActivityLauncher.java} | 12 +-
.../newt/driver/android/NewtVersionActivity.java | 86 +-
.../android/NewtVersionActivityLauncher.java | 8 +-
.../driver/android/NewtVersionBaseActivity.java | 120 +++
.../jogamp/newt/driver/bcm/egl/DisplayDriver.java | 1 -
.../jogamp/newt/driver/macosx/WindowDriver.java | 15 +-
.../jogamp/newt/driver/windows/DisplayDriver.java | 2 +-
src/newt/native/InputEvent.h | 6 +
src/newt/native/MacWindow.m | 62 +-
src/newt/native/NewtMacWindow.h | 5 +-
src/newt/native/NewtMacWindow.m | 26 +-
src/newt/native/WindowsWindow.c | 999 ++++++++++++---------
src/newt/native/X11RandR11.c | 3 +-
.../Bug907GetAllWindowNamesViaMessageDispatch.c | 34 +
.../test/android/MovieCubeActivityLauncher0.java | 33 +-
.../test/android/MovieCubeActivityLauncher1a.java | 26 +-
.../test/android/MovieCubeActivityLauncher1b.java | 26 +-
.../android/MovieSimpleActivityLauncher00b.java | 27 +-
.../android/MovieSimpleActivityLauncher00c.java | 26 +-
.../android/MovieSimpleActivityLauncher01a.java | 29 +-
.../android/MovieSimpleActivityLauncher01b.java | 29 +-
.../android/MovieSimpleActivityLauncher02.java | 29 +-
.../opengl/test/android/NEWTElektronActivity.java | 2 +-
.../opengl/test/android/NEWTGearsES2Activity.java | 36 +-
.../test/android/NEWTGearsES2TransActivity.java | 2 +-
.../opengl/test/android/NEWTGraphUI1pActivity.java | 2 +-
.../opengl/test/android/NEWTGraphUI2pActivity.java | 2 +-
.../test/android/NEWTRedSquareES2Activity.java | 2 +-
.../DemoBug910ExtendedAWTAppletLifecycleCheck.java | 234 +++++
.../junit/jogl/acore/TestShutdownCompleteAWT.java | 92 +-
.../junit/jogl/acore/TestShutdownCompleteNEWT.java | 84 +-
.../jogl/acore/anim/Bug898AnimatorFromEDTAWT.java | 129 +++
.../TestAWTCardLayoutAnimatorStartStopBug532.java | 2 +-
.../jogl/acore/anim/TestAnimatorGLJPanel01AWT.java | 301 +++++++
.../acore/anim/TestAnimatorGLWindow01NEWT.java | 267 ++++++
.../TestBug816GLCanvasFrameHoppingB849B889AWT.java | 262 ++++++
.../jogl/awt/TestBug816OSXCALayerPos01AWT.java | 87 +-
.../jogl/awt/TestBug816OSXCALayerPos02AWT.java | 43 +-
.../awt/TestBug816OSXCALayerPos03aB729AWT.java | 35 +-
.../awt/TestBug816OSXCALayerPos03bB849AWT.java | 35 +-
.../awt/TestBug816OSXCALayerPos03cB849AWT.java | 37 +-
.../awt/TestGLCanvasAWTActionDeadlock02AWT.java | 374 ++++----
.../junit/jogl/awt/TestGLJPanelResize01AWT.java | 209 +++++
.../junit/jogl/demos/TextureSequenceDemo01.java | 33 +-
.../test/junit/jogl/demos/es1/RedSquareES1.java | 53 +-
.../opengl/test/junit/jogl/demos/es2/GearsES2.java | 39 +-
.../jogl/demos/es2/TextureSequenceCubeES2.java | 167 ++--
.../test/junit/jogl/demos/es2/av/MovieCube.java | 19 +-
.../test/junit/jogl/demos/es2/av/MovieSimple.java | 428 +++++----
.../jogl/demos/es2/awt/Bug848AppletGLCanvas01.java | 28 +-
.../demos/es2/awt/TestGearsES2GLJPanelAWT.java | 69 +-
.../opengl/test/junit/jogl/demos/gl2/Gears.java | 123 +--
.../jogl/perf/TestPerf001GLJPanelInit01AWT.java | 253 ++++++
.../jogl/perf/TestPerf001GLJPanelInit02AWT.java | 441 +++++++++
.../jogl/perf/TestPerf001GLWindowInit03NEWT.java | 208 +++++
.../junit/jogl/perf/TestPerf001RawInit00NEWT.java | 234 +++++
.../jogl/swt/TestBug672NewtCanvasSWTSashForm.java | 332 +++++++
.../TestBug672NewtCanvasSWTSashFormComposite.java | 339 +++++++
.../TestNewtCanvasSWTBug628ResizeDeadlockAWT.java | 20 +-
.../test/junit/jogl/swt/TestNewtCanvasSWTGLn.java | 74 +-
.../jogl/tile/TestTiledPrintingGearsSwingAWT.java | 129 ++-
.../jogl/tile/TestTiledPrintingGearsSwingAWT2.java | 161 +++-
.../junit/newt/TestGLWindows03NEWTAnimResize.java | 138 +++
.../junit/newt/event/BaseNewtEventModifiers.java | 204 ++---
.../newt/event/TestNewtKeyCodeModifiersAWT.java | 4 +-
.../test/junit/newt/event/TestNewtKeyCodesAWT.java | 81 +-
.../newt/event/TestNewtKeyEventAutoRepeatAWT.java | 110 +--
.../junit/newt/event/TestNewtKeyEventOrderAWT.java | 2 +-
.../TestParentingFocus01SwingAWTRobot.java} | 51 +-
.../TestParentingFocus02SwingAWTRobot.java} | 82 +-
.../TestParentingFocus03KeyTraversalAWT.java} | 115 +--
.../parenting/NewtAWTReparentingKeyAdapter.java | 28 +-
.../junit/newt/parenting/TestParenting01NEWT.java | 64 +-
.../junit/newt/parenting/TestParenting01aAWT.java | 66 +-
.../junit/newt/parenting/TestParenting01bAWT.java | 30 +-
.../junit/newt/parenting/TestParenting01cAWT.java | 4 +-
.../newt/parenting/TestParenting01cSwingAWT.java | 4 +-
...renting01cAWT.java => TestParenting01dAWT.java} | 242 +++--
.../junit/newt/parenting/TestParenting02AWT.java | 24 +-
.../junit/newt/parenting/TestParenting02NEWT.java | 20 +-
.../junit/newt/parenting/TestParenting03AWT.java | 30 +-
.../junit/newt/parenting/TestParenting04AWT.java | 4 +-
.../junit/newt/parenting/TestParenting04SWT.java | 4 +-
.../opengl/test/junit/util/AWTKeyAdapter.java | 41 +-
.../opengl/test/junit/util/AWTMouseAdapter.java | 41 +-
.../opengl/test/junit/util/AWTRobotUtil.java | 114 ++-
.../jogamp/opengl/test/junit/util/DumpGLInfo.java | 12 +-
.../test/junit/util/GLEventListenerCounter.java | 22 +-
.../test/junit/util/InputEventCountAdapter.java | 15 +-
.../opengl/test/junit/util/NEWTKeyAdapter.java | 45 +-
.../jogamp/opengl/test/junit/util/NEWTKeyUtil.java | 70 +-
.../opengl/test/junit/util/NEWTMouseAdapter.java | 39 +-
www/2125.pdf | Bin 561627 -> 0 bytes
www/3167.pdf | Bin 1159573 -> 0 bytes
www/BOF-3908-JOGL-slides.pdf | Bin 546173 -> 0 bytes
www/JOGLGlueGen.pdf | Bin 100439 -> 0 bytes
www/License_TCK_JSR231.pdf | Bin 95506 -> 0 bytes
www/bof0899.pdf | Bin 233291 -> 0 bytes
www/index.html | 654 --------------
www/media/EverplanesLogo_160x160.png | Bin 45282 -> 0 bytes
www/media/Frog-Craft3_2.160w.png | Bin 27158 -> 0 bytes
www/media/Frog-Craft3_2.png | Bin 280766 -> 0 bytes
www/media/Impact_Bullet_AKM.in-1.png | Bin 9773 -> 0 bytes
www/media/JaamSim_160x120.png | Bin 17406 -> 0 bytes
www/media/Java3d.png | Bin 8675 -> 0 bytes
www/media/JebGL_logo.160w.png | Bin 11378 -> 0 bytes
www/media/JebGL_logo.png | Bin 31923 -> 0 bytes
www/media/MyHmi-Collage-160x152.png | Bin 29426 -> 0 bytes
www/media/NetBeansOpenGLPackLogo160.png | Bin 12928 -> 0 bytes
www/media/VolumeViewer-160x120.png | Bin 21343 -> 0 bytes
www/media/ardor3d.png | Bin 3007 -> 0 bytes
www/media/artofillusion.jpg | Bin 10066 -> 0 bytes
www/media/avengina.jpg | Bin 6944 -> 0 bytes
www/media/c3d-mobile-01-coll01-160x160.png | Bin 37461 -> 0 bytes
www/media/c3d-mobile-01-pipes01-160x125.png | Bin 29246 -> 0 bytes
www/media/c3d-mobile-01-pipes07-160x120.png | Bin 29844 -> 0 bytes
www/media/c3d-studio-snap2-160x160.png | Bin 234527 -> 0 bytes
www/media/chronotext.jpg | Bin 9953 -> 0 bytes
www/media/dyn4j.png | Bin 5373 -> 0 bytes
www/media/elflightengine-160x122.png | Bin 39384 -> 0 bytes
www/media/fenggui.jpg | Bin 7034 -> 0 bytes
www/media/field.png | Bin 16550 -> 0 bytes
www/media/fusion_logo.jpg | Bin 4607 -> 0 bytes
www/media/geogebra-screenshot-tangents.png | Bin 5980 -> 0 bytes
www/media/gephi.jpg | Bin 18161 -> 0 bytes
www/media/glg2d-demo.png | Bin 10295 -> 0 bytes
www/media/glstudio.jpg | Bin 12433 -> 0 bytes
www/media/impact.jpg | Bin 6980 -> 0 bytes
www/media/insparia-160x132.jpg | Bin 12393 -> 0 bytes
www/media/jackflowers.jpg | Bin 8558 -> 0 bytes
www/media/jake2-160x160.png | Bin 23283 -> 0 bytes
www/media/jmonkeyengine.png | Bin 38087 -> 0 bytes
...-demoscene-elektronenmultiplizierer01-small.png | Bin 46454 -> 0 bytes
...applet-demoscene-elektronenmultiplizierer01.png | Bin 410998 -> 0 bytes
www/media/jogl-applet-gearses2-normal-small.png | Bin 6523 -> 0 bytes
www/media/jogl-applet-gearses2-normal.png | Bin 69330 -> 0 bytes
.../jogl-applet-gearses2-translucent-small.png | Bin 28387 -> 0 bytes
www/media/jogl-applet-gearses2-translucent.png | Bin 72883 -> 0 bytes
www/media/jogl-applet-graph-text01-small.png | Bin 13499 -> 0 bytes
www/media/jogl-applet-graph-text01.png | Bin 103995 -> 0 bytes
www/media/jogl-applet-graph-uiscene01-small.png | Bin 17151 -> 0 bytes
www/media/jogl-applet-graph-uiscene01.png | Bin 106628 -> 0 bytes
www/media/jogl-applet-moviecube01-small.png | Bin 19167 -> 0 bytes
www/media/jogl-applet-moviecube01.png | Bin 118588 -> 0 bytes
www/media/jogl-applet-version-small.png | Bin 21426 -> 0 bytes
www/media/jogl-applet-version.png | Bin 121630 -> 0 bytes
www/media/jreality-logo-discreteksurfaces.png | Bin 28465 -> 0 bytes
www/media/jspatial-1-160x160.png | Bin 38022 -> 0 bytes
www/media/jzy3d-demo-surface-160x160.png | Bin 28652 -> 0 bytes
www/media/libgdx.png | Bin 2807 -> 0 bytes
www/media/madlix.png | Bin 25107 -> 0 bytes
www/media/map_of_illarion.png | Bin 44172 -> 0 bytes
www/media/mbt.jpg | Bin 18896 -> 0 bytes
www/media/nifty-logo-new.png | Bin 10305 -> 0 bytes
www/media/pebbles.png | Bin 31238 -> 0 bytes
www/media/processing.jpg | Bin 11258 -> 0 bytes
www/media/raceview.jpg | Bin 7694 -> 0 bytes
www/media/scilab.png | Bin 26149 -> 0 bytes
www/media/sculpteo_3_robot_72dpi_sm.jpg | Bin 10567 -> 0 bytes
www/media/specksim.jpg | Bin 10548 -> 0 bytes
www/media/strap.jpg | Bin 9699 -> 0 bytes
www/media/ticket2ride_picture5-160x132.jpg | Bin 14946 -> 0 bytes
www/media/vehicle.jpg | Bin 5586 -> 0 bytes
www/media/vldocking.jpg | Bin 5372 -> 0 bytes
www/media/worldwind.jpg | Bin 11862 -> 0 bytes
www/media/zg3d.png | Bin 91839 -> 0 bytes
www/sharendipity.gif | Bin 4788 -> 0 bytes
www/ts1361.pdf | Bin 786403 -> 0 bytes
264 files changed, 9845 insertions(+), 4811 deletions(-)
diff --git a/jnlp-files/Bug910-AppletLifecycleCheck.html b/jnlp-files/Bug910-AppletLifecycleCheck.html
new file mode 100644
index 0000000..eee6c1e
--- /dev/null
+++ b/jnlp-files/Bug910-AppletLifecycleCheck.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Bug910 Extended AWT Applet Lifecycle Check</title>
+</head>
+<body>
+
+<P>
+The applet below tests the Applet Lifecycle.
+Please read the stderr log for results!
+</P>
+
+<P>
+
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="400" height="200">
+ <param name="code" value="com.jogamp.opengl.test.bugs.DemoBug910ExtendedAWTAppletLifecycleCheck">
+ <param name="archive" value="jar/jogl-test.jar">
+ <comment>
+ <embed code="com.jogamp.opengl.test.bugs.DemoBug910ExtendedAWTAppletLifecycleCheck"
+ width="400" height="200"
+ type="application/x-java-applet;version=1.6"
+ pluginspage="http://java.sun.com/javase/downloads/ea.jsp"
+ archive="jar/jogl-test.jar">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+
+</P>
+</body>
+</html>
diff --git a/jnlp-files/jogl-test-applets.html b/jnlp-files/jogl-test-applets.html
index 3ac2d59..8eda51d 100644
--- a/jnlp-files/jogl-test-applets.html
+++ b/jnlp-files/jogl-test-applets.html
@@ -216,6 +216,7 @@ Misc tests:
<ul>
<li><a href="jogl-applet-bug818_gljpanel01.html">Bug 818: OSX 10.6.8 NV GT 330M GLJPanel Crash</a></li>
<li><a href="jogl-applet-bug848_glcanvas01.html">Bug 848: Applet on OSX w/ CALayer and 2 or more GLCanvas may crash</a></li>
+ <li><a href="Bug910-AppletLifecycleCheck.html">Bug 910: Extended AWT Applet Lifecycle Check</a></li>
</ul></li>
</ul>
</p>
diff --git a/make/config/jogl/egl-CustomCCode.c b/make/config/jogl/egl-CustomCCode.c
new file mode 100644
index 0000000..0163c67
--- /dev/null
+++ b/make/config/jogl/egl-CustomCCode.c
@@ -0,0 +1,26 @@
+#include <stdio.h> /* android */
+#include <gluegen_stdint.h>
+#include <gluegen_stddef.h>
+#include <EGL/egl.h>
+
+/* Java->C glue code:
+ * Java package: jogamp.opengl.egl.EGL
+ * Java method: void eglGetConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values)
+ */
+Java_jogamp_opengl_egl_EGL_dispatch_1eglGetConfigAttributes(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jint attributeCount, jobject attributes, jint attributes_byte_offset, jobject values, jint values_byte_offset, jlong procAddress) {
+ typedef EGLBoolean (EGLAPIENTRY*_local_PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value);
+ _local_PFNEGLGETCONFIGATTRIBPROC ptr_eglGetConfigAttrib = (_local_PFNEGLGETCONFIGATTRIBPROC) (intptr_t) procAddress;
+ assert(ptr_eglGetConfigAttrib != NULL);
+
+ if ( attributeCount > 0 && NULL != attributes ) {
+ int i;
+ int * attributes_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attributes)) + attributes_byte_offset);
+ EGLint * values_ptr = (EGLint *) (((char*) (*env)->GetDirectBufferAddress(env, values)) + values_byte_offset);
+ for(i=0; i<attributeCount; i++) {
+ if( 0 == (* ptr_eglGetConfigAttrib) ((EGLDisplay) (intptr_t) dpy, (EGLConfig) (intptr_t) config, (EGLint) attributes_ptr[i], (EGLint *) &values_ptr[i]) ) {
+ attributes_ptr[i] = 0;
+ }
+ }
+ }
+}
+
diff --git a/make/config/jogl/egl-CustomJavaCode.java b/make/config/jogl/egl-CustomJavaCode.java
new file mode 100644
index 0000000..15689b5
--- /dev/null
+++ b/make/config/jogl/egl-CustomJavaCode.java
@@ -0,0 +1,45 @@
+
+ private static EGLProcAddressTable _table = new EGLProcAddressTable(new GLProcAddressResolver());
+ public static void resetProcAddressTable(DynamicLookupHelper lookup) {
+ _table.reset(lookup);
+ }
+
+ // There are some #defines in egl.h that GlueGen and PCPP don't currently handle
+ public static final long EGL_DEFAULT_DISPLAY = 0;
+ public static final long EGL_NO_CONTEXT = 0;
+ public static final long EGL_NO_DISPLAY = 0;
+ public static final long EGL_NO_SURFACE = 0;
+ public static final int EGL_DONT_CARE = -1;
+ public static final int EGL_UNKNOWN = -1;
+
+ protected static long eglGetProcAddress(long eglGetProcAddressHandle, java.lang.String procname)
+ {
+ if (eglGetProcAddressHandle == 0) {
+ throw new GLException("Passed null pointer for method \"eglGetProcAddress\"");
+ }
+ return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle);
+ }
+
+
+ /**
+ * In case of an error on a particualr attribute, the attribute in the attributes-buffer is set to 0.
+ * <p>
+ * Entry point to C language function: <code> EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value); </code> <br>Part of <code>EGL_VERSION_1_X</code>
+ * </p>
+ */
+ public static void eglGetConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values) {
+ if( attributes == null || values == null ) {
+ throw new RuntimeException("arrays buffers are null");
+ }
+ if( !Buffers.isDirect(attributes) || !Buffers.isDirect(values) ) {
+ throw new RuntimeException("arrays buffers are not direct");
+ }
+ if( attributes.remaining() > values.remaining() ) {
+ throw new RuntimeException("not enough values "+values+" for attributes "+attributes);
+ }
+ final long __addr = _table._addressof_eglGetConfigAttrib;
+ dispatch_eglGetConfigAttributes(dpy, config, attributes.remaining(), attributes, Buffers.getDirectBufferByteOffset(attributes),
+ values, Buffers.getDirectBufferByteOffset(values), __addr);
+ }
+ private static native void dispatch_eglGetConfigAttributes(long dpy, long config, int attributeCount, Object attributes, int attributes_byte_offset, Object values, int valuesOffset, long procAddr);
+
diff --git a/make/config/jogl/egl.cfg b/make/config/jogl/egl.cfg
index b309850..94b6795 100644
--- a/make/config/jogl/egl.cfg
+++ b/make/config/jogl/egl.cfg
@@ -25,31 +25,7 @@ GetProcAddressTableExpr _table
ArgumentIsString eglGetProcAddress 0
ReturnsString eglQueryString
-CustomCCode #include <stdio.h> /* android */
-CustomCCode #include <gluegen_stdint.h>
-CustomCCode #include <gluegen_stddef.h>
-CustomCCode #include <EGL/egl.h>
-
-CustomJavaCode EGL private static EGLProcAddressTable _table = new EGLProcAddressTable(new GLProcAddressResolver());
-CustomJavaCode EGL public static void resetProcAddressTable(DynamicLookupHelper lookup) {
-CustomJavaCode EGL _table.reset(lookup);
-CustomJavaCode EGL }
-
-# There are some #defines in egl.h that GlueGen and PCPP don't currently handle
-CustomJavaCode EGL public static final long EGL_DEFAULT_DISPLAY = 0;
-CustomJavaCode EGL public static final long EGL_NO_CONTEXT = 0;
-CustomJavaCode EGL public static final long EGL_NO_DISPLAY = 0;
-CustomJavaCode EGL public static final long EGL_NO_SURFACE = 0;
-CustomJavaCode EGL public static final int EGL_DONT_CARE = -1;
-CustomJavaCode EGL public static final int EGL_UNKNOWN = -1;
-CustomJavaCode EGL
-CustomJavaCode EGL protected static long eglGetProcAddress(long eglGetProcAddressHandle, java.lang.String procname)
-CustomJavaCode EGL {
-CustomJavaCode EGL if (eglGetProcAddressHandle == 0) {
-CustomJavaCode EGL throw new GLException("Passed null pointer for method \"eglGetProcAddress\"");
-CustomJavaCode EGL }
-CustomJavaCode EGL return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle);
-CustomJavaCode EGL }
-
+IncludeAs CustomJavaCode EGL egl-CustomJavaCode.java
+IncludeAs CustomCCode egl-CustomCCode.c
Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver
diff --git a/make/config/jogl/eglext.cfg b/make/config/jogl/eglext.cfg
index a7fb454..7fccce7 100644
--- a/make/config/jogl/eglext.cfg
+++ b/make/config/jogl/eglext.cfg
@@ -17,6 +17,8 @@ NIODirectOnly __ALL__
ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/opengl/egl/EGL.java
+IgnoreExtension EGL_VERSION_1_X
+
HierarchicalNativeOutput false
# Use a ProcAddressTable so we dynamically look up the routines
diff --git a/make/config/jogl/glx-CustomCCode.c b/make/config/jogl/glx-CustomCCode.c
index 71dc68b..5c73dfe 100644
--- a/make/config/jogl/glx-CustomCCode.c
+++ b/make/config/jogl/glx-CustomCCode.c
@@ -61,6 +61,31 @@ static void _initClazzAccess(JNIEnv *env) {
/* Java->C glue code:
* Java package: jogamp.opengl.x11.glx.GLX
+ * Java method: int glXGetFBConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values)
+ */
+JNIEXPORT jint JNICALL
+Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigAttributes(JNIEnv *env, jclass _unused, jlong dpy, jlong config, jint attributeCount, jobject attributes, jint attributes_byte_offset, jobject values, jint values_byte_offset, jlong procAddress) {
+ typedef int (APIENTRY*_local_PFNGLXGETFBCONFIGATTRIBPROC)(Display * dpy, GLXFBConfig config, int attribute, int * value);
+ _local_PFNGLXGETFBCONFIGATTRIBPROC ptr_glXGetFBConfigAttrib = (_local_PFNGLXGETFBCONFIGATTRIBPROC) (intptr_t) procAddress;
+ assert(ptr_glXGetFBConfigAttrib != NULL);
+
+ int err = 0;
+ if ( attributeCount > 0 && NULL != attributes ) {
+ int i;
+ int * attributes_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, attributes)) + attributes_byte_offset);
+ int * values_ptr = (int *) (((char*) (*env)->GetDirectBufferAddress(env, values)) + values_byte_offset);
+ for(i=0; 0 == err && i<attributeCount; i++) {
+ err = (* ptr_glXGetFBConfigAttrib) ((Display *) (intptr_t) dpy, (GLXFBConfig) (intptr_t) config, attributes_ptr[i], &values_ptr[i]);
+ }
+ if( 0 != err ) {
+ values_ptr[0] = i;
+ }
+ }
+ return (jint)err;
+}
+
+/* Java->C glue code:
+ * Java package: jogamp.opengl.x11.glx.GLX
* Java method: XVisualInfo glXGetVisualFromFBConfig(long dpy, long config)
* C function: XVisualInfo * glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config);
*/
diff --git a/make/config/jogl/glx-CustomJavaCode.java b/make/config/jogl/glx-CustomJavaCode.java
index f3e7439..4cce05d 100644
--- a/make/config/jogl/glx-CustomJavaCode.java
+++ b/make/config/jogl/glx-CustomJavaCode.java
@@ -1,4 +1,26 @@
+ /**
+ * Returns the GLX error value, i.e. 0 for no error. In case of an error values.get(values.getPosition()) contains the attributes index causing the error.
+ * <p>
+ * Entry point to C language function: <code> int glXGetFBConfigAttrib(Display * dpy, GLXFBConfig config, int attribute, int * value); </code> <br>Part of <code>GLX_VERSION_1_3</code>
+ * </p>
+ */
+ public static int glXGetFBConfigAttributes(long dpy, long config, IntBuffer attributes, IntBuffer values) {
+ if( attributes == null || values == null ) {
+ throw new RuntimeException("arrays buffers are null");
+ }
+ if( !Buffers.isDirect(attributes) || !Buffers.isDirect(values) ) {
+ throw new RuntimeException("arrays buffers are not direct");
+ }
+ if( attributes.remaining() > values.remaining() ) {
+ throw new RuntimeException("not enough values "+values+" for attributes "+attributes);
+ }
+ final long __addr = glxProcAddressTable._addressof_glXGetFBConfigAttrib;
+ return dispatch_glXGetFBConfigAttributes(dpy, config, attributes.remaining(), attributes, Buffers.getDirectBufferByteOffset(attributes),
+ values, Buffers.getDirectBufferByteOffset(values), __addr);
+ }
+ private static native int dispatch_glXGetFBConfigAttributes(long dpy, long config, int attributeCount, Object attributes, int attributes_byte_offset, Object values, int valuesOffset, long procAddr);
+
/** Interface to C language function: <br> - Alias for: <br> <code> XVisualInfo * glXGetVisualFromFBConfigSGIX, glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig config); </code> */
public static XVisualInfo glXGetVisualFromFBConfig(long dpy, long config)
{
diff --git a/make/config/nativewindow/x11-CustomJavaCode.java b/make/config/nativewindow/x11-CustomJavaCode.java
index 4240c5e..d1e0111 100644
--- a/make/config/nativewindow/x11-CustomJavaCode.java
+++ b/make/config/nativewindow/x11-CustomJavaCode.java
@@ -1,4 +1,19 @@
+ /** Interface to C language function: <br> <code> XRenderPictFormat * XRenderFindVisualFormat(Display * dpy, const Visual * visual); </code> */
+ public static boolean XRenderFindVisualFormat(long dpy, long visual, XRenderPictFormat dest) {
+ if( dest == null ) {
+ throw new RuntimeException("dest is null");
+ }
+ final ByteBuffer destBuffer = dest.getBuffer();
+ if( !Buffers.isDirect(destBuffer) ) {
+ throw new RuntimeException("dest buffer is not direct");
+ }
+ return XRenderFindVisualFormat1(dpy, visual, destBuffer);
+ }
+ /** Entry point to C language function: <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */
+ private static native boolean XRenderFindVisualFormat1(long dpy, long visual, ByteBuffer xRenderPictFormat);
+
+
/** Interface to C language function: <br> <code> XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * ); </code> */
public static XVisualInfo[] XGetVisualInfo(long arg0, long arg1, XVisualInfo arg2, int[] arg3, int arg3_offset)
{
diff --git a/make/resources/android/AndroidManifest-jogl.xml b/make/resources/android/AndroidManifest-jogl.xml
index d88b48f..d9a9ac8 100644
--- a/make/resources/android/AndroidManifest-jogl.xml
+++ b/make/resources/android/AndroidManifest-jogl.xml
@@ -20,8 +20,20 @@
android:finishOnTaskLaunch="true"
android:launchMode="singleTop"
android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_v_name"
- android:description="@string/activity_v_descr"
+ android:label="@string/activity_version_name"
+ android:description="@string/activity_version_descr"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="jogamp.newt.driver.android.NewtDebugActivityLauncher"
+ android:finishOnTaskLaunch="true"
+ android:launchMode="singleTop"
+ android:configChanges="keyboardHidden|orientation"
+ android:label="@string/activity_debug_name"
+ android:description="@string/activity_debug_descr"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/make/resources/android/res-jogl/values/strings.xml b/make/resources/android/res-jogl/values/strings.xml
index 3064dad..ae48166 100644
--- a/make/resources/android/res-jogl/values/strings.xml
+++ b/make/resources/android/res-jogl/values/strings.xml
@@ -3,6 +3,8 @@
<string name="hello">Jogl Library</string>
<string name="app_name">JogAmp\'s Jogl Library</string>
<string name="app_descr">Contains Dalvik and native code, supporting native bindings.</string>
- <string name="activity_v_name">Jogl\'s Version</string>
- <string name="activity_v_descr">Shows the version of the JOGL Library and runtime GL infos.</string>
+ <string name="activity_version_name">Jogl\'s Version</string>
+ <string name="activity_version_descr">Shows the version of the JOGL Library and runtime GL infos.</string>
+ <string name="activity_debug_name">Jogl Debug</string>
+ <string name="activity_debug_descr">Debug output of JOGL\'s initialization.</string>
</resources>
diff --git a/make/scripts/adb-logcat.sh b/make/scripts/adb-logcat.sh
index ea4be3d..443011f 100755
--- a/make/scripts/adb-logcat.sh
+++ b/make/scripts/adb-logcat.sh
@@ -1,4 +1,4 @@
sdir=`dirname $0`
adb $* logcat -c
-adb $* logcat
+adb $* logcat 2>&1 | tee adb-logcat.log
diff --git a/make/scripts/java-win.bat b/make/scripts/java-win.bat
index 47b8184..2b45ae5 100755
--- a/make/scripts/java-win.bat
+++ b/make/scripts/java-win.bat
@@ -1,4 +1,5 @@
-%J2RE_HOME%\bin\java -classpath %CP_ALL% "-Djava.library.path=%LIB_DIR%" %D_ARGS% %X_ARGS% %* > java-win.log 2>&1
+REM %J2RE_HOME%\bin\java -classpath %CP_ALL% "-Djava.library.path=%LIB_DIR%" %D_ARGS% %X_ARGS% %* > java-win.log 2>&1
+%J2RE_HOME%\bin\java -classpath %CP_ALL% %D_ARGS% %X_ARGS% %* > java-win.log 2>&1
tail java-win.log
diff --git a/make/scripts/make.jogl.all.linux-x86-clang.sh b/make/scripts/make.jogl.all.linux-x86-clang.sh
new file mode 100755
index 0000000..b76997d
--- /dev/null
+++ b/make/scripts/make.jogl.all.linux-x86-clang.sh
@@ -0,0 +1,62 @@
+#! /bin/sh
+
+SDIR=`dirname $0`
+
+if [ -e $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86.sh ] ; then
+ . $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86.sh
+fi
+
+if [ "$1" = "-libdir" ] ; then
+ shift
+ if [ -z "$1" ] ; then
+ echo libdir argument missing
+ print_usage
+ exit
+ fi
+ CUSTOMLIBDIR="-Dcustom.libdir=$1"
+ shift
+fi
+
+
+# -Dc.compiler.debug=true
+# -Dsetup.addNativeOpenMAX=true \
+# -Dgluegen.cpptasks.detected.os=true \
+# -DisUnix=true \
+# -DisLinux=true \
+# -DisLinuxX86=true \
+# -DisX11=true \
+
+#LD_LIBRARY_PATH=/opt-linux-x86_64/mesa-7.8.1/lib64
+#export LD_LIBRARY_PATH
+
+LOGF=make.jogl.all.linux-x86-clang.log
+rm -f $LOGF
+
+# export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri
+# export LIBGL_DEBUG=verbose
+echo LIBXCB_ALLOW_SLOPPY_LOCK: $LIBXCB_ALLOW_SLOPPY_LOCK 2>&1 | tee -a $LOGF
+echo LIBGL_DRIVERS_PATH: $LIBGL_DRIVERS_PATH 2>&1 | tee -a $LOGF
+echo LIBGL_DEBUG: $LIBGL_DEBUG 2>&1 | tee -a $LOGF
+
+# -Dgluegen-cpptasks.file=`pwd`/../../gluegen/make/lib/gluegen-cpptasks-linux-32bit.xml \
+#
+
+export SOURCE_LEVEL=1.6
+export TARGET_LEVEL=1.6
+export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
+
+export GLUEGEN_PROPERTIES_FILE="../../gluegen/make/lib/gluegen-clang.properties"
+# or -Dgcc.compat.compiler=clang
+
+#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
+export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
+
+
+ant \
+ $CUSTOMLIBDIR \
+ -Drootrel.build=build-x86-clang \
+ -Dos.arch=x86 \
+ -Dsetup.addNativeOpenMAX=true \
+ -Dsetup.addNativeKD=true \
+ $* 2>&1 | tee -a $LOGF
+
diff --git a/make/scripts/make.jogl.all.linux-x86_64-clang.sh b/make/scripts/make.jogl.all.linux-x86_64-clang.sh
new file mode 100755
index 0000000..8a684b7
--- /dev/null
+++ b/make/scripts/make.jogl.all.linux-x86_64-clang.sh
@@ -0,0 +1,63 @@
+#! /bin/sh
+
+SDIR=`dirname $0`
+
+if [ -e $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh ] ; then
+ . $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh
+fi
+
+if [ "$1" = "-libdir" ] ; then
+ shift
+ if [ -z "$1" ] ; then
+ echo libdir argument missing
+ print_usage
+ exit
+ fi
+ CUSTOMLIBDIR="-Dcustom.libdir=$1"
+ shift
+fi
+
+# -Dc.compiler.debug=true \
+
+# -Dgluegen.cpptasks.detected.os=true \
+# -DisUnix=true \
+# -DisLinux=true \
+# -DisLinuxAMD64=true \
+# -DisX11=true \
+#
+# -Dtarget.sourcelevel=1.6 \
+# -Dtarget.targetlevel=1.6 \
+# -Dtarget.rt.jar=/opt-share/jre1.6.0_30/lib/rt.jar \
+#
+# -Dsetup.addNativeOpenMAX=true \
+# -Dsetup.addNativeKD=true \
+
+
+#LD_LIBRARY_PATH=/opt-linux-x86_64/mesa-7.8.1/lib64
+#export LD_LIBRARY_PATH
+
+LOGF=make.jogl.all.linux-x86_64-clang.log
+rm -f $LOGF
+
+# export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri
+# export LIBGL_DEBUG=verbose
+echo LIBXCB_ALLOW_SLOPPY_LOCK: $LIBXCB_ALLOW_SLOPPY_LOCK 2>&1 | tee -a $LOGF
+echo LIBGL_DRIVERS_PATH: $LIBGL_DRIVERS_PATH 2>&1 | tee -a $LOGF
+echo LIBGL_DEBUG: $LIBGL_DEBUG 2>&1 | tee -a $LOGF
+
+export SOURCE_LEVEL=1.6
+export TARGET_LEVEL=1.6
+export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
+
+export GLUEGEN_PROPERTIES_FILE="../../gluegen/make/lib/gluegen-clang.properties"
+# or -Dgcc.compat.compiler=clang
+
+#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
+export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
+
+# BUILD_ARCHIVE=true \
+ant \
+ $CUSTOMLIBDIR \
+ -Drootrel.build=build-x86_64-clang \
+ $* 2>&1 | tee -a $LOGF
+
diff --git a/make/scripts/make.jogl.all.macosx-clang.sh b/make/scripts/make.jogl.all.macosx-clang.sh
index eb633f5..b5f21c9 100755
--- a/make/scripts/make.jogl.all.macosx-clang.sh
+++ b/make/scripts/make.jogl.all.macosx-clang.sh
@@ -18,8 +18,8 @@ export SOURCE_LEVEL=1.6
export TARGET_LEVEL=1.6
export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
-export GLUEGEN_PROPERTIES_FILE="../../gluegen/make/lib/gluegen-clang.properties"
-# or -Dgcc.compat.compiler=clang
+export GLUEGEN_PROPERTIES_FILE="../../gluegen/make/lib/gluegen-xcode_clang.properties"
+# or -Dgcc.compat.compiler=xcode.clang
#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index 0632c24..f5417bf 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -1,10 +1,45 @@
REM scripts\java-win.bat jogamp.newt.awt.opengl.VersionApplet
REM scripts\java-win.bat com.jogamp.newt.opengl.GLWindow
REM scripts\java-win.bat javax.media.opengl.awt.GLCanvas
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT %*
+
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT -time 30000
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 4000 -x 10 -y 10 -width 100 -height 100 -screen 0
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 40000 -width 100 -height 100 -screen 0 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT -time 5000
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.DemoGLJPanelPerf02AWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl3.newt.TestGeomShader01TextureGL3NEWT %*
+
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.TexCubeES2 %*
+
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.perf.TestPerf001RawInit00NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLJPanelInit01AWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLJPanelInit02AWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLWindowInit03NEWT %*
+
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledRendering1GL2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledRendering2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering2GL2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering3GL2AWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT2 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingNIOImageSwingAWT %*
+
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLCapabilities01NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT %*
+scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT -time 5000
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT %*
@@ -17,15 +52,15 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedConte
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3 %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3b %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextWithJTabbedPaneAWT %*
-scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT %*
@@ -54,6 +89,12 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusi
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext11VSyncAnimNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext12FPSAnimNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLWindow01NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLJPanel01AWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLCanvas01AWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.anim.TestAWTCardLayoutAnimatorStartStopBug532 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.anim.Bug898AnimatorFromEDTAWT %*
+
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestSwingAWT01GLn
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock00AWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock02AWT %*
@@ -65,30 +106,6 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestJScrollPaneMi
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestBug642JSplitPaneMixHwLw01AWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestIsRealizedConcurrency01AWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledRendering1GL2NEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledRendering2NEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering2GL2NEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering3GL2AWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT2 %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingNIOImageSwingAWT %*
-
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT -time 30000
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT %*
-scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 4000 -x 10 -y 10 -width 100 -height 100 -screen 0
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 40000 -width 100 -height 100 -screen 0 %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT -time 5000
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT %*
-
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl3.newt.TestGeomShader01TextureGL3NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLSimple01NEWT -time 2000
@@ -101,11 +118,14 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCode
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventAutoRepeatAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNEWTWindowAWT $*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNEWTWindowAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersAWTCanvas %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasAWT $*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasSWTAWT $*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasSWTAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestParentingFocus01SwingAWTRobot %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestParentingFocus02SwingAWTRobot %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestParentingFocus03KeyTraversalAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT %*
@@ -113,7 +133,6 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenti
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cAWT -time 50000
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting03bAWT -time 100000
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01AWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting01aSWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT %*
@@ -127,13 +146,13 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTBug628ResizeDeadlock %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWTBug643AsyncExec %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestBug672NewtCanvasSWTSashForm %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestBug672NewtCanvasSWTSashFormComposite %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestWindows01NEWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestGLWindowInvisiblePointer01NEWT $*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestGLWindowInvisiblePointer01NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.nativewindow.TestRecursiveToolkitLockCORE
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00aNEWT %*
@@ -147,10 +166,6 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02aN
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02bNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.ManualScreenMode03sNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.TexCubeES2 %*
-
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle01NEWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT
diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat
index 726be54..6e8407f 100755
--- a/make/scripts/tests-x64-dbg.bat
+++ b/make/scripts/tests-x64-dbg.bat
@@ -21,13 +21,16 @@ set CP_ALL=.;%BLD_DIR%\jar\jogl-all.jar;%BLD_DIR%\jar\jogl-test.jar;..\..\joal\%
echo CP_ALL %CP_ALL%
REM set D_ARGS="-Djogamp.debug=all"
+REM set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all"
+REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all"
+REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug=all" "-Djogl.debug.EGLDrawableFactory.DontQuery"
+REM set D_ARGS="-Dnativewindow.debug.GDIUtil" "-Dnativewindow.debug.RegisteredClass"
REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.FBObject"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.DontQuery"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.QueryNativeTK"
-REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.GLContext" "-Djogl.debug.GLCanvas"
-REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug=all" "-Djogl.debug.EGLDrawableFactory.DontQuery"
REM set D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser -Djogl.debug.GLProfile"
+REM set D_ARGS="-Djogamp.debug.IOUtil"
REM set D_ARGS="-Djogl.debug.GLSLCode" "-Djogl.debug.GLMediaPlayer"
REM set D_ARGS="-Djogl.debug.GLMediaPlayer"
REM set D_ARGS="-Djogl.debug.GLMediaPlayer" "-Djogl.debug.AudioSink"
@@ -51,9 +54,11 @@ REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLC
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.GLJPanel" "-Djogl.debug.TileRenderer" "-Djogl.debug.TileRenderer.PNG"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.GLJPanel" "-Djogl.debug.TileRenderer"
+REM set D_ARGS="-Djogl.gljpanel.noverticalflip"
REM set D_ARGS="-Dnewt.debug.Window"
REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
-set D_ARGS="-Dnewt.debug.Window.MouseEvent"
+set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Window.KeyEvent" "-Dnewt.debug.EDT"
+REM set D_ARGS="-Dnewt.debug.Window.MouseEvent"
REM set D_ARGS="-Dnewt.debug.Window.MouseEvent" "-Dnewt.debug.Window.KeyEvent"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display"
REM set D_ARGS="-Djogl.debug.GLDebugMessageHandler" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index a93c2ed..cb60028 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -84,6 +84,17 @@ function jrun() {
#D_ARGS="-Djogl.debug.DebugGL"
#D_ARGS="-Djogl.debug.TraceGL"
#D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL"
+
+ #D_ARGS="-Djogamp.debug=all"
+ #D_ARGS="-Dnativewindow.debug=all"
+ #D_ARGS="-Djogl.debug=all"
+ #D_ARGS="-Dnewt.debug=all"
+ #D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
+ #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all"
+ #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
+ #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
+ #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all -Djogamp.debug.Lock"
+
#D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_XCLOSEDISPLAY_BUG"
#D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_MULTITHREADING_BUG"
#D_ARGS="-Djogl.disable.opengles"
@@ -93,7 +104,7 @@ function jrun() {
#D_ARGS="-Djogl.debug.FBObject"
#D_ARGS="-Djogl.debug.GLSLCode"
#D_ARGS="-Djogl.debug.GLSLCode -Djogl.debug.DebugGL"
- #D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
+ #D_ARGS="-Dnativewindow.debug.X11Util -Dnativewindow.debug.X11Util.TraceDisplayLifecycle -Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLContext -Dnativewindow.debug.JAWT -Dnewt.debug.Window"
#D_ARGS="-Dnativewindow.debug.JAWT -Djogamp.debug.TaskBase.TraceSource"
#D_ARGS="-Djogl.debug.GLContext.TraceSwitch"
@@ -110,10 +121,6 @@ function jrun() {
#D_ARGS="-Dnativewindow.debug.GraphicsConfiguration"
#D_ARGS="-Djogl.debug.GLContext"
#D_ARGS="-Djogl.debug.GLContext.NoProfileAliasing"
- #D_ARGS="-Djogamp.debug=all"
- #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
- #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
- #D_ARGS="-Dnativewindow.debug.X11Util -Dnativewindow.debug.X11Util.TraceDisplayLifecycle -Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLDrawable -Dnativewindow.debug.X11Util -Dnativewindow.debug.NativeWindow -Dnewt.debug.Display -Dnewt.debug.Screen -Dnewt.debug.Window"
#D_ARGS="-Djogl.debug.Animator -Djogl.debug.GLDrawable -Dnativewindow.debug.NativeWindow"
#D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
@@ -122,8 +129,6 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLEventListenerState"
#D_ARGS="-Djogl.fbo.force.none"
- #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all -Djogamp.debug.Lock"
- #D_ARGS="-Djogl.debug=all"
#D_ARGS="-Djogl.debug.EGLDrawableFactory.DontQuery -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.EGLDrawableFactory.QueryNativeTK -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLDebugMessageHandler"
@@ -136,16 +141,14 @@ function jrun() {
#D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL -Djogl.debug.GLContext.TraceSwitch -Djogl.debug=all"
#D_ARGS="-Djogamp.debug.IOUtil -Djogl.debug.GLSLCode -Djogl.debug.GLMediaPlayer"
#D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.AudioSink"
- D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLMediaPlayer.Native"
+ #D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLMediaPlayer.Native"
#D_ARGS="-Djogl.debug.GLMediaPlayer"
#D_ARGS="-Djogl.debug.GLMediaPlayer.StreamWorker.delay=25 -Djogl.debug.GLMediaPlayer"
#D_ARGS="-Djogl.debug.GLMediaPlayer.Native"
#D_ARGS="-Djogl.debug.AudioSink"
#D_ARGS="-Djogl.debug.GLArrayData"
- #D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Dnativewindow.debug.X11Util"
- #D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.Window"
#D_ARGS="-Dnewt.debug.Screen"
#D_ARGS="-Dnewt.test.Screen.disableRandR13"
@@ -158,7 +161,6 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator -Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.ExtensionAvailabilityCache"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable -Djogl.debug.EGLDisplayUtil"
- #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile"
#D_ARGS="-Djogl.debug.GLProfile"
#D_ARGS="-Dnativewindow.debug.NativeWindow -Dnewt.debug.Window -Dnewt.debug.Screen -Dnewt.debug.Display"
@@ -176,6 +178,7 @@ function jrun() {
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=3000 -Djogamp.debug.Lock -Dnativewindow.debug.ToolkitLock.TraceLock"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock -Dnativewindow.debug.ToolkitLock.TraceLock"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Dnativewindow.debug.X11Util"
+ #D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Dnativewindow.debug.X11Util"
#D_ARGS="-Dnewt.debug.EDT -Djogamp.common.utils.locks.Lock.timeout=600000 -Djogl.debug.Animator -Dnewt.debug.Display -Dnewt.debug.Screen"
#D_ARGS="-Dnewt.debug.Window -Djogamp.common.utils.locks.Lock.timeout=600000"
#D_ARGS="-Dnewt.debug=all -Djogamp.common.utils.locks.Lock.timeout=600000"
@@ -200,9 +203,10 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Xprof"
- #D_ARGS="-Dnativewindow.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl"
+ #D_ARGS="-Djogl.debug.GLJPanel -Djogl.debug.DebugGL"
+ #D_ARGS="-Djogl.gljpanel.noverticalflip"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator"
#D_ARGS="-Djogl.debug.GLContext -Dnativewindow.debug.X11Util.XSync"
#D_ARGS="-Dnativewindow.debug.X11Util.XSync -Dnativewindow.debug.ToolkitLock.TraceLock"
@@ -222,7 +226,6 @@ function jrun() {
#D_ARGS="-Dnewt.debug=all -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
#D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all -Djogamp.debug.Lock -Djogamp.common.utils.locks.Lock.timeout=10000"
#D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all"
- #D_ARGS="-Dnewt.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel -Djogl.debug.TileRenderer -Djogl.debug.TileRenderer.PNG"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel -Djogl.debug.TileRenderer"
#D_ARGS="-Djogl.debug.PNGImage"
@@ -296,6 +299,19 @@ function testawtswt() {
}
#
+# Version
+#
+#testawt jogamp.newt.awt.opengl.VersionApplet $*
+#testawt javax.media.opengl.awt.GLCanvas $*
+#testnoawt com.jogamp.nativewindow.NativeWindowVersion $*
+#testnoawt com.jogamp.opengl.JoglVersion $*
+#testnoawt com.jogamp.newt.NewtVersion $*
+#testnoawt com.jogamp.newt.opengl.GLWindow $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $*
+
+#
# demos (any TK, more user driven tests)
#
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT $*
@@ -328,8 +344,16 @@ function testawtswt() {
# av demos
#
#testnoawt jogamp.opengl.openal.av.ALDummyUsage $*
-testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
+testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
+
+#
+# performance tests
+#
+#testnoawt com.jogamp.opengl.test.junit.jogl.perf.TestPerf001RawInit00NEWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLJPanelInit01AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLJPanelInit02AWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.perf.TestPerf001GLWindowInit03NEWT $*
#
# tile rendring / printing w/ & w/o AWT
@@ -345,13 +369,8 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingNIOImageSwingAWT $*
#
-# core/newt (testnoawt and testawt)
+# CORE [NEWT + AWT] (testnoawt and testawt)
#
-#testnoawt com.jogamp.nativewindow.NativeWindowVersion $*
-#testnoawt com.jogamp.opengl.JoglVersion $*
-#testnoawt com.jogamp.newt.NewtVersion $*
-#testnoawt com.jogamp.newt.opengl.GLWindow $*
-
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestPMVMatrix01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestPMVMatrix02NOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestPMVMatrix03NOUI $*
@@ -360,8 +379,6 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestFloatUtil01MatrixMatrixMultNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestBinary16NOUI $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $*
@@ -392,6 +409,11 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
+
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
@@ -437,10 +459,20 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461PBufferSupersamplingSwingAWT
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAWTCloseX11DisplayBug565 $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLWindow01NEWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLJPanel01AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.anim.TestAWTCardLayoutAnimatorStartStopBug532 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.anim.Bug898AnimatorFromEDTAWT $*
+
+#
+# NEWT
+#
+
#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteWindow01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteGLWindows01NEWT $*
@@ -448,6 +480,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated $*
+#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows03NEWTAnimResize $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindowInvisiblePointer01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle01NEWT
#testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT
@@ -465,21 +498,15 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindowWarpPointer01NEWT $*
#
-# awt (testawt)
+# AWT
#
-#testawt jogamp.newt.awt.opengl.VersionApplet $*
-#testawt javax.media.opengl.awt.GLCanvas $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos01AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos02AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03aB729AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03bB849AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03cB849AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816JTabbedPanelVisibilityB849B878AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816GLCanvasFrameHoppingB849B889AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04aAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04bAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $*
@@ -495,16 +522,14 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug664GLCanvasSetVisibleSwingAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestIsRealizedConcurrency01AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.text.TestAWTTextRendererUseVertexArrayBug464
-#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
-#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461PBufferSupersamplingSwingAWT
#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug463ScaleImageMemoryAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug694ScaleImageUnpackBufferSizeAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug365TextureGenerateMipMaps $*
-#testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStopBug532 $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock00AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock01AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock02AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelTextureStateAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelResize01AWT $*
#testawt com.jogamp.opengl.test.bugs.Bug735Inv0AppletAWT $*
#testawt com.jogamp.opengl.test.bugs.Bug735Inv1AppletAWT $*
@@ -513,11 +538,13 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testawt com.jogamp.opengl.test.bugs.Bug735Inv4AWT $*
#
-# swt (testswt)
+# SWT (testswt)
#
#testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTEclipseGLCanvas01GLn $*
#testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
#testswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTGLn $*
+#testswt com.jogamp.opengl.test.junit.jogl.swt.TestBug672NewtCanvasSWTSashForm $*
+#testswt com.jogamp.opengl.test.junit.jogl.swt.TestBug672NewtCanvasSWTSashFormComposite $*
#
# awtswt (testawtswt)
@@ -536,8 +563,6 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#
#testawt com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 $*
#testawt com.jogamp.opengl.test.junit.newt.TestEventSourceNotAWTBug
-#testawt com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot $*
-#testawt com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventOrderAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventAutoRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT $*
@@ -547,6 +572,10 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersAWTCanvas $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasAWT $*
#testawtswt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasSWTAWT $*
+#testawt com.jogamp.opengl.test.junit.newt.event.TestParentingFocus01SwingAWTRobot $*
+#testawt com.jogamp.opengl.test.junit.newt.event.TestParentingFocus02SwingAWTRobot $*
+#testawt com.jogamp.opengl.test.junit.newt.event.TestParentingFocus03KeyTraversalAWT $*
+
#testawt com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT
#testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1AWT $*
@@ -575,11 +604,11 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#
#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT $*
-#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cSwingAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01aAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01bAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cAWT $*
+#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01dAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
@@ -645,8 +674,9 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#
# OSX bugs
#
-#testawt com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot $*
-#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
+
+#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocus02SwingAWTRobot $*
+#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocus03KeyTraversalAWT $*
# test rotation change
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02aNEWT
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
index b7a9c27..df60d2f 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
@@ -667,7 +667,7 @@ public class BuildComposablePipeline {
if( 0 != (GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS & getMode() ) ) {
output.println(" @Override");
output.println(" public final boolean isGLES() {");
- output.println(" return isGLES2() || isGLES1();");
+ output.println(" return isGLES3() || isGLES2() || isGLES1();");
output.println(" }");
} else {
emitGLIsMethod(output, "GLES");
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
index c642fb6..8783906 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
@@ -279,7 +279,7 @@ public abstract class Renderer {
public static final String es2_precision_fp = "\nprecision mediump float;\nprecision mediump int;\nprecision mediump sampler2D;\n";
protected String getFragmentShaderPrecision(GL2ES2 gl) {
- if( gl.isGLES2() ) {
+ if( gl.isGLES() ) {
return es2_precision_fp;
}
if( ShaderCode.requiresGL3DefaultPrecision(gl) ) {
diff --git a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
index c7aadcd..da9e08a 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
@@ -72,6 +72,7 @@ public class GLExtensions {
public static final String OES_read_format = "GL_OES_read_format";
public static final String OES_single_precision = "GL_OES_single_precision";
public static final String OES_EGL_image_external = "GL_OES_EGL_image_external";
+ public static final String OES_standard_derivatives = "GL_OES_standard_derivatives";
public static final String ARB_gpu_shader_fp64 = "GL_ARB_gpu_shader_fp64";
public static final String ARB_shader_objects = "GL_ARB_shader_objects";
diff --git a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
index 508f1aa..e1e7970 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
@@ -70,21 +70,49 @@ public class VectorUtil {
return newVector;
}
- /** Scales a vector by param
+ /** Scales a vector by param creating a new float[] for the result!
* @param vector input vector
* @param scale constant to scale by
- * @return scaled vector
+ * @return new scaled vector
+ * @deprecated Use {@link #scale(float[], float[], float)}
*/
public static float[] scale(float[] vector, float scale)
{
final float[] newVector = new float[3];
- newVector[0] = vector[0]*scale;
- newVector[1] = vector[1]*scale;
- newVector[2] = vector[2]*scale;
+ newVector[0] = vector[0] * scale;
+ newVector[1] = vector[1] * scale;
+ newVector[2] = vector[2] * scale;
return newVector;
}
+ /** Scales a vector by param using given result float[]
+ * @param result vector for the result
+ * @param vector input vector
+ * @param scale single scale constant for all vector components
+ */
+ public static float[] scale(float[] result, float[] vector, float scale)
+ {
+ result[0] = vector[0] * scale;
+ result[1] = vector[1] * scale;
+ result[2] = vector[2] * scale;
+ return result;
+ }
+
+ /** Scales a vector by param using given result float[]
+ * @param result vector for the result
+ * @param vector input vector
+ * @param scale 3 component scale constant for each vector component
+ * @return given result vector
+ */
+ public static float[] scale(float[] result, float[] vector, float[] scale)
+ {
+ result[0] = vector[0] * scale[0];
+ result[1] = vector[1] * scale[1];
+ result[2] = vector[2] * scale[2];
+ return result;
+ }
+
/** Adds to vectors
* @param v1 vector 1
* @param v2 vector 2
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index 27b9427..7990692 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -110,7 +110,7 @@ public class Animator extends AnimatorBase {
}
@Override
- protected String getBaseName(String prefix) {
+ protected final String getBaseName(String prefix) {
return prefix + "Animator" ;
}
@@ -120,40 +120,28 @@ public class Animator extends AnimatorBase {
* animation loop which prevents the CPU from getting swamped.
* This method may not have an effect on subclasses.
*/
- public final void setRunAsFastAsPossible(boolean runFast) {
- stateSync.lock();
- try {
- runAsFastAsPossible = runFast;
- } finally {
- stateSync.unlock();
- }
- }
-
- private final void setIsAnimatingSynced(boolean v) {
- stateSync.lock();
- try {
- isAnimating = v;
- } finally {
- stateSync.unlock();
- }
+ public final synchronized void setRunAsFastAsPossible(boolean runFast) {
+ runAsFastAsPossible = runFast;
}
class MainLoop implements Runnable {
@Override
public String toString() {
- return "[started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", drawable "+drawables.size()+", drawablesEmpty "+drawablesEmpty+"]";
+ return "[started "+isStarted()+", animating "+isAnimating()+", paused "+isPaused()+", drawable "+drawables.size()+", drawablesEmpty "+drawablesEmpty+"]";
}
@Override
public void run() {
try {
- if(DEBUG) {
- System.err.println("Animator start on " + getThreadName() + ": " + toString());
+ synchronized (Animator.this) {
+ if(DEBUG) {
+ System.err.println("Animator start on " + getThreadName() + ": " + toString());
+ }
+ fpsCounter.resetFPSCounter();
+ animThread = Thread.currentThread();
+ isAnimating = false;
+ // 'waitForStartedCondition' wake-up is handled below!
}
- fpsCounter.resetFPSCounter();
- animThread = Thread.currentThread();
- setIsAnimatingSynced(false); // barrier
- // 'waitForStartedCondition' wake-up is handled below!
while (!stopIssued) {
synchronized (Animator.this) {
@@ -172,7 +160,7 @@ public class Animator extends AnimatorBase {
setDrawablesExclCtxState(false);
display(); // propagate exclusive change!
}
- setIsAnimatingSynced(false); // barrier
+ isAnimating = false;
Animator.this.notifyAll();
try {
Animator.this.wait();
@@ -191,7 +179,7 @@ public class Animator extends AnimatorBase {
// - and -
// Resume from pause or drawablesEmpty,
// implies !pauseIssued and !drawablesEmpty
- setIsAnimatingSynced(true); // barrier
+ isAnimating = true;
setDrawablesExclCtxState(exclusiveContext);
Animator.this.notifyAll();
}
@@ -221,37 +209,21 @@ public class Animator extends AnimatorBase {
stopIssued = false;
pauseIssued = false;
animThread = null;
- setIsAnimatingSynced(false); // barrier
+ isAnimating = false;
Animator.this.notifyAll();
}
}
}
}
- private final boolean isAnimatingImpl() {
- return animThread != null && isAnimating ;
- }
@Override
- public final boolean isAnimating() {
- stateSync.lock();
- try {
- return animThread != null && isAnimating ;
- } finally {
- stateSync.unlock();
- }
+ public final synchronized boolean isAnimating() {
+ return animThread != null && isAnimating ;
}
- private final boolean isPausedImpl() {
- return animThread != null && pauseIssued ;
- }
@Override
- public final boolean isPaused() {
- stateSync.lock();
- try {
- return animThread != null && pauseIssued ;
- } finally {
- stateSync.unlock();
- }
+ public final synchronized boolean isPaused() {
+ return animThread != null && pauseIssued ;
}
/**
@@ -260,16 +232,16 @@ public class Animator extends AnimatorBase {
* @param tg the {@link ThreadGroup}
* @throws GLException if the animator has already been started
*/
- public synchronized void setThreadGroup(ThreadGroup tg) throws GLException {
- if ( isStartedImpl() ) {
+ public final synchronized void setThreadGroup(ThreadGroup tg) throws GLException {
+ if ( isStarted() ) {
throw new GLException("Animator already started.");
}
threadGroup = tg;
}
@Override
- public synchronized boolean start() {
- if ( isStartedImpl() ) {
+ public final synchronized boolean start() {
+ if ( isStarted() ) {
return false;
}
if (runnable == null) {
@@ -294,12 +266,12 @@ public class Animator extends AnimatorBase {
private final Condition waitForStartedCondition = new Condition() {
@Override
public boolean eval() {
- return !isStartedImpl() || (!drawablesEmpty && !isAnimating) ;
+ return !isStarted() || (!drawablesEmpty && !isAnimating) ;
} };
@Override
- public synchronized boolean stop() {
- if ( !isStartedImpl() ) {
+ public final synchronized boolean stop() {
+ if ( !isStarted() ) {
return false;
}
stopIssued = true;
@@ -308,12 +280,12 @@ public class Animator extends AnimatorBase {
private final Condition waitForStoppedCondition = new Condition() {
@Override
public boolean eval() {
- return isStartedImpl();
+ return isStarted();
} };
@Override
- public synchronized boolean pause() {
- if ( !isStartedImpl() || pauseIssued ) {
+ public final synchronized boolean pause() {
+ if ( !isStarted() || pauseIssued ) {
return false;
}
pauseIssued = true;
@@ -323,12 +295,12 @@ public class Animator extends AnimatorBase {
@Override
public boolean eval() {
// end waiting if stopped as well
- return isStartedImpl() && isAnimating;
+ return isStarted() && isAnimating;
} };
@Override
- public synchronized boolean resume() {
- if ( !isStartedImpl() || !pauseIssued ) {
+ public final synchronized boolean resume() {
+ if ( !isStarted() || !pauseIssued ) {
return false;
}
pauseIssued = false;
@@ -338,6 +310,6 @@ public class Animator extends AnimatorBase {
@Override
public boolean eval() {
// end waiting if stopped as well
- return isStartedImpl() && ( !drawablesEmpty && !isAnimating || drawablesEmpty && !pauseIssued ) ;
+ return isStarted() && ( !drawablesEmpty && !isAnimating || drawablesEmpty && !pauseIssued ) ;
} };
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index f6ee337..3964374 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -28,8 +28,6 @@
package com.jogamp.opengl.util;
-import com.jogamp.common.util.locks.LockFactory;
-import com.jogamp.common.util.locks.RecursiveLock;
import jogamp.opengl.Debug;
import jogamp.opengl.FPSCounterImpl;
@@ -86,7 +84,6 @@ public abstract class AnimatorBase implements GLAnimatorControl {
protected boolean exclusiveContext;
protected Thread userExclusiveContextThread;
protected FPSCounterImpl fpsCounter = new FPSCounterImpl();
- protected RecursiveLock stateSync = LockFactory.createRecursiveLock();
private final static Class<?> awtAnimatorImplClazz;
static {
@@ -129,7 +126,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
*
* @throws GLException if Animator is {@link #isStarted()}
*/
- protected synchronized void initImpl(boolean force) {
+ protected final synchronized void initImpl(boolean force) {
if( force || null == impl ) {
if( useAWTAnimatorImpl( modeBits ) ) {
try {
@@ -157,7 +154,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change
* @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD
*/
- public synchronized void setModeBits(boolean enable, int bitValues) throws GLException {
+ public final synchronized void setModeBits(boolean enable, int bitValues) throws GLException {
final int _oldModeBits = modeBits;
if(enable) {
modeBits |= bitValues;
@@ -175,7 +172,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
@Override
- public synchronized void add(final GLAutoDrawable drawable) {
+ public final synchronized void add(final GLAutoDrawable drawable) {
if(DEBUG) {
System.err.println("Animator add: 0x"+Integer.toHexString(drawable.hashCode())+" - "+toString()+" - "+getThreadName());
}
@@ -207,7 +204,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
@Override
- public synchronized void remove(final GLAutoDrawable drawable) {
+ public final synchronized void remove(final GLAutoDrawable drawable) {
if(DEBUG) {
System.err.println("Animator remove: 0x"+Integer.toHexString(drawable.hashCode())+" - "+toString()+" - "+getThreadName());
}
@@ -270,17 +267,11 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* @see #isExclusiveContextEnabled()
*/
// @Override
- public final Thread setExclusiveContext(Thread t) {
- final Thread old;
+ public final synchronized Thread setExclusiveContext(Thread t) {
final boolean enable = null != t;
- stateSync.lock();
- try {
- old = userExclusiveContextThread;
- if( enable && t != animThread ) { // disable: will be cleared at end after propagation && filter out own animThread usae
- userExclusiveContextThread=t;
- }
- } finally {
- stateSync.unlock();
+ final Thread old = userExclusiveContextThread;
+ if( enable && t != animThread ) { // disable: will be cleared at end after propagation && filter out own animThread usae
+ userExclusiveContextThread=t;
}
setExclusiveContext(enable);
return old;
@@ -340,11 +331,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
pause();
}
}
- stateSync.lock();
- try {
+ synchronized(AnimatorBase.this) {
userExclusiveContextThread=null;
- } finally {
- stateSync.unlock();
}
}
}
@@ -361,13 +349,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* @see #setExclusiveContext(Thread)
*/
// @Override
- public final boolean isExclusiveContextEnabled() {
- stateSync.lock();
- try {
- return exclusiveContext;
- } finally {
- stateSync.unlock();
- }
+ public final synchronized boolean isExclusiveContextEnabled() {
+ return exclusiveContext;
}
/**
@@ -384,13 +367,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* @see #setExclusiveContext(Thread)
*/
// @Override
- public final Thread getExclusiveContextThread() {
- stateSync.lock();
- try {
- return ( isStartedImpl() && exclusiveContext ) ? ( null != userExclusiveContextThread ? userExclusiveContextThread : animThread ) : null ;
- } finally {
- stateSync.unlock();
- }
+ public final synchronized Thread getExclusiveContextThread() {
+ return ( isStarted() && exclusiveContext ) ? ( null != userExclusiveContextThread ? userExclusiveContextThread : animThread ) : null ;
}
/**
@@ -425,13 +403,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
@Override
- public final Thread getThread() {
- stateSync.lock();
- try {
- return animThread;
- } finally {
- stateSync.unlock();
- }
+ public final synchronized Thread getThread() {
+ return animThread;
}
/** Called every frame to cause redrawing of all of the
@@ -439,7 +412,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
this to get the most optimized painting behavior for the set of
components this Animator manages, in particular when multiple
lightweight widgets are continually being redrawn. */
- protected void display() {
+ protected final void display() {
impl.display(drawables, ignoreExceptions, printExceptions);
fpsCounter.tickFPS();
}
@@ -497,7 +470,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
/** Sets a flag causing this Animator to ignore exceptions produced
while redrawing the drawables. By default this flag is set to
false, causing any exception thrown to halt the Animator. */
- public void setIgnoreExceptions(boolean ignoreExceptions) {
+ public final void setIgnoreExceptions(boolean ignoreExceptions) {
this.ignoreExceptions = ignoreExceptions;
}
@@ -505,7 +478,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
this Animator (see {@link #setIgnoreExceptions}), to print the
exceptions' stack traces for diagnostic information. Defaults to
false. */
- public void setPrintExceptions(boolean printExceptions) {
+ public final void setPrintExceptions(boolean printExceptions) {
this.printExceptions = printExceptions;
}
@@ -522,42 +495,59 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* if > <code>0</code>, method will wait for the given <code>pollPeriod</code> in milliseconds.
* @return <code>true</code> if {@link Condition#eval() waitCondition.eval()} returned <code>false</code>, otherwise <code>false</code>.
*/
- protected synchronized boolean finishLifecycleAction(Condition waitCondition, long pollPeriod) {
- // It's hard to tell whether the thread which changes the lifecycle has
- // dependencies on the Animator's internal thread. Currently we
- // use a couple of heuristics to determine whether we should do
- // the blocking wait().
+ protected final synchronized boolean finishLifecycleAction(Condition waitCondition, long pollPeriod) {
+ /**
+ * It's hard to tell whether the thread which changes the lifecycle has
+ * dependencies on the Animator's internal thread. Currently we
+ * use a couple of heuristics to determine whether we should do
+ * the blocking wait().
+ */
initImpl(false);
- final boolean blocking = impl.blockUntilDone(animThread);
- long remaining = blocking ? TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION : 0;
- if( 0 >= pollPeriod ) {
- pollPeriod = remaining;
- }
- boolean nok = waitCondition.eval();
- while ( nok && remaining>0 ) {
- final long t1 = System.currentTimeMillis();
- if( pollPeriod > remaining ) { pollPeriod = remaining; }
- notifyAll();
- try {
- wait(pollPeriod);
- } catch (InterruptedException ie) { }
- remaining -= System.currentTimeMillis() - t1 ;
+ final boolean blocking;
+ long remaining;
+ boolean nok;
+ if( impl.blockUntilDone(animThread) ) {
+ blocking = true;
+ remaining = TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION;
+ if( 0 >= pollPeriod ) {
+ pollPeriod = remaining;
+ }
nok = waitCondition.eval();
+ while ( nok && remaining>0 ) {
+ final long t1 = System.currentTimeMillis();
+ if( pollPeriod > remaining ) { pollPeriod = remaining; }
+ notifyAll();
+ try {
+ wait(pollPeriod);
+ } catch (InterruptedException ie) { }
+ remaining -= System.currentTimeMillis() - t1 ;
+ nok = waitCondition.eval();
+ }
+ } else {
+ /**
+ * Even though we are not able to block until operation is completed at this point,
+ * best effort shall be made to preserve functionality.
+ * Here: Issue notifyAll() if waitCondition still holds and test again.
+ *
+ * Non blocking reason could be utilizing AWT Animator while operation is performed on AWT-EDT.
+ */
+ blocking = false;
+ remaining = 0;
+ nok = waitCondition.eval();
+ if( nok ) {
+ notifyAll();
+ nok = waitCondition.eval();
+ }
}
if(DEBUG || blocking && nok) { // Info only if DEBUG or ( blocking && not-ok ) ; !blocking possible if AWT
- if( remaining<=0 && nok ) {
+ if( blocking && remaining<=0 && nok ) {
System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): ++++++ timeout reached ++++++ " + getThreadName());
}
- stateSync.lock(); // avoid too many lock/unlock ops
- try {
- System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): OK "+(!nok)+
- "- pollPeriod "+pollPeriod+", blocking "+blocking+
- ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION +
- " - " + getThreadName());
- System.err.println(" - "+toString());
- } finally {
- stateSync.unlock();
- }
+ System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): OK "+(!nok)+
+ "- pollPeriod "+pollPeriod+", blocking "+blocking+
+ ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION +
+ " - " + getThreadName());
+ System.err.println(" - "+toString());
if(nok) {
Thread.dumpStack();
}
@@ -565,17 +555,9 @@ public abstract class AnimatorBase implements GLAnimatorControl {
return !nok;
}
- protected final boolean isStartedImpl() {
- return animThread != null ;
- }
@Override
- public boolean isStarted() {
- stateSync.lock();
- try {
- return animThread != null ;
- } finally {
- stateSync.unlock();
- }
+ public synchronized boolean isStarted() {
+ return animThread != null ;
}
protected static String getThreadName() { return Thread.currentThread().getName(); }
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index 351c47e..65fed17 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -59,7 +59,7 @@ public class FPSAnimator extends AnimatorBase {
private Timer timer = null;
private MainTask task = null;
private int fps;
- private boolean scheduleAtFixedRate;
+ private final boolean scheduleAtFixedRate;
private boolean isAnimating; // MainTask feedback
private volatile boolean shouldRun; // MainTask trigger
private volatile boolean shouldStop; // MainTask trigger
@@ -107,7 +107,7 @@ public class FPSAnimator extends AnimatorBase {
* @throws GLException if the animator has already been started
*/
public final synchronized void setFPS(int fps) throws GLException {
- if ( isStartedImpl() ) {
+ if ( isStarted() ) {
throw new GLException("Animator already started.");
}
this.fps = fps;
@@ -131,7 +131,7 @@ public class FPSAnimator extends AnimatorBase {
alreadyStopped = false;
alreadyPaused = false;
- final long period = 0 < fps ? (long) (1000.0f / (float) fps) : 1; // 0 -> 1: IllegalArgumentException: Non-positive period
+ final long period = 0 < fps ? (long) (1000.0f / fps) : 1; // 0 -> 1: IllegalArgumentException: Non-positive period
if (scheduleAtFixedRate) {
timer.scheduleAtFixedRate(this, 0, period);
} else {
@@ -142,8 +142,8 @@ public class FPSAnimator extends AnimatorBase {
public boolean isActive() { return !alreadyStopped && !alreadyPaused; }
@Override
- public String toString() {
- return "Task[thread "+animThread+", stopped "+alreadyStopped+", paused "+alreadyPaused+" shouldRun "+shouldRun+", shouldStop "+shouldStop+" -- started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", drawable "+drawables.size()+", drawablesEmpty "+drawablesEmpty+"]";
+ public final String toString() {
+ return "Task[thread "+animThread+", stopped "+alreadyStopped+", paused "+alreadyPaused+" shouldRun "+shouldRun+", shouldStop "+shouldStop+" -- started "+isStarted()+", animating "+isAnimatingImpl()+", paused "+isPaused()+", drawable "+drawables.size()+", drawablesEmpty "+drawablesEmpty+"]";
}
@Override
@@ -212,33 +212,20 @@ public class FPSAnimator extends AnimatorBase {
return animThread != null && isAnimating ;
}
@Override
- public final boolean isAnimating() {
- stateSync.lock();
- try {
- return animThread != null && isAnimating ;
- } finally {
- stateSync.unlock();
- }
+ public final synchronized boolean isAnimating() {
+ return animThread != null && isAnimating ;
}
- private final boolean isPausedImpl() {
- return animThread != null && ( !shouldRun && !shouldStop ) ;
- }
@Override
- public final boolean isPaused() {
- stateSync.lock();
- try {
- return animThread != null && ( !shouldRun && !shouldStop ) ;
- } finally {
- stateSync.unlock();
- }
+ public final synchronized boolean isPaused() {
+ return animThread != null && ( !shouldRun && !shouldStop ) ;
}
static int timerNo = 0;
@Override
- public synchronized boolean start() {
- if ( null != timer || null != task || isStartedImpl() ) {
+ public final synchronized boolean start() {
+ if ( null != timer || null != task || isStarted() ) {
return false;
}
timer = new Timer( getThreadName()+"-"+baseName+"-Timer"+(timerNo++) );
@@ -262,20 +249,20 @@ public class FPSAnimator extends AnimatorBase {
private final Condition waitForStartedAddedCondition = new Condition() {
@Override
public boolean eval() {
- return !isStartedImpl() || !isAnimating ;
+ return !isStarted() || !isAnimating ;
} };
private final Condition waitForStartedEmptyCondition = new Condition() {
@Override
public boolean eval() {
- return !isStartedImpl() || isAnimating ;
+ return !isStarted() || isAnimating ;
} };
/** Stops this FPSAnimator. Due to the implementation of the
FPSAnimator it is not guaranteed that the FPSAnimator will be
completely stopped by the time this method returns. */
@Override
- public synchronized boolean stop() {
- if ( null == timer || !isStartedImpl() ) {
+ public final synchronized boolean stop() {
+ if ( null == timer || !isStarted() ) {
return false;
}
if(DEBUG) {
@@ -308,12 +295,12 @@ public class FPSAnimator extends AnimatorBase {
private final Condition waitForStoppedCondition = new Condition() {
@Override
public boolean eval() {
- return isStartedImpl();
+ return isStarted();
} };
@Override
- public synchronized boolean pause() {
- if ( !isStartedImpl() || ( null != task && isPausedImpl() ) ) {
+ public final synchronized boolean pause() {
+ if ( !isStarted() || ( null != task && isPaused() ) ) {
return false;
}
if(DEBUG) {
@@ -341,12 +328,12 @@ public class FPSAnimator extends AnimatorBase {
@Override
public boolean eval() {
// end waiting if stopped as well
- return isAnimating && isStartedImpl();
+ return isAnimating && isStarted();
} };
@Override
- public synchronized boolean resume() {
- if ( null != task || !isStartedImpl() || !isPausedImpl() ) {
+ public final synchronized boolean resume() {
+ if ( null != task || !isStarted() || !isPaused() ) {
return false;
}
if(DEBUG) {
@@ -369,6 +356,6 @@ public class FPSAnimator extends AnimatorBase {
@Override
public boolean eval() {
// end waiting if stopped as well
- return !drawablesEmpty && !isAnimating && isStartedImpl();
+ return !drawablesEmpty && !isAnimating && isStarted();
} };
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
index 2ac4b1f..22f5c01 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
@@ -151,7 +151,7 @@ public abstract class TileRendererBase {
* {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}'s
* {@link GLAutoDrawable#display()} call for each tile before {@link #display(GLAutoDrawable)}.
* <p>
- * The <a href="#pmvmatrix">PMV Matrix</a> shall be reshaped
+ * The <a href="TileRendererBase#pmvmatrix">PMV Matrix</a> shall be reshaped
* according to the given
* <ul>
* <li>current tile-position</li>
@@ -350,7 +350,7 @@ public abstract class TileRendererBase {
* i.e. after very last call of {@link #endTile(GL)}!
* </p>
* <p>
- * The <a href="#pmvmatrix">PMV Matrix</a>
+ * The <a href="TileRendererBase.html#pmvmatrix">PMV Matrix</a>
* must be reshaped after this call using:
* <ul>
* <li>Current Viewport
@@ -371,7 +371,7 @@ public abstract class TileRendererBase {
* this renderer {@link #endTile(GL)}.
* </p>
* <p>
- * User has to comply with the <a href="#glprequirement">GL profile requirement</a>.
+ * User has to comply with the <a href="TileRendererBase.html#glprequirement">GL profile requirement</a>.
* </p>
* <p>
* If {@link #eot() end of tiling} has been reached,
@@ -398,7 +398,7 @@ public abstract class TileRendererBase {
* calling this method!
* </p>
* <p>
- * User has to comply with the <a href="#glprequirement">GL profile requirement</a>.
+ * User has to comply with the <a href="TileRendererBase.html#glprequirement">GL profile requirement</a>.
* </p>
*
* @param gl the gl context
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
index f0864f9..22a5cfb 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
@@ -318,9 +318,6 @@ public interface GLMediaPlayer extends TextureSequence {
public int getTextureCount();
- /** Returns the texture target used by implementation. */
- public int getTextureTarget();
-
/** Sets the texture unit. Defaults to 0. */
public void setTextureUnit(int u);
@@ -361,7 +358,10 @@ public interface GLMediaPlayer extends TextureSequence {
public void initStream(URI streamLoc, int vid, int aid, int textureCount) throws IllegalStateException, IllegalArgumentException;
/**
- * Returns the {@link StreamException} caught in the decoder thread, or <code>null</code>.
+ * Returns the {@link StreamException} caught in the decoder thread, or <code>null</code> if none occured.
+ * <p>
+ * Method clears the cached {@link StreamException}, hence an immediate subsequent call will return <code>null</code>.
+ * </p>
* @see GLMediaEventListener#EVENT_CHANGE_ERR
* @see StreamException
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
index 77b14b4..a333560 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
@@ -101,20 +101,24 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
if( width * height > image.getWidth() * image.getHeight() ) {
throw new IllegalArgumentException("Requested size exceeds image size: "+width+"x"+height+" > "+image.getWidth()+"x"+image.getHeight());
}
- if( width == image.getWidth() ) {
- if( height == image.getHeight() ) {
- return image;
- }
- return image.getSubimage(0, 0, width, height);
+ if( width == image.getWidth() && height == image.getHeight() ) {
+ return image;
+ } else {
+ final ColorModel cm = image.getColorModel();
+ final WritableRaster raster0 = image.getRaster();
+ final DataBuffer dataBuffer = raster0.getDataBuffer();
+ final SinglePixelPackedSampleModel sppsm0 = (SinglePixelPackedSampleModel) raster0.getSampleModel();
+ final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(),
+ width, height, width /* scanLineStride */, sppsm0.getBitMasks());
+ final WritableRaster raster1 = WritableRaster.createWritableRaster(sppsm1, dataBuffer, null);
+ return new BufferedImage (cm, raster1, cm.isAlphaPremultiplied(), null);
}
- final ColorModel cm = image.getColorModel();
- final WritableRaster raster = image.getRaster();
- final DataBuffer dataBuffer = raster.getDataBuffer();
- final SinglePixelPackedSampleModel sppsm0 = (SinglePixelPackedSampleModel) raster.getSampleModel();
- final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(),
- width, height, width /* scanLineStride */, sppsm0.getBitMasks());
- final WritableRaster raster1 = WritableRaster.createWritableRaster(sppsm1, dataBuffer, null);
- return new BufferedImage (cm, raster1, cm.isAlphaPremultiplied(), null);
+ }
+
+ public final boolean isDataBufferSource(BufferedImage imageU) {
+ final DataBuffer dataBuffer0 = image.getRaster().getDataBuffer();
+ final DataBuffer dataBufferU = imageU.getRaster().getDataBuffer();
+ return dataBufferU == dataBuffer0;
}
@Override
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
index 206aa0f..6a64ede 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
@@ -843,8 +843,28 @@ public class ShaderCode {
/** Default precision of GLSL ≥ 1.30 as required until < 1.50 for {@link GL2ES2#GL_FRAGMENT_SHADER fragment-shader}: {@value #gl3_default_precision_fp}. See GLSL Spec 1.30-1.50 Section 4.5.3. */
public static final String gl3_default_precision_fp = "\nprecision highp float;\nprecision mediump int;\n/*precision mediump sampler2D;*/\n";
- /** Prefer <code>enable</code> over <code>require</code>, since it won't force a failure. */
- public static final String extOESDerivativesEnable = "#extension GL_OES_standard_derivatives : enable\n";
+ /** <i>Behavior</i> for GLSL extension directive, see {@link #createExtensionDirective(String, String)}, value {@value}. */
+ public static final String REQUIRE = "require";
+ /** <i>Behavior</i> for GLSL extension directive, see {@link #createExtensionDirective(String, String)}, value {@value}. */
+ public static final String ENABLE = "enable";
+ /** <i>Behavior</i> for GLSL extension directive, see {@link #createExtensionDirective(String, String)}, value {@value}. */
+ public static final String DISABLE = "disable";
+ /** <i>Behavior</i> for GLSL extension directive, see {@link #createExtensionDirective(String, String)}, value {@value}. */
+ public static final String WARN = "warn";
+
+ /**
+ * Creates a GLSL extension directive.
+ * <p>
+ * Prefer {@link #ENABLE} over {@link #REQUIRE}, since the latter will force a failure if not supported.
+ * </p>
+ *
+ * @param extensionName
+ * @param behavior shall be either {@link #REQUIRE}, {@link #ENABLE}, {@link #DISABLE} or {@link #WARN}
+ * @return the complete extension directive
+ */
+ public static String createExtensionDirective(String extensionName, String behavior) {
+ return "#extension " + extensionName + " : " + behavior;
+ }
/**
* Add GLSL version at the head of this shader source code.
@@ -915,7 +935,7 @@ public class ShaderCode {
/** Returns true, if GLSL version requires default precision, i.e. ES2 or GLSL [1.30 .. 1.50[. */
public static final boolean requiresDefaultPrecision(GL2ES2 gl) {
- if( gl.isGLES2() || gl.isGLES3() ) {
+ if( gl.isGLES() ) {
return true;
}
return requiresGL3DefaultPrecision(gl);
@@ -979,7 +999,7 @@ public class ShaderCode {
} else {
pos = 0;
}
- if( gl.isGLES2() && null != esDefaultPrecision ) {
+ if( gl.isGLES() && null != esDefaultPrecision ) {
pos = insertShaderSource(0, pos, esDefaultPrecision);
} else {
pos = addDefaultShaderPrecision(gl, pos);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
index c34e019..6c2949c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
@@ -105,7 +105,6 @@ import com.jogamp.opengl.util.TimeFrameI;
*
*/
public interface TextureSequence {
- public static final String GL_OES_EGL_image_external_Required_Prelude = "#extension GL_OES_EGL_image_external : enable\n";
public static final String samplerExternalOES = "samplerExternalOES";
public static final String sampler2D = "sampler2D";
@@ -164,6 +163,9 @@ public interface TextureSequence {
public void newFrameAvailable(T ts, TextureFrame newFrame, long when);
}
+ /** Returns the texture target used by implementation. */
+ public int getTextureTarget();
+
/** Return the texture unit used to render the current frame. */
public int getTextureUnit();
diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java
index e84dd7b..a19a991 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/javax/media/opengl/GLBase.java
@@ -150,7 +150,7 @@ public interface GLBase {
/**
* Indicates whether this GL object conforms to one of the OpenGL ES profiles,
- * see {@link #isGLES1()} and {@link #isGLES2()}.
+ * see {@link #isGLES1()}, {@link #isGLES2()} and {@link #isGLES3()}.
* @see GLContext#isGLES()
*/
public boolean isGLES();
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 2af4ba3..9b823a6 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -220,7 +220,7 @@ public abstract class GLDrawableFactory {
}
try {
gldf.resetDisplayGamma();
- gldf.destroy();
+ gldf.shutdownImpl();
} catch (Throwable t) {
System.err.println("GLDrawableFactory.shutdownImpl: Catched "+t.getClass().getName()+" during factory shutdown #"+(i+1)+"/"+gldfCount+" "+gldf.getClass().getName());
if( DEBUG ) {
@@ -235,6 +235,9 @@ public abstract class GLDrawableFactory {
eglFactory = null;
}
GLContext.shutdown();
+ if( DEBUG ) {
+ System.err.println("GLDrawableFactory.shutdownAll.X on thread "+getThreadName());
+ }
}
protected GLDrawableFactory() {
@@ -251,7 +254,7 @@ public abstract class GLDrawableFactory {
protected void enterThreadCriticalZone() {};
protected void leaveThreadCriticalZone() {};
- protected abstract void destroy();
+ protected abstract void shutdownImpl();
public abstract void resetDisplayGamma();
@@ -490,6 +493,9 @@ public abstract class GLDrawableFactory {
* If neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated.
* </p>
+ * <p>
+ * The resulting {@link GLOffscreenAutoDrawable} has it's own independent device instance using <code>device</code> details.
+ * </p>
*
* @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param caps the requested GLCapabilties
@@ -540,6 +546,9 @@ public abstract class GLDrawableFactory {
* If neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated.
* </p>
+ * <p>
+ * The resulting {@link GLOffscreenAutoDrawable} has it's own independent device instance using <code>device</code> details.
+ * </p>
*
* @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param caps the requested GLCapabilties
@@ -604,6 +613,9 @@ public abstract class GLDrawableFactory {
* If neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap drawable is created, which is unlikely to be hardware accelerated.
* </p>
+ * <p>
+ * The resulting {@link GLDrawable} has it's own independent device instance using <code>device</code> details.
+ * </p>
*
* @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param caps the requested GLCapabilties
@@ -657,6 +669,10 @@ public abstract class GLDrawableFactory {
* you will be able to implement a new native windowing system binding almost on-the-fly,
* see {@link com.jogamp.opengl.swt.GLCanvas}.
* </p>
+ * <p>
+ * The resulting {@link GLOffscreenAutoDrawable} has it's own independent device instance using <code>device</code> details
+ * which may be blocking depending on platform and windowing-toolkit requirements.
+ * </p>
*
* @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
* Caller has to ensure it is compatible w/ the given <code>windowHandle</code>
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index c049711..64c8a62 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -278,7 +278,7 @@ public class GLProfile {
if(useIndent) {
doIndent(sb, indent, indentCount).append("Natives");
indentCount++;
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4bc).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4bc+" ").append(indent);
} else {
sb.append("Natives["+GL4bc+" ");
}
@@ -291,7 +291,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4+" ").append(indent);
} else {
sb.append(", "+GL4+" ");
}
@@ -304,7 +304,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES3).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES3+" ").append(indent);
} else {
sb.append(", "+GLES3+" ");
}
@@ -317,7 +317,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL3bc).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL3bc+" ").append(indent);
} else {
sb.append(", "+GL3bc+" ");
}
@@ -330,7 +330,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL3).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL3+" ").append(indent);
} else {
sb.append(", "+GL3+" ");
}
@@ -343,7 +343,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2+" ").append(indent);
} else {
sb.append(", "+GL2+" ");
}
@@ -356,7 +356,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES2).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES2+" ").append(indent);
} else {
sb.append(", "+GLES2+" ");
}
@@ -369,7 +369,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES1).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES1+" ").append(indent);
} else {
sb.append(", "+GLES1+" ");
}
@@ -391,7 +391,7 @@ public class GLProfile {
}
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4ES3).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4ES3+" ").append(indent);
} else {
sb.append(", "+GL4ES3+" ");
}
@@ -399,7 +399,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2GL3).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2GL3+" ").append(indent);
} else {
sb.append(", "+GL2GL3+" ");
}
@@ -407,7 +407,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2ES2).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2ES2+" ").append(indent);
} else {
sb.append(", "+GL2ES2+" ");
}
@@ -415,7 +415,7 @@ public class GLProfile {
allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2ES1).append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2ES1+" ").append(indent);
} else {
sb.append(", "+GL2ES1+" ");
}
@@ -438,7 +438,7 @@ public class GLProfile {
if(useIndent) {
doIndent(sb.append(Platform.getNewline()), indent, indentCount);
}
- sb.append(entry.getKey()+(useIndent?"\t":" ")+entry.getValue());
+ sb.append(entry.getKey()+(useIndent?" \t":" ")+entry.getValue());
if(!useIndent) {
sb.append(", ");
}
@@ -1208,17 +1208,17 @@ public class GLProfile {
/** Indicates whether this profile uses the native OpenGL ES2 implementations. */
public final boolean usesNativeGLES2() {
- return GLES3 == getImplName() || GLES2 == getImplName();
+ return GLES2 == getImplName();
}
- /** Indicates whether this profile uses the native OpenGL ES2 implementations. */
+ /** Indicates whether this profile uses the native OpenGL ES3 implementations. */
public final boolean usesNativeGLES3() {
return GLES3 == getImplName();
}
/** Indicates whether this profile uses either of the native OpenGL ES implementations. */
public final boolean usesNativeGLES() {
- return usesNativeGLES2() || usesNativeGLES1();
+ return usesNativeGLES3() || usesNativeGLES2() || usesNativeGLES1();
}
/**
@@ -1945,33 +1945,40 @@ public class GLProfile {
final boolean es2HardwareRasterizer[] = new boolean[1];
final boolean gles2Available = hasGLES3Impl && ( esCtxUndef || GLContext.isGLES2Available(device, es2HardwareRasterizer) );
final boolean gles2HWAvailable = gles2Available && es2HardwareRasterizer[0] ;
+ final boolean es3HardwareRasterizer[] = new boolean[1];
+ final boolean gles3Available = hasGLES3Impl && ( esCtxUndef || GLContext.isGLES3Available(device, es3HardwareRasterizer) );
+ final boolean gles3HWAvailable = gles3Available && es3HardwareRasterizer[0] ;
if(hasGL234Impl) {
if(GLContext.isGL4Available(device, isHardwareRasterizer)) {
- if(!gles2HWAvailable || isHardwareRasterizer[0]) {
+ if( (!gles3HWAvailable && !gles2HWAvailable ) || isHardwareRasterizer[0] ) {
return GL4;
}
}
if(GLContext.isGL4bcAvailable(device, isHardwareRasterizer)) {
- if(!gles2HWAvailable || isHardwareRasterizer[0]) {
+ if( (!gles3HWAvailable && !gles2HWAvailable ) || isHardwareRasterizer[0] ) {
return GL4bc;
}
}
if(GLContext.isGL3Available(device, isHardwareRasterizer)) {
- if(!gles2HWAvailable || isHardwareRasterizer[0]) {
+ if( (!gles3HWAvailable && !gles2HWAvailable ) || isHardwareRasterizer[0] ) {
return GL3;
}
}
if(GLContext.isGL3bcAvailable(device, isHardwareRasterizer)) {
- if(!gles2HWAvailable || isHardwareRasterizer[0]) {
+ if( (!gles3HWAvailable && !gles2HWAvailable ) || isHardwareRasterizer[0] ) {
return GL3bc;
}
}
if(desktopCtxUndef || GLContext.isGL2Available(device, isHardwareRasterizer)) {
- if(!gles2HWAvailable || isHardwareRasterizer[0]) {
+ if( (!gles3HWAvailable && !gles2HWAvailable ) || isHardwareRasterizer[0] ) {
return GL2;
}
}
}
+ if(gles3Available && ( !gles2HWAvailable || gles3HWAvailable ) ) {
+ isHardwareRasterizer[0] = es3HardwareRasterizer[0];
+ return GLES3;
+ }
if(gles2Available) {
isHardwareRasterizer[0] = es2HardwareRasterizer[0];
return GLES2;
diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
index 78dd693..69ee035 100644
--- a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
+++ b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
@@ -85,15 +85,16 @@ package javax.media.opengl;
* <p>
* <pre>
* Error: 'intel_do_flush_locked: No such file or directory'
- * JogAmp: <https://jogamp.org/bugzilla/show_bug.cgi?id=873>
- * freedesktop.org: <https://bugs.freedesktop.org/show_bug.cgi?id=41736#c8>
+ * JogAmp: https://jogamp.org/bugzilla/show_bug.cgi?id=873
+ * freedesktop.org: https://bugs.freedesktop.org/show_bug.cgi?id=41736#c8
* </pre>
* Shared context seems not to be supported w/ lock-free bound X11 display connections
* per OpenGL drawable/context. The error message above is thrown in this case.
* Hence the driver bug renders shared context use w/ JOGL impossible.
* </p>
- * <h7><a name="hisilicon">Hisilicon's Immersion.16</a></h7>
+ * <h7><a name="hisilicon">Hisilicon's Immersion.16 on Android</a></h7>
* <p>
+ * We failed to create a shared ES2 context on another thread.
* </p>
*/
public interface GLSharedContextSetter extends GLAutoDrawable {
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 01d6a67..0bc002f 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -583,6 +583,15 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
+ @Override
+ public void setVisible(boolean b) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Info: setVisible("+b+")");
+ Thread.dumpStack();
+ }
+ super.setVisible(b);
+ }
+
/** Overridden to track when this component is added to a container.
Subclasses which override this method must call
super.addNotify() in their addNotify() method in order to
@@ -849,7 +858,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
GLDrawableUtil.swapGLContextAndAllGLEventListener(GLCanvas.this, printGLAD);
printDrawable = printGLAD.getDelegatedDrawable();
}
- printAWTTiles.setIsGLOriented(printGLAD.isGLOriented());
+ printAWTTiles.setGLOrientation(printGLAD.isGLOriented(), printGLAD.isGLOriented());
printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
printAWTTiles.renderer.attachAutoDrawable(printGLAD);
if( DEBUG ) {
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index fdacc5b..a71b47c 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -59,7 +59,6 @@ import java.util.List;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.opengl.DefaultGLCapabilitiesChooser;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES3;
@@ -121,16 +120,17 @@ import com.jogamp.opengl.util.texture.TextureState;
using {@link GLDrawableFactory#createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) GLDrawableFactory.createOffscreenDrawable(..)}.<br/>
</p>
<p>
- In case FBO is used and GLSL is available, a fragment shader is utilized
- to flip the FBO texture vertically. This hardware-accelerated step can be disabled via system property <code>jogl.gljpanel.noglsl</code>.
- See <a href="#fboGLSLVerticalFlip">details here</a>.
+ <a name="verticalFlip">
+ In case</a> the drawable {@link #isGLOriented()} and {@link #setSkipGLOrientationVerticalFlip(boolean) vertical flip is not skipped},
+ this component performs the required vertical flip to bring the content from OpenGL's orientation into AWT's orientation.
+ See details about <a href="#fboGLSLVerticalFlip">FBO and GLSL vertical flipping</a>.
</p>
<p>
The OpenGL path is concluded by copying the rendered pixels an {@link BufferedImage} via {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer) glReadPixels(..)}
for later Java2D composition.
</p>
<p>
- In case the above mentioned GLSL vertical-flipping is not performed,
+ In case {@link #setSkipGLOrientationVerticalFlip(boolean) vertical-flip is not skipped} and <a href="#fboGLSLVerticalFlip">GLSL based vertical-flip</a> is not performed,
{@link System#arraycopy(Object, int, Object, int, int) System.arraycopy(..)} is used line by line.
This step causes more CPU load per frame and is not hardware-accelerated.
</p>
@@ -143,8 +143,12 @@ import com.jogamp.opengl.util.texture.TextureState;
* </P>
*
<a name="fboGLSLVerticalFlip"><h5>FBO / GLSL Vertical Flip</h5></a>
+ In case FBO is used and GLSL is available and {@link #setSkipGLOrientationVerticalFlip(boolean) vertical flip is not skipped}, a fragment shader is utilized
+ to flip the FBO texture vertically. This hardware-accelerated step can be disabled via system property <code>jogl.gljpanel.noglsl</code>.
+ <p>
The FBO / GLSL code path uses one texture-unit and binds the FBO texture to it's active texture-target,
see {@link #setTextureUnit(int)} and {@link #getTextureUnit()}.
+ </p>
<p>
The active and dedicated texture-unit's {@link GL#GL_TEXTURE_2D} state is preserved via {@link TextureState}.
See also {@link Texture#textureCallOrder Order of Texture Commands}.
@@ -165,6 +169,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private static final boolean DEBUG;
private static final boolean DEBUG_VIEWPORT;
private static final boolean USE_GLSL_TEXTURE_RASTERIZER;
+ private static final boolean SKIP_VERTICAL_FLIP_DEFAULT;
/** Indicates whether the Java 2D OpenGL pipeline is requested by user. */
private static final boolean java2dOGLEnabledByProp;
@@ -180,7 +185,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
DEBUG = Debug.debug("GLJPanel");
DEBUG_VIEWPORT = Debug.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true);
USE_GLSL_TEXTURE_RASTERIZER = !Debug.isPropertyDefined("jogl.gljpanel.noglsl", true);
-
+ SKIP_VERTICAL_FLIP_DEFAULT = Debug.isPropertyDefined("jogl.gljpanel.noverticalflip", true);
boolean enabled = Debug.getBooleanProperty("sun.java2d.opengl", false);
java2dOGLEnabledByProp = enabled && !Debug.isPropertyDefined("jogl.gljpanel.noogl", true);
@@ -198,6 +203,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
useJava2DGLPipeline = enabled;
java2DGLPipelineOK = enabled;
if( DEBUG ) {
+ System.err.println("GLJPanel: DEBUG_VIEWPORT "+DEBUG_VIEWPORT);
+ System.err.println("GLJPanel: USE_GLSL_TEXTURE_RASTERIZER "+USE_GLSL_TEXTURE_RASTERIZER);
+ System.err.println("GLJPanel: SKIP_VERTICAL_FLIP_DEFAULT "+SKIP_VERTICAL_FLIP_DEFAULT);
System.err.println("GLJPanel: java2dOGLEnabledByProp "+java2dOGLEnabledByProp);
System.err.println("GLJPanel: useJava2DGLPipeline "+useJava2DGLPipeline);
System.err.println("GLJPanel: java2DGLPipelineOK "+java2DGLPipelineOK);
@@ -248,6 +256,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// The backend in use
private volatile Backend backend;
+ private boolean skipGLOrientationVerticalFlip = SKIP_VERTICAL_FLIP_DEFAULT;
+
// Used by all backends either directly or indirectly to hook up callbacks
private final Updater updater = new Updater();
@@ -331,13 +341,49 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
this.glProfile = offscreenCaps.getGLProfile();
this.factory = GLDrawableFactoryImpl.getFactoryImpl(glProfile);
- this.chooser = ((chooser != null) ? chooser : new DefaultGLCapabilitiesChooser());
+ this.chooser = chooser;
if( null != shareWith ) {
helper.setSharedContext(null, shareWith);
}
this.setFocusable(true); // allow keyboard input!
}
+ /**
+ * Attempts to initialize the backend, if not initialized yet.
+ * <p>
+ * If backend is already initialized method returns <code>true</code>.
+ * </p>
+ * <p>
+ * If <code>offthread</code> is <code>true</code>, initialization will kicked off
+ * on a <i>short lived</i> arbitrary thread and method returns immediately.<br/>
+ * If platform supports such <i>arbitrary thread</i> initialization method returns
+ * <code>true</code>, otherwise <code>false</code>.
+ * </p>
+ * <p>
+ * If <code>offthread</code> is <code>false</code>, initialization be performed
+ * on the current thread and method returns after initialization.<br/>
+ * Method returns <code>true</code> if initialization was successful, otherwise <code>false</code>.
+ * <p>
+ * @param offthread
+ */
+ public final boolean initializeBackend(boolean offthread) {
+ if( offthread ) {
+ new Thread(getThreadName()+"-GLJPanel_Init") {
+ public void run() {
+ if( !isInitialized ) {
+ initializeBackendImpl();
+ }
+ } }.start();
+ return true;
+ } else {
+ if( !isInitialized ) {
+ return initializeBackendImpl();
+ } else {
+ return true;
+ }
+ }
+ }
+
@Override
public final void setSharedContext(GLContext sharedContext) throws IllegalStateException {
helper.setSharedContext(this.getContext(), sharedContext);
@@ -457,8 +503,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
return;
}
- if (backend == null || !isInitialized) {
- createAndInitializeBackend();
+ if( !isInitialized ) {
+ initializeBackendImpl();
}
if (!isInitialized || printActive) {
@@ -476,13 +522,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
if( isVisible() ) {
- updater.setGraphics(g);
- backend.doPaintComponent(g);
+ updater.setGraphics(g);
+ backend.doPaintComponent(g);
}
}
}
-
/** Overridden to track when this component is added to a container.
Subclasses which override this method must call
super.addNotify() in their addNotify() method in order to
@@ -525,7 +570,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
super.reshape(x, y, width, height);
if( DEBUG ) {
- System.err.println(getThreadName()+": GLJPanel.reshape resize"+(printActive?"WithinPrint":"")+" [ panel "+
+ System.err.println(getThreadName()+": GLJPanel.reshape.0 "+this.getName()+" resize"+(printActive?"WithinPrint":"")+" [ this "+getWidth()+"x"+getHeight()+", panel "+
panelWidth+"x"+panelHeight +
", reshape: " +reshapeWidth+"x"+reshapeHeight +
"] -> "+(printActive?"skipped":"") + width+"x"+height);
@@ -553,8 +598,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private final Runnable setupPrintOnEDT = new Runnable() {
@Override
public void run() {
- if (backend == null || !isInitialized) {
- createAndInitializeBackend();
+ if( !isInitialized ) {
+ initializeBackendImpl();
}
if (!isInitialized) {
if(DEBUG) {
@@ -604,7 +649,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
GLDrawableUtil.swapGLContextAndAllGLEventListener(GLJPanel.this, printGLAD);
printDrawable = printGLAD.getDelegatedDrawable();
}
- printAWTTiles.setIsGLOriented(printGLAD.isGLOriented());
+ printAWTTiles.setGLOrientation( !GLJPanel.this.skipGLOrientationVerticalFlip && printGLAD.isGLOriented(), printGLAD.isGLOriented() );
printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
printAWTTiles.renderer.attachAutoDrawable(printGLAD);
if( DEBUG ) {
@@ -937,6 +982,15 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
return oglPipelineUsable();
}
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Method returns a valid value only <i>after</i>
+ * the backend has been initialized, either {@link #initializeBackend(boolean) eagerly}
+ * or manually via the first display call.<br/>
+ * Method always returns a valid value when called from within a {@link GLEventListener}.
+ * </p>
+ */
@Override
public boolean isGLOriented() {
final Backend b = backend;
@@ -946,6 +1000,25 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
return b.getDrawable().isGLOriented();
}
+ /**
+ * Set skipping {@link #isGLOriented()} based vertical flip,
+ * which usually is required by the offscreen backend,
+ * see details about <a href="#verticalFlip">vertical flip</a>
+ * and <a href="#fboGLSLVerticalFlip">FBO / GLSL vertical flip</a>.
+ * <p>
+ * If set to <code>true</code>, user needs to flip the OpenGL rendered scene
+ * <i>if {@link #isGLOriented()} == true</i>, e.g. via the PMV matrix.<br/>
+ * See constraints of {@link #isGLOriented()}.
+ * </p>
+ */
+ public final void setSkipGLOrientationVerticalFlip(boolean v) {
+ skipGLOrientationVerticalFlip = v;
+ }
+ /** See {@link #setSkipGLOrientationVerticalFlip(boolean)}. */
+ public final boolean getSkipGLOrientationVerticalFlip() {
+ return skipGLOrientationVerticalFlip;
+ }
+
@Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
final Backend b = backend;
@@ -1021,35 +1094,43 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// Internals only below this point
//
- private void createAndInitializeBackend() {
- if ( 0 >= panelWidth || 0 >= panelHeight ) {
- // See whether we have a non-zero size yet and can go ahead with
- // initialization
- if (0 >= reshapeWidth || 0 >= reshapeHeight ) {
- return;
- }
+ private final Object initSync = new Object();
+ private boolean initializeBackendImpl() {
+ synchronized(initSync) {
+ if( !isInitialized ) {
+ if ( 0 >= panelWidth || 0 >= panelHeight ) {
+ // See whether we have a non-zero size yet and can go ahead with
+ // initialization
+ if (0 >= reshapeWidth || 0 >= reshapeHeight ) {
+ return false;
+ }
- if (DEBUG) {
- System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend: " +panelWidth+"x"+panelHeight + " -> " + reshapeWidth+"x"+reshapeHeight);
- }
- // Pull down reshapeWidth and reshapeHeight into panelWidth and
- // panelHeight eagerly in order to complete initialization, and
- // force a reshape later
- panelWidth = reshapeWidth;
- panelHeight = reshapeHeight;
- }
+ if (DEBUG) {
+ System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend: " +panelWidth+"x"+panelHeight + " -> " + reshapeWidth+"x"+reshapeHeight);
+ }
+ // Pull down reshapeWidth and reshapeHeight into panelWidth and
+ // panelHeight eagerly in order to complete initialization, and
+ // force a reshape later
+ panelWidth = reshapeWidth;
+ panelHeight = reshapeHeight;
+ }
+
+ if ( null == backend ) {
+ if ( oglPipelineUsable() ) {
+ backend = new J2DOGLBackend();
+ } else {
+ backend = new OffscreenBackend(glProfile, customPixelBufferProvider);
+ }
+ isInitialized = false;
+ }
- if ( null == backend ) {
- if ( oglPipelineUsable() ) {
- backend = new J2DOGLBackend();
+ if (!isInitialized) {
+ backend.initialize();
+ }
+ return isInitialized;
} else {
- backend = new OffscreenBackend(glProfile, customPixelBufferProvider);
+ return true;
}
- isInitialized = false;
- }
-
- if (!isInitialized) {
- backend.initialize();
}
}
@@ -1320,10 +1401,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public boolean isUsingOwnLifecycle() { return false; }
+ public final boolean isUsingOwnLifecycle() { return false; }
@Override
- public void initialize() {
+ public final void initialize() {
if(DEBUG) {
System.err.println(getThreadName()+": OffscreenBackend: initialize()");
}
@@ -1343,7 +1424,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) {
isInitialized = true;
final GL gl = offscreenContext.getGL();
- flipVertical = offscreenDrawable.isGLOriented();
+ flipVertical = !GLJPanel.this.skipGLOrientationVerticalFlip && offscreenDrawable.isGLOriented();
final GLCapabilitiesImmutable chosenCaps = offscreenDrawable.getChosenGLCapabilities();
offscreenIsFBO = chosenCaps.isFBO();
final boolean glslCompliant = !offscreenContext.hasRendererQuirk(GLRendererQuirks.GLSLNonCompliant);
@@ -1402,7 +1483,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void destroy() {
+ public final void destroy() {
if(DEBUG) {
System.err.println(getThreadName()+": OffscreenBackend: destroy() - offscreenContext: "+(null!=offscreenContext)+" - offscreenDrawable: "+(null!=offscreenDrawable));
}
@@ -1450,7 +1531,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void setOpaque(boolean opaque) {
+ public final void setOpaque(boolean opaque) {
if ( opaque != isOpaque() && !useSingletonBuffer ) {
pixelBuffer.dispose();
pixelBuffer = null;
@@ -1459,13 +1540,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public boolean preGL(Graphics g) {
+ public final boolean preGL(Graphics g) {
// Empty in this implementation
return true;
}
@Override
- public void postGL(Graphics g, boolean isDisplay) {
+ public final void postGL(Graphics g, boolean isDisplay) {
if (isDisplay) {
final GL gl = offscreenContext.getGL();
@@ -1497,19 +1578,21 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, panelWidth, panelHeight, 1, true, 0);
if(DEBUG) {
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: pixelBufferProvider isSingletonBufferProvider "+useSingletonBuffer+", 0x"+Integer.toHexString(pixelBufferProvider.hashCode())+", "+pixelBufferProvider.getClass().getSimpleName());
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: pixelBuffer 0x"+Integer.toHexString(pixelBuffer.hashCode())+", "+pixelBuffer+", alignment "+alignment);
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: flippedVertical "+flipVertical+", glslTextureRaster "+(null!=glslTextureRaster));
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: panelSize "+panelWidth+"x"+panelHeight);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelBufferProvider isSingletonBufferProvider "+useSingletonBuffer+", 0x"+Integer.toHexString(pixelBufferProvider.hashCode())+", "+pixelBufferProvider.getClass().getSimpleName());
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelBuffer 0x"+Integer.toHexString(pixelBuffer.hashCode())+", "+pixelBuffer+", alignment "+alignment);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" flippedVertical "+flipVertical+", glslTextureRaster "+(null!=glslTextureRaster));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" panelSize "+panelWidth+"x"+panelHeight);
}
}
if( offscreenDrawable.getWidth() != panelWidth || offscreenDrawable.getHeight() != panelHeight ) {
throw new InternalError("OffscreenDrawable panelSize mismatch (reshape missed): panelSize "+panelWidth+"x"+panelHeight+" != drawable "+offscreenDrawable.getWidth()+"x"+offscreenDrawable.getHeight()+", on thread "+getThreadName());
}
- if( null == alignedImage || panelWidth != alignedImage.getWidth() || panelHeight != alignedImage.getHeight() ) {
+ if( null == alignedImage ||
+ panelWidth != alignedImage.getWidth() || panelHeight != alignedImage.getHeight() ||
+ !pixelBuffer.isDataBufferSource(alignedImage) ) {
alignedImage = pixelBuffer.getAlignedImage(panelWidth, panelHeight);
if(DEBUG) {
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: alignedImage "+alignedImage.getWidth()+"x"+alignedImage.getHeight()+", pixelBuffer "+pixelBuffer.width+"x"+pixelBuffer.height);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" new alignedImage "+alignedImage.getWidth()+"x"+alignedImage.getHeight()+", "+alignedImage+", pixelBuffer "+pixelBuffer.width+"x"+pixelBuffer.height+", "+pixelBuffer);
}
}
final IntBuffer readBackInts;
@@ -1561,7 +1644,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
viewportChange = 0 != usrViewport[0] || 0 != usrViewport[1] ||
offscreenDrawable.getWidth() != usrViewport[2] || offscreenDrawable.getHeight() != usrViewport[3];
if( DEBUG_VIEWPORT ) {
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL: Viewport: change "+viewportChange+
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL: "+GLJPanel.this.getName()+" Viewport: change "+viewportChange+
", "+usrViewport[0]+"/"+usrViewport[1]+" "+usrViewport[2]+"x"+usrViewport[3]+
" -> 0/0 "+offscreenDrawable.getWidth()+"x"+offscreenDrawable.getHeight());
}
@@ -1619,7 +1702,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public int getTextureUnit() {
+ public final int getTextureUnit() {
if(null != glslTextureRaster && null != offscreenDrawable) { // implies flippedVertical
return ((GLFBODrawable)offscreenDrawable).getTextureUnit();
}
@@ -1627,7 +1710,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void doPaintComponent(Graphics g) {
+ public final void doPaintComponent(Graphics g) {
helper.invokeGL(offscreenDrawable, offscreenContext, updaterDisplayAction, updaterInitAction);
if ( null != alignedImage ) {
@@ -1637,12 +1720,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void doPlainPaint() {
+ public final void doPlainPaint() {
helper.invokeGL(offscreenDrawable, offscreenContext, updaterPlainDisplayAction, updaterInitAction);
}
@Override
- public boolean handleReshape() {
+ public final boolean handleReshape() {
GLDrawableImpl _drawable = offscreenDrawable;
{
final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, offscreenContext, panelWidth, panelHeight);
@@ -1673,27 +1756,27 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public GLContext createContext(GLContext shareWith) {
+ public final GLContext createContext(GLContext shareWith) {
return (null != offscreenDrawable) ? offscreenDrawable.createContext(shareWith) : null;
}
@Override
- public void setContext(GLContext ctx) {
+ public final void setContext(GLContext ctx) {
offscreenContext=(GLContextImpl)ctx;
}
@Override
- public GLContext getContext() {
+ public final GLContext getContext() {
return offscreenContext;
}
@Override
- public GLDrawable getDrawable() {
+ public final GLDrawable getDrawable() {
return offscreenDrawable;
}
@Override
- public GLCapabilitiesImmutable getChosenGLCapabilities() {
+ public final GLCapabilitiesImmutable getChosenGLCapabilities() {
if (offscreenDrawable == null) {
return null;
}
@@ -1701,7 +1784,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public GLProfile getGLProfile() {
+ public final GLProfile getGLProfile() {
if (offscreenDrawable == null) {
return null;
}
@@ -1759,10 +1842,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private GraphicsConfiguration workaroundConfig;
@Override
- public boolean isUsingOwnLifecycle() { return true; }
+ public final boolean isUsingOwnLifecycle() { return true; }
@Override
- public void initialize() {
+ public final void initialize() {
if(DEBUG) {
System.err.println(getThreadName()+": J2DOGL: initialize()");
}
@@ -1771,7 +1854,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void destroy() {
+ public final void destroy() {
Java2D.invokeWithOGLContextCurrent(null, new Runnable() {
@Override
public void run() {
@@ -1792,12 +1875,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void setOpaque(boolean opaque) {
+ public final void setOpaque(boolean opaque) {
// Empty in this implementation
}
@Override
- public GLContext createContext(GLContext shareWith) {
+ public final GLContext createContext(GLContext shareWith) {
if(null != shareWith) {
throw new GLException("J2DOGLBackend cannot create context w/ additional shared context, since it already needs to share the context w/ J2D.");
}
@@ -1805,44 +1888,44 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void setContext(GLContext ctx) {
+ public final void setContext(GLContext ctx) {
joglContext=ctx;
}
@Override
- public GLContext getContext() {
+ public final GLContext getContext() {
return joglContext;
}
@Override
- public GLDrawable getDrawable() {
+ public final GLDrawable getDrawable() {
return joglDrawable;
}
@Override
- public int getTextureUnit() { return -1; }
+ public final int getTextureUnit() { return -1; }
@Override
- public GLCapabilitiesImmutable getChosenGLCapabilities() {
+ public final GLCapabilitiesImmutable getChosenGLCapabilities() {
// FIXME: should do better than this; is it possible to using only platform-independent code?
return new GLCapabilities(null);
}
@Override
- public GLProfile getGLProfile() {
+ public final GLProfile getGLProfile() {
// FIXME: should do better than this; is it possible to using only platform-independent code?
return GLProfile.getDefault(GLProfile.getDefaultDevice());
}
@Override
- public boolean handleReshape() {
+ public final boolean handleReshape() {
// Empty in this implementation
return true;
}
@Override
- public boolean preGL(Graphics g) {
- GL2 gl = joglContext.getGL().getGL2();
+ public final boolean preGL(Graphics g) {
+ final GL2 gl = joglContext.getGL().getGL2();
// Set up needed state in JOGL context from Java2D context
gl.glEnable(GL2.GL_SCISSOR_TEST);
Rectangle r = Java2D.getOGLScissorBox(g);
@@ -1978,7 +2061,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void postGL(Graphics g, boolean isDisplay) {
+ public final void postGL(Graphics g, boolean isDisplay) {
// Cause OpenGL pipeline to flush its results because
// otherwise it's possible we will buffer up multiple frames'
// rendering results, resulting in apparent mouse lag
@@ -1995,7 +2078,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void doPaintComponent(final Graphics g) {
+ public final void doPaintComponent(final Graphics g) {
// This is a workaround for an issue in the Java 2D / JOGL
// bridge (reported by an end user as JOGL Issue 274) where Java
// 2D can occasionally leave its internal OpenGL context current
@@ -2144,11 +2227,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void doPlainPaint() {
+ public final void doPlainPaint() {
helper.invokeGL(joglDrawable, joglContext, updaterPlainDisplayAction, updaterInitAction);
}
- private void captureJ2DState(GL gl, Graphics g) {
+ private final void captureJ2DState(GL gl, Graphics g) {
gl.glGetIntegerv(GL2.GL_DRAW_BUFFER, drawBuffer, 0);
gl.glGetIntegerv(GL2.GL_READ_BUFFER, readBuffer, 0);
if (Java2D.isFBOEnabled() &&
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index 012b1d1..31ad974 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -36,6 +36,7 @@ import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
+import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
@@ -57,8 +58,8 @@ public class RegionRendererImpl01 extends RegionRenderer {
rsVp.defaultShaderCustomization(gl, true, true);
// rsFp.defaultShaderCustomization(gl, true, true);
int pos = rsFp.addGLSLVersion(gl);
- if( gl.isGLES2() ) {
- pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable);
+ if( gl.isGLES() ) {
+ pos = rsFp.insertShaderSource(0, pos, ShaderCode.createExtensionDirective(GLExtensions.OES_standard_derivatives, ShaderCode.ENABLE));
}
final String rsFpDefPrecision = getFragmentShaderPrecision(gl);
if( null != rsFpDefPrecision ) {
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
index 60758b9..4ec4d1d 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
@@ -36,6 +36,7 @@ import jogamp.graph.curve.text.GlyphString;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.curve.opengl.TextRenderer;
import com.jogamp.graph.font.Font;
+import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
@@ -56,8 +57,8 @@ public class TextRendererImpl01 extends TextRenderer {
rsVp.defaultShaderCustomization(gl, true, true);
// rsFp.defaultShaderCustomization(gl, true, true);
int pos = rsFp.addGLSLVersion(gl);
- if( gl.isGLES2() ) {
- pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable);
+ if( gl.isGLES() ) {
+ pos = rsFp.insertShaderSource(0, pos, ShaderCode.createExtensionDirective(GLExtensions.OES_standard_derivatives, ShaderCode.ENABLE));
}
final String rsFpDefPrecision = getFragmentShaderPrecision(gl);
if( null != rsFpDefPrecision ) {
diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
index 8d3d207..fd59ecf 100644
--- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
@@ -40,11 +40,14 @@
package jogamp.opengl;
-import javax.media.opengl.*;
+import java.util.HashMap;
+import java.util.StringTokenizer;
-import com.jogamp.common.util.VersionNumber;
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2GL3;
+import javax.media.opengl.GLContext;
-import java.util.*;
+import com.jogamp.common.util.VersionNumber;
/**
* A utility object intended to be used by implementations to act as a cache
@@ -80,7 +83,7 @@ final class ExtensionAvailabilityCache {
}
final boolean isInitialized() {
- return initialized && !availableExtensionCache.isEmpty() ;
+ return initialized;
}
final int getTotalExtensionCount() {
@@ -90,7 +93,7 @@ final class ExtensionAvailabilityCache {
final boolean isExtensionAvailable(String glExtensionName) {
validateInitialization();
- return availableExtensionCache.contains(glExtensionName);
+ return null != availableExtensionCache.get(glExtensionName);
}
final int getPlatformExtensionCount() {
@@ -151,7 +154,6 @@ final class ExtensionAvailabilityCache {
", use "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
}
- HashSet<String> glExtensionSet = new HashSet<String>(gl.isGLES() ? 50 : 320); // far less gl extension expected on mobile
if(useGetStringi) {
GL2GL3 gl2gl3 = gl.getGL2GL3();
final int count;
@@ -162,57 +164,63 @@ final class ExtensionAvailabilityCache {
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
- if(i > 0) {
- sb.append(" ");
- }
final String ext = gl2gl3.glGetStringi(GL.GL_EXTENSIONS, i);
- glExtensionSet.add(ext);
- sb.append(ext);
+ if( null == availableExtensionCache.put(ext, ext) ) {
+ // new one
+ if( 0 < i ) {
+ sb.append(" ");
+ }
+ sb.append(ext);
+ }
}
if(0==count || sb.length()==0) {
// fall back ..
useGetStringi=false;
} else {
glExtensions = sb.toString();
+ glExtensionCount = count;
}
}
if(!useGetStringi) {
glExtensions = gl.glGetString(GL.GL_EXTENSIONS);
if(null != glExtensions) {
- StringTokenizer tok = new StringTokenizer(glExtensions);
+ final StringTokenizer tok = new StringTokenizer(glExtensions);
+ int count = 0;
while (tok.hasMoreTokens()) {
- glExtensionSet.add(tok.nextToken().trim());
+ final String ext = tok.nextToken().trim();
+ if( null == availableExtensionCache.put(ext, ext) ) {
+ count++;
+ }
}
+ glExtensionCount = count;
}
}
- glExtensionCount = glExtensionSet.size();
if (DEBUG) {
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL_EXTENSIONS: "+glExtensionCount+
", used "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
}
// Platform Extensions
- HashSet<String> glXExtensionSet = new HashSet<String>(50);
{
// unify platform extension .. might have duplicates
- StringTokenizer tok = new StringTokenizer(context.getPlatformExtensionsStringImpl().toString());
- while (tok.hasMoreTokens()) {
- glXExtensionSet.add(tok.nextToken().trim());
- }
final StringBuilder sb = new StringBuilder();
- for(Iterator<String> iter = glXExtensionSet.iterator(); iter.hasNext(); ) {
- sb.append(iter.next());
- if(iter.hasNext()) {
- sb.append(" ");
+ final StringTokenizer tok = new StringTokenizer(context.getPlatformExtensionsStringImpl().toString());
+ int count = 0;
+ while (tok.hasMoreTokens()) {
+ final String ext = tok.nextToken().trim();
+ if( null == availableExtensionCache.put(ext, ext) ) {
+ // new one
+ if( 0 < count ) {
+ sb.append(" ");
+ }
+ sb.append(ext);
+ count++;
}
}
glXExtensions = sb.toString();
- glXExtensionCount = glXExtensionSet.size();
+ glXExtensionCount = count;
}
- availableExtensionCache.addAll(glExtensionSet);
- availableExtensionCache.addAll(glXExtensionSet);
-
if (DEBUG) {
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GLX_EXTENSIONS: "+glXExtensionCount);
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL vendor: " + gl.glGetString(GL.GL_VENDOR));
@@ -225,7 +233,7 @@ final class ExtensionAvailabilityCache {
int minor[] = new int[] { version.getMinor() };
do{
final String GL_XX_VERSION = ( context.isGLES() ? "GL_ES_VERSION_" : "GL_VERSION_" ) + major[0] + "_" + minor[0];
- availableExtensionCache.add(GL_XX_VERSION);
+ availableExtensionCache.put(GL_XX_VERSION, GL_XX_VERSION);
if (DEBUG) {
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: Added "+GL_XX_VERSION+" to known extensions");
}
@@ -233,7 +241,7 @@ final class ExtensionAvailabilityCache {
// put a dummy var in here so that the cache is no longer empty even if
// no extensions are in the GL_EXTENSIONS string
- availableExtensionCache.add("<INTERNAL_DUMMY_PLACEHOLDER>");
+ availableExtensionCache.put("<INTERNAL_DUMMY_PLACEHOLDER>", "<INTERNAL_DUMMY_PLACEHOLDER>");
initialized = true;
}
@@ -247,7 +255,7 @@ final class ExtensionAvailabilityCache {
private int glExtensionCount = 0;
private String glXExtensions = null;
private int glXExtensionCount = 0;
- private final HashSet<String> availableExtensionCache = new HashSet<String>(50);
+ private final HashMap<String, String> availableExtensionCache = new HashMap<String, String>(100);
static String getThreadName() { return Thread.currentThread().getName(); }
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 3f6eb01..8885c32 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -648,16 +648,19 @@ public abstract class GLContextImpl extends GLContext {
}
final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getCreatedShare(this);
+ final long shareWithHandle;
if (null != shareWith) {
shareWith.getDrawableImpl().lockSurface();
- // FIXME:
- // Contemplate whether we shall 'fail' creating this context
- // if 0==shareWith.getHandle(), since at this point
- // both context are locked and current values are available.
+ shareWithHandle = shareWith.getHandle();
+ if (0 == shareWithHandle) {
+ throw new GLException("GLContextShareSet returned an invalid OpenGL context: "+this);
+ }
+ } else {
+ shareWithHandle = 0;
}
final boolean created;
try {
- created = createImpl(shareWith); // may throws exception if fails!
+ created = createImpl(shareWithHandle); // may throws exception if fails
if( created && hasNoDefaultVAO() ) {
final int[] tmp = new int[1];
final GL3ES3 gl3es3 = gl.getRootGL().getGL3ES3();
@@ -748,13 +751,13 @@ public abstract class GLContextImpl extends GLContext {
* @return the valid and current context if successful, or null
* @throws GLException
*/
- protected abstract boolean createImpl(GLContextImpl sharedWith) throws GLException ;
+ protected abstract boolean createImpl(long sharedWithHandle) throws GLException ;
/**
* Platform dependent but harmonized implementation of the <code>ARB_create_context</code>
* mechanism to create a context.<br>
*
- * This method is called from {@link #createContextARB}, {@link #createImpl(GLContextImpl)} .. {@link #makeCurrent()} .<br>
+ * This method is called from {@link #createContextARB}, {@link #createImpl(long)} .. {@link #makeCurrent()} .<br>
*
* The implementation shall verify this context with a
* <code>MakeContextCurrent</code> call.<br>
@@ -1302,11 +1305,8 @@ public abstract class GLContextImpl extends GLContext {
* <p>
* If the GL query fails, major will be zero.
* </p>
- * <p>
- * Note: Non ARB ctx is limited to GL 3.0.
- * </p>
*/
- private final boolean getGLIntVersion(int[] glIntMajor, int[] glIntMinor, int ctp) {
+ private final boolean getGLIntVersion(int[] glIntMajor, int[] glIntMinor) {
glIntMajor[0] = 0; // clear
final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper();
final long _glGetIntegerv = glDynLookupHelper.dynamicLookupFunction("glGetIntegerv");
@@ -1378,6 +1378,7 @@ public abstract class GLContextImpl extends GLContext {
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
final int reqCtxProfileBits = ctxProfileBits;
final VersionNumber reqGLVersion = new VersionNumber(major, minor, 0);
+ final VersionNumber hasGLVersionByString;
{
final boolean initGLRendererAndGLVersionStringsOK = initGLRendererAndGLVersionStrings();
if( !initGLRendererAndGLVersionStringsOK ) {
@@ -1392,8 +1393,13 @@ public abstract class GLContextImpl extends GLContext {
// unusable GL context - non query mode - hard fail!
throw new GLException(errMsg);
}
- } else if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Given "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion));
+ } else {
+ hasGLVersionByString = getGLVersionNumber(ctxProfileBits, glVersion);
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Given "+adevice+
+ " - "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion)+
+ ", Number(Str) "+hasGLVersionByString);
+ }
}
}
@@ -1405,14 +1411,15 @@ public abstract class GLContextImpl extends GLContext {
if (DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Pre version verification - expected "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+", strictMatch "+strictMatch+", glVersionsMapping " +withinGLVersionsMapping);
}
- boolean versionValidated = false;
- boolean versionGL3IntFailed = false;
+
+ final boolean versionGL3IntOK;
{
- // Validate the requested version w/ the GL-version from an integer query.
+ // Validate the requested version w/ the GL-version from an integer query,
+ // as supported by GL [ES] >= 3.0 implementation.
final VersionNumber hasGLVersionByInt;
{
final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 };
- final boolean getGLIntVersionOK = getGLIntVersion(glIntMajor, glIntMinor, ctxProfileBits);
+ final boolean getGLIntVersionOK = getGLIntVersion(glIntMajor, glIntMinor);
if( !getGLIntVersionOK ) {
final String errMsg = "Fetching GL Integer Version failed. "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null);
if( strictMatch ) {
@@ -1429,11 +1436,16 @@ public abstract class GLContextImpl extends GLContext {
hasGLVersionByInt = new VersionNumber(glIntMajor[0], glIntMinor[0], 0);
}
if (DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Version verification (Int): "+glVersion+", "+hasGLVersionByInt);
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Version verification (Int): String "+glVersion+", Number(Int) "+hasGLVersionByInt);
}
- // Only validate if a valid int version was fetched, otherwise cont. w/ version-string method -> 3.0 > Version || Version > MAX!
- if ( GLContext.isValidGLVersion(ctxProfileBits, hasGLVersionByInt.getMajor(), hasGLVersionByInt.getMinor()) ) {
+ // Only validate integer based version if:
+ // - ctx >= 3.0 is requested _or_ string-version >= 3.0
+ // - _and_ a valid int version was fetched,
+ // otherwise cont. w/ version-string method -> 3.0 > Version || Version > MAX!
+ //
+ if ( ( major >= 3 || hasGLVersionByString.compareTo(Version300) >= 0 ) &&
+ GLContext.isValidGLVersion(ctxProfileBits, hasGLVersionByInt.getMajor(), hasGLVersionByInt.getMinor()) ) {
// Strict Match (GLVersionMapping):
// Relaxed match for versions ( !isES && major < 3 ) requests, last resort!
// Otherwise:
@@ -1452,16 +1464,19 @@ public abstract class GLContextImpl extends GLContext {
// Use returned GL version!
major = hasGLVersionByInt.getMajor();
minor = hasGLVersionByInt.getMinor();
- versionValidated = true;
+ versionGL3IntOK = true;
} else {
- versionGL3IntFailed = true;
+ versionGL3IntOK = false;
}
}
- if( !versionValidated ) {
+ final boolean versionValidated;
+
+ if( versionGL3IntOK ) {
+ versionValidated = true;
+ } else {
// Validate the requested version w/ the GL-version from the version string.
- final VersionNumber hasGLVersionByString = getGLVersionNumber(ctxProfileBits, glVersion);
if (DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Version verification (String): "+glVersion+", "+hasGLVersionByString);
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Version verification (String): String "+glVersion+", Number(Str) "+hasGLVersionByString);
}
// Only validate if a valid string version was fetched -> MIN > Version || Version > MAX!
@@ -1481,7 +1496,7 @@ public abstract class GLContextImpl extends GLContext {
}
return false;
}
- if( strictMatch && versionGL3IntFailed && major >= 3 ) {
+ if( strictMatch && !versionGL3IntOK && major >= 3 ) {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL3/ES3 version Int failed, String: "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+hasGLVersionByString);
}
@@ -1491,6 +1506,8 @@ public abstract class GLContextImpl extends GLContext {
major = hasGLVersionByString.getMajor();
minor = hasGLVersionByString.getMinor();
versionValidated = true;
+ } else {
+ versionValidated = false;
}
}
if( strictMatch && !versionValidated ) {
@@ -1503,7 +1520,7 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Post version verification req "+
GLContext.getGLVersion(reqGLVersion.getMajor(), reqGLVersion.getMinor(), reqCtxProfileBits, null)+" -> has "+
GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
- ", strictMatch "+strictMatch+", versionValidated "+versionValidated+", versionGL3IntFailed "+versionGL3IntFailed);
+ ", strictMatch "+strictMatch+", versionValidated "+versionValidated+", versionGL3IntOK "+versionGL3IntOK);
}
if( major < 2 ) { // there is no ES2/3-compat for a profile w/ major < 2
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index cadf40f..c914b5e 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -270,16 +270,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(capsRequested);
- GLDrawableImpl drawable = null;
- device.lock();
- try {
- drawable = createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
- new UpstreamSurfaceHookMutableSize(width, height) ) );
- if(null != drawable) {
- drawable.setRealized(true);
- }
- } finally {
- device.unlock();
+ final GLDrawableImpl drawable = createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
+ new UpstreamSurfaceHookMutableSize(width, height) ) );
+ if(null != drawable) {
+ drawable.setRealized(true);
}
return new GLPbufferImpl( drawable, (GLContextImpl) drawable.createContext(shareWith) );
@@ -350,19 +344,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(capsRequested, this, device);
- device.lock();
- try {
- if( capsChosen.isFBO() ) {
- // Use minimum GLCapabilities for the dummy surface w/ same profile
- final ProxySurface dummySurface = createDummySurfaceImpl(device, true, new GLCapabilities(capsChosen.getGLProfile()), capsRequested, null, width, height);
- final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface);
- return new GLFBODrawableImpl.ResizeableImpl(this, dummyDrawable, dummySurface, capsChosen, 0);
- }
- return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
- new UpstreamSurfaceHookMutableSize(width, height) ) );
- } finally {
- device.unlock();
+ if( capsChosen.isFBO() ) {
+ // Use minimum GLCapabilities for the dummy surface w/ same profile
+ final ProxySurface dummySurface = createDummySurfaceImpl(device, true, new GLCapabilities(capsChosen.getGLProfile()), capsRequested, null, width, height);
+ final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface);
+ return new GLFBODrawableImpl.ResizeableImpl(this, dummyDrawable, dummySurface, capsChosen, 0);
}
+ return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
+ new UpstreamSurfaceHookMutableSize(width, height) ) );
}
@Override
@@ -371,12 +360,16 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
if(null == device) {
throw new GLException("No shared device for requested: "+deviceReq+", createNewDevice "+createNewDevice);
}
- device.lock();
+ if( !createNewDevice ) {
+ device.lock();
+ }
try {
final ProxySurface dummySurface = createDummySurfaceImpl(device, createNewDevice, capsRequested, capsRequested, chooser, 64, 64);
return createOnscreenDrawableImpl(dummySurface);
} finally {
- device.unlock();
+ if( !createNewDevice ) {
+ device.unlock();
+ }
}
}
@@ -398,7 +391,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* Lifecycle (destruction) of the TBD surface handle shall be handled by the caller.
* </p>
* @param device a valid platform dependent target device.
- * @param createNewDevice if <code>true</code> a new device instance is created using <code>device</code> details,
+ * @param createNewDevice if <code>true</code> a new independent device instance is created using <code>device</code> details,
* otherwise <code>device</code> instance is used as-is.
* @param capsChosen
* @param capsRequested
@@ -418,6 +411,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} to query information.
* It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer.
* </p>
+ * <p>
+ * Creates a new independent device instance using <code>deviceReq</code> details.
+ * </p>
* @param deviceReq which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param requestedCaps
* @param chooser the custom chooser, may be null for default
@@ -434,12 +430,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
if(null == device) {
throw new GLException("No shared device for requested: "+deviceReq);
}
- device.lock();
- try {
- return createDummySurfaceImpl(device, true, requestedCaps, requestedCaps, chooser, width, height);
- } finally {
- device.unlock();
- }
+ return createDummySurfaceImpl(device, true, requestedCaps, requestedCaps, chooser, width, height);
}
/**
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
index ff07b04..1c1d235 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
@@ -74,7 +74,10 @@ public class AWTTilePainter {
public final int customTileWidth, customTileHeight, customNumSamples;
public final boolean verbose;
+ /** Default for OpenGL: True */
public boolean flipVertical;
+ /** Default for OpenGL: True */
+ public boolean originBottomLeft;
private AWTGLPixelBuffer tBuffer = null;
private BufferedImage vFlipImage = null;
private Graphics2D g2d = null;
@@ -148,10 +151,18 @@ public class AWTTilePainter {
}
@Override
- public String toString() { return renderer.toString(); }
+ public String toString() {
+ return "AWTTilePainter[flipVertical "+flipVertical+", startFromBottom "+originBottomLeft+", "+
+ renderer.toString()+"]";
+ }
- public void setIsGLOriented(boolean v) {
- flipVertical = v;
+ /**
+ * @param flipVertical if <code>true</code>, the image will be flipped vertically (Default for OpenGL).
+ * @param originBottomLeft if <code>true</code>, the image's origin is on the bottom left (Default for OpenGL).
+ */
+ public void setGLOrientation(boolean flipVertical, boolean originBottomLeft) {
+ this.flipVertical = flipVertical;
+ this.originBottomLeft = originBottomLeft;
}
private static Rectangle2D getClipBounds2D(Graphics2D g) {
@@ -307,7 +318,7 @@ public class AWTTilePainter {
final int tHeight = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_HEIGHT);
final int tY = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS);
final int tYOff = renderer.getParam(TileRenderer.TR_TILE_Y_OFFSET);
- final int imgYOff = flipVertical ? 0 : renderer.getParam(TileRenderer.TR_TILE_HEIGHT) - tHeight; // imgYOff will be cut-off via sub-image
+ final int imgYOff = originBottomLeft ? 0 : renderer.getParam(TileRenderer.TR_TILE_HEIGHT) - tHeight; // imgYOff will be cut-off via sub-image
final int pX = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); // tileX == pX
final int pY = cis.getHeight() - ( tY - tYOff + tHeight ) + scaledYOffset;
@@ -380,7 +391,7 @@ public class AWTTilePainter {
System.err.println("XXX tile-post.X "+renderer);
System.err.println("XXX tile-post.X dst-img "+dstImage.getWidth()+"x"+dstImage.getHeight());
System.err.println("XXX tile-post.X out-img "+outImage.getWidth()+"x"+outImage.getHeight());
- System.err.println("XXX tile-post.X y-flip "+flipVertical+" -> "+pX+"/"+pY+", drawDone "+drawDone);
+ System.err.println("XXX tile-post.X y-flip "+flipVertical+", originBottomLeft "+originBottomLeft+" -> "+pX+"/"+pY+", drawDone "+drawDone);
}
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index 2eb277f..b2f06dc 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -135,13 +135,7 @@ public class EGLContext extends GLContextImpl {
@Override
protected void destroyImpl() throws GLException {
- if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle)) {
- final int eglError = EGL.eglGetError();
- if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */
- throw new GLException("Error destroying OpenGL context " + toHexString(contextHandle) +
- ": error code " + toHexString(eglError));
- }
- }
+ destroyContextARBImpl(contextHandle);
}
@Override
@@ -151,16 +145,22 @@ public class EGLContext extends GLContextImpl {
@Override
protected void destroyContextARBImpl(long _context) {
- // FIXME
+ if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), _context)) {
+ final int eglError = EGL.eglGetError();
+ if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */
+ throw new GLException("Error destroying OpenGL context " + toHexString(_context) +
+ ": error code " + toHexString(eglError));
+ }
+ }
}
@Override
- protected boolean createImpl(GLContextImpl shareWith) throws GLException {
+ protected boolean createImpl(final long shareWithHandle) throws GLException {
final EGLGraphicsConfiguration config = (EGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
final long eglDisplay = config.getScreen().getDevice().getHandle();
final GLProfile glProfile = drawable.getGLProfile();
final long eglConfig = config.getNativeConfig();
- long shareWithHandle = EGL.EGL_NO_CONTEXT;
+ // 0 == EGL.EGL_NO_CONTEXT;
if ( 0 == eglDisplay ) {
throw new GLException("Error: attempted to create an OpenGL context without a display connection");
@@ -180,19 +180,14 @@ public class EGLContext extends GLContextImpl {
}
}
- if (shareWith != null) {
- shareWithHandle = shareWith.getHandle();
- if (shareWithHandle == 0) {
- throw new GLException("GLContextShareSet returned an invalid OpenGL context");
- }
- }
+ // Cannot check extension 'EGL_KHR_create_context' before having one current!
final IntBuffer contextAttrsNIO;
final int contextVersionReq, contextVersionAttr;
{
if ( glProfile.usesNativeGLES3() ) {
contextVersionReq = 3;
- contextVersionAttr = 2;
+ contextVersionAttr = 3;
} else if ( glProfile.usesNativeGLES2() ) {
contextVersionReq = 2;
contextVersionAttr = 2;
@@ -202,6 +197,7 @@ public class EGLContext extends GLContextImpl {
} else {
throw new GLException("Error creating OpenGL context - invalid GLProfile: "+glProfile);
}
+ // EGLExt.EGL_CONTEXT_MAJOR_VERSION_KHR == EGL.EGL_CONTEXT_CLIENT_VERSION
final int[] contextAttrs = new int[] { EGL.EGL_CONTEXT_CLIENT_VERSION, contextVersionAttr, EGL.EGL_NONE };
contextAttrsNIO = Buffers.newDirectIntBuffer(contextAttrs);
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
index 3d864ad..0577124 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
@@ -34,6 +34,7 @@ import java.util.Iterator;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.NativeWindowFactory;
+import javax.media.nativewindow.ToolkitLock;
import javax.media.opengl.GLException;
import jogamp.opengl.Debug;
@@ -260,6 +261,7 @@ public class EGLDisplayUtil {
};
/**
+ * Using the default {@link ToolkitLock}, via {@link NativeWindowFactory#getDefaultToolkitLock(String, long)}.
* @param nativeDisplayID
* @param connection
* @param unitID
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
index ab28fb3..f184eda 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
@@ -166,7 +166,9 @@ public abstract class EGLDrawable extends GLDrawableImpl {
@Override
public GLDynamicLookupHelper getGLDynamicLookupHelper() {
- if (getGLProfile().usesNativeGLES2()) {
+ if (getGLProfile().usesNativeGLES3()) {
+ return getFactoryImpl().getGLDynamicLookupHelper(3);
+ } else if (getGLProfile().usesNativeGLES2()) {
return getFactoryImpl().getGLDynamicLookupHelper(2);
} else if (getGLProfile().usesNativeGLES1()) {
return getFactoryImpl().getGLDynamicLookupHelper(1);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 1a881ee..f7799f1 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -207,17 +207,19 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
@Override
- protected final void destroy() {
+ protected final void shutdownImpl() {
+ if( DEBUG ) {
+ System.err.println("EGLDrawableFactory.shutdown");
+ }
if(null != sharedMap) {
if(DEBUG) {
- System.err.println("EGLDrawableFactory.destroy() .. ");
dumpMap();
}
Collection<SharedResource> srl = sharedMap.values();
for(Iterator<SharedResource> sri = srl.iterator(); sri.hasNext(); ) {
SharedResource sr = sri.next();
if(DEBUG) {
- System.err.println("EGLDrawableFactory.destroy(): "+sr.device.toString());
+ System.err.println("EGLDrawableFactory.shutdown: "+sr.device.toString());
}
sr.device.close();
}
@@ -354,7 +356,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(caps);
final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(caps);
if( EGL.eglChooseConfig(eglDisplay.getHandle(), attrs, configs, configs.capacity(), numConfigs) && numConfigs.get(0) > 0) {
- return EGLGraphicsConfigurationFactory.eglConfigs2GLCaps(eglDisplay, caps.getGLProfile(), configs, numConfigs.get(0), winattrmask, false /* forceTransparentFlag */);
+ return EGLGraphicsConfigurationFactory.eglConfigs2GLCaps(eglDisplay, caps.getGLProfile(), configs, numConfigs.get(0), winattrmask, false /* forceTransparentFlag */, false /* onlyFirstValid */);
}
}
return new ArrayList<GLCapabilitiesImmutable>(0);
@@ -615,12 +617,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
if( null != eglES2DynamicLookupHelper ) {
madeCurrentES3 = mapAvailableEGLESConfig(adevice, 3, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2);
- if( madeCurrentES3 ) {
- // Only support highest - FIXME: Proper ES2/ES3 profile selection
- madeCurrentES2 = false;
- } else {
- madeCurrentES2 = mapAvailableEGLESConfig(adevice, 2, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2);
- }
+ madeCurrentES2 = mapAvailableEGLESConfig(adevice, 2, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2);
} else {
madeCurrentES2 = false;
madeCurrentES3 = false;
@@ -668,7 +665,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
@Override
public GLDynamicLookupHelper getGLDynamicLookupHelper(int esProfile) {
- if (2==esProfile) {
+ if ( 2==esProfile || 3==esProfile ) {
return eglES2DynamicLookupHelper;
} else if (1==esProfile) {
return eglES1DynamicLookupHelper;
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
index b61624d..e28b532 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
@@ -101,7 +101,6 @@ public class EGLGLCapabilities extends GLCapabilities {
if(null == glp) {
return true;
}
- /** FIXME: EGLExt.EGL_OPENGL_ES3_BIT_KHR OK ? */
if(0 != (renderableType & EGLExt.EGL_OPENGL_ES3_BIT_KHR) && glp.usesNativeGLES3()) {
return true;
}
@@ -118,6 +117,9 @@ public class EGLGLCapabilities extends GLCapabilities {
}
public static GLProfile getCompatible(EGLGraphicsDevice device, int renderableType) {
+ if(0 != (renderableType & EGLExt.EGL_OPENGL_ES3_BIT_KHR) && GLProfile.isAvailable(device, GLProfile.GLES3)) {
+ return GLProfile.get(device, GLProfile.GLES3);
+ }
if(0 != (renderableType & EGL.EGL_OPENGL_ES2_BIT) && GLProfile.isAvailable(device, GLProfile.GLES2)) {
return GLProfile.get(device, GLProfile.GLES2);
}
@@ -145,6 +147,9 @@ public class EGLGLCapabilities extends GLCapabilities {
if(0 != (renderableType & EGL.EGL_OPENGL_ES2_BIT)) {
if(!first) sink.append(", "); sink.append("GLES2"); first=false;
}
+ if(0 != (renderableType & EGLExt.EGL_OPENGL_ES3_BIT_KHR)) {
+ if(!first) sink.append(", "); sink.append("GLES3"); first=false;
+ }
if(0 != (renderableType & EGL.EGL_OPENVG_API)) {
if(!first) sink.append(", "); sink.append("VG"); first=false;
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
index f3592c1..0e5551b 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
@@ -58,6 +58,10 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
+ private static final String dbgCfgFailIntro = "Info: EGLConfig could not retrieve ";
+ private static final String dbgCfgFailForConfig = " for config ";
+ private static final String dbgCfgFailError = ", error ";
+
public final long getNativeConfig() {
return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfig();
}
@@ -145,7 +149,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) {
final int eglErr = EGL.eglGetError();
if(DEBUG) {
- System.err.println("Info: Couldn't retrieve EGL ConfigID for config "+toHexString(config)+", error "+toHexString(eglErr));
+ System.err.println(dbgCfgFailIntro+"EGL_CONFIG_ID"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(eglErr));
}
return false;
}
@@ -185,32 +189,57 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
public static EGLGLCapabilities EGLConfig2Capabilities(EGLGraphicsDevice device, GLProfile glp, long config,
int winattrmask, boolean forceTransparentFlag) {
final long display = device.getHandle();
- final IntBuffer val = Buffers.newDirectIntBuffer(1);
final int cfgID;
final int rType;
final int visualID;
+ final int _attributes[] = {
+ EGL.EGL_CONFIG_ID, // 0
+ EGL.EGL_RENDERABLE_TYPE,
+ EGL.EGL_NATIVE_VISUAL_ID,
+ EGL.EGL_CONFIG_CAVEAT,
+ EGL.EGL_RED_SIZE, // 4
+ EGL.EGL_GREEN_SIZE,
+ EGL.EGL_BLUE_SIZE,
+ EGL.EGL_ALPHA_SIZE, // 7
+ EGL.EGL_STENCIL_SIZE, // 8
+ EGL.EGL_DEPTH_SIZE,
+ EGL.EGL_TRANSPARENT_TYPE, // 10
+ EGL.EGL_TRANSPARENT_RED_VALUE,
+ EGL.EGL_TRANSPARENT_GREEN_VALUE,
+ EGL.EGL_TRANSPARENT_BLUE_VALUE,
+ EGL.EGL_SAMPLES, // 14
+ EGLExt.EGL_COVERAGE_BUFFERS_NV, // 15
+ EGLExt.EGL_COVERAGE_SAMPLES_NV
+ };
+ final IntBuffer attributes = Buffers.newDirectIntBuffer(_attributes);
+ final IntBuffer values = Buffers.newDirectIntBuffer(attributes.remaining());
+ EGL.eglGetConfigAttributes(display, config, attributes, values);
+
// get the configID
- if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) {
+ if( EGL.EGL_CONFIG_ID != attributes.get(0) ) {
if(DEBUG) {
// FIXME: this happens on a ATI PC Emulation ..
- System.err.println("EGL couldn't retrieve ConfigID for config "+toHexString(config)+", error "+toHexString(EGL.eglGetError()));
+ System.err.println(dbgCfgFailIntro+"ConfigID"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
}
return null;
}
- cfgID = val.get(0);
+ cfgID = values.get(0);
- if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_RENDERABLE_TYPE, val)) {
+ if( EGL.EGL_RENDERABLE_TYPE != attributes.get(1) ) {
if(DEBUG) {
- System.err.println("EGL couldn't retrieve EGL_RENDERABLE_TYPE for config "+toHexString(config)+", error "+toHexString(EGL.eglGetError()));
+ System.err.println(dbgCfgFailIntro+"EGL_RENDERABLE_TYPE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
}
return null;
}
- rType = val.get(0);
+ rType = values.get(1);
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_NATIVE_VISUAL_ID, val)) {
- visualID = val.get(0);
+ if( EGL.EGL_NATIVE_VISUAL_ID == attributes.get(2) ) {
+ visualID = values.get(2);
} else {
+ if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_NATIVE_VISUAL_ID"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ }
visualID = VisualIDHolder.VID_UNDEFINED;
}
@@ -234,64 +263,99 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
return null;
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_CAVEAT, val)) {
- if( EGL.EGL_SLOW_CONFIG == val.get(0) ) {
+ if( EGL.EGL_CONFIG_CAVEAT == attributes.get(3) ) {
+ if( EGL.EGL_SLOW_CONFIG == values.get(3) ) {
caps.setHardwareAccelerated(false);
}
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_CONFIG_CAVEAT"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_SAMPLES, val)) {
- caps.setSampleBuffers(val.get(0)>0?true:false);
- caps.setNumSamples(val.get(0));
- }
- if(!caps.getSampleBuffers()) {
- // try NV_coverage_sample extension
- if(EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_BUFFERS_NV, val)) {
- if(val.get(0)>0 &&
- EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_SAMPLES_NV, val)) {
- caps.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample);
- caps.setSampleBuffers(true);
- caps.setNumSamples(val.get(0));
- }
- }
- }
- if(forceTransparentFlag) {
+ // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples)
+ if( EGL.EGL_RED_SIZE == attributes.get(4) ) {
+ caps.setRedBits(values.get(4));
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_RED_SIZE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ }
+ if( EGL.EGL_GREEN_SIZE == attributes.get(5) ) {
+ caps.setGreenBits(values.get(5));
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_GREEN_SIZE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ }
+ if( EGL.EGL_BLUE_SIZE == attributes.get(6) ) {
+ caps.setBlueBits(values.get(6));
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_BLUE_SIZE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ }
+ if( EGL.EGL_ALPHA_SIZE == attributes.get(7) ) {
+ caps.setAlphaBits(values.get(7));
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_ALPHA_SIZE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ }
+ if( EGL.EGL_STENCIL_SIZE == attributes.get(8) ) {
+ caps.setStencilBits(values.get(8));
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_STENCIL_SIZE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ }
+ if( EGL.EGL_DEPTH_SIZE == attributes.get(9) ) {
+ caps.setDepthBits(values.get(9));
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_DEPTH_SIZE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ }
+ if( forceTransparentFlag ) {
caps.setBackgroundOpaque(false);
- } else if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_TYPE, val)) {
- caps.setBackgroundOpaque(val.get(0) != EGL.EGL_TRANSPARENT_RGB);
+ } else if( EGL.EGL_TRANSPARENT_TYPE == attributes.get(10) ) {
+ caps.setBackgroundOpaque(values.get(10) != EGL.EGL_TRANSPARENT_RGB);
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_TRANSPARENT_TYPE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
}
if(!caps.isBackgroundOpaque()) {
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_RED_VALUE, val)) {
- caps.setTransparentRedValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0));
+ if( EGL.EGL_TRANSPARENT_RED_VALUE == attributes.get(11) ) {
+ final int v = values.get(11);
+ caps.setTransparentRedValue(EGL.EGL_DONT_CARE==v?-1:v);
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_TRANSPARENT_RED_VALUE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_GREEN_VALUE, val)) {
- caps.setTransparentGreenValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0));
+ if( EGL.EGL_TRANSPARENT_GREEN_VALUE == attributes.get(12) ) {
+ final int v = values.get(12);
+ caps.setTransparentGreenValue(EGL.EGL_DONT_CARE==v?-1:v);
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_TRANSPARENT_GREEN_VALUE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val)) {
- caps.setTransparentBlueValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0));
+ if( EGL.EGL_TRANSPARENT_BLUE_VALUE == attributes.get(13) ) {
+ final int v = values.get(13);
+ caps.setTransparentBlueValue(EGL.EGL_DONT_CARE==v?-1:v);
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_TRANSPARENT_BLUE_VALUE"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
}
/** Not defined in EGL
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_ALPHA_VALUE, val)) {
- caps.setTransparentAlphaValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0));
+ if( EGL.EGL_TRANSPARENT_ALPHA_VALUE == attributes.get(??) ) {
+ final int v = values.get(??);
+ caps.setTransparentAlphaValue(EGL.EGL_DONT_CARE==v?-1:v);
+ } else if(DEBUG) {
+ System.err.println(dbgStr01+"EGL_TRANSPARENT_ALPHA_VALUE"+dbgStr02+toHexString(config)+dbgEGLCfgFailError+toHexString(EGL.eglGetError()));
} */
}
- // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples)
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_RED_SIZE, val)) {
- caps.setRedBits(val.get(0));
- }
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_GREEN_SIZE, val)) {
- caps.setGreenBits(val.get(0));
- }
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_BLUE_SIZE, val)) {
- caps.setBlueBits(val.get(0));
- }
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_ALPHA_SIZE, val)) {
- caps.setAlphaBits(val.get(0));
- }
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_STENCIL_SIZE, val)) {
- caps.setStencilBits(val.get(0));
+ if( EGL.EGL_SAMPLES == attributes.get(14) ) {
+ final int numSamples = values.get(14);
+ caps.setSampleBuffers(numSamples>0?true:false);
+ caps.setNumSamples(numSamples);
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_SAMPLES"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_DEPTH_SIZE, val)) {
- caps.setDepthBits(val.get(0));
+ if(!caps.getSampleBuffers()) {
+ // try NV_coverage_sample extension
+ if( EGLExt.EGL_COVERAGE_BUFFERS_NV == attributes.get(15) ) {
+ final boolean enabled = values.get(15) > 0;
+ if( enabled && EGLExt.EGL_COVERAGE_SAMPLES_NV == attributes.get(16) ) {
+ caps.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample);
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(values.get(16));
+ } else if(DEBUG) {
+ System.err.println(dbgCfgFailIntro+"EGL_COVERAGE_SAMPLES_NV"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ }
+ } /** else if(DEBUG) { // Not required - vendor extension - don't be verbose!
+ System.err.println(dbgCfgFailIntro+"EGL_COVERAGE_BUFFERS_NV"+dbgCfgFailForConfig+toHexString(config)+dbgCfgFailError+toHexString(EGL.eglGetError()));
+ } */
}
// Since the passed GLProfile may be null,
@@ -388,6 +452,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
attrs.put(idx++, EGL.EGL_OPENGL_ES_BIT);
} else if(caps.getGLProfile().usesNativeGLES2()) {
attrs.put(idx++, EGL.EGL_OPENGL_ES2_BIT);
+ } else if(caps.getGLProfile().usesNativeGLES3()) {
+ attrs.put(idx++, EGLExt.EGL_OPENGL_ES3_BIT_KHR);
} else {
attrs.put(idx++, EGL.EGL_OPENGL_BIT);
}
@@ -430,6 +496,6 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
}
- private GLCapabilitiesChooser chooser;
+ private final GLCapabilitiesChooser chooser;
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index 54510b5..568fede 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -42,7 +42,6 @@ import javax.media.nativewindow.GraphicsConfigurationFactory;
import javax.media.nativewindow.VisualIDHolder;
import javax.media.nativewindow.VisualIDHolder.VIDType;
import javax.media.nativewindow.NativeWindowFactory;
-
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLCapabilitiesChooser;
import javax.media.opengl.GLCapabilitiesImmutable;
@@ -208,7 +207,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
throw new GLException("Graphics configuration get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError()));
}
if (numConfigs.get(0) > 0) {
- availableCaps = eglConfigs2GLCaps(eglDevice, null, configs, numConfigs.get(0), GLGraphicsConfigurationUtil.ALL_BITS, false);
+ availableCaps = eglConfigs2GLCaps(eglDevice, null, configs, numConfigs.get(0), GLGraphicsConfigurationUtil.ALL_BITS, false /* forceTransparentFlag */, false /* onlyFirstValid */);
if( null != availableCaps && availableCaps.size() > 1) {
Collections.sort(availableCaps, EglCfgIDComparator);
}
@@ -343,13 +342,14 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if(0 == numConfigs.get(0)) {
throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: Get maxConfigs (eglGetConfigs) no configs");
}
+ final int numEGLConfigs = numConfigs.get(0);
if (DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: eglChooseConfig eglDisplay "+toHexString(eglDisplay)+
", nativeVisualID "+toHexString(nativeVisualID)+
", capsChosen "+capsChosen+", winbits "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrmask).toString()+
", fboAvail "+GLContext.isFBOAvailable(device, glp)+
", device "+device+", "+device.getUniqueID()+
- ", numConfigs "+numConfigs.get(0));
+ ", numEGLConfigs "+numEGLConfigs);
}
final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen);
@@ -358,24 +358,42 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
// 1st choice: get GLCapabilities based on users GLCapabilities
// setting recommendedIndex as preferred choice
// skipped if nativeVisualID is given
- if( VisualIDHolder.VID_UNDEFINED != nativeVisualID || !EGL.eglChooseConfig(eglDisplay, attrs, configs, configs.capacity(), numConfigs) ) {
+ final boolean hasEGLChosenCaps;
+ if( VisualIDHolder.VID_UNDEFINED == nativeVisualID ) {
+ if( !EGL.eglChooseConfig(eglDisplay, attrs, configs, configs.capacity(), numConfigs) ) {
+ if(DEBUG) {
+ System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 eglChooseConfig: false");
+ }
+ numConfigs.put(0, 0);
+ hasEGLChosenCaps = false;
+ } else {
+ hasEGLChosenCaps = numConfigs.get(0)>0;
+ }
+ } else {
if(DEBUG) {
- System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 eglChooseConfig: false");
+ System.err.println("EGLGraphicsConfiguration.eglChooseConfig: Skipped due to given visualID: "+toHexString(nativeVisualID));
}
- } else if (numConfigs.get(0) > 0) {
- availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag);
+ hasEGLChosenCaps = false;
+ }
+ final boolean useRecommendedIndex = hasEGLChosenCaps && !forceTransparentFlag && capsChosen.isBackgroundOpaque(); // only use recommended idx if not translucent
+ final boolean skipCapsChooser = null == chooser && useRecommendedIndex; // fast path: skip choosing if using recommended idx and null chooser is used
+ if( hasEGLChosenCaps ) {
+ availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag, skipCapsChooser /* onlyFirsValid */);
if(availableCaps.size() > 0) {
recommendedEGLConfig = configs.get(0);
recommendedIndex = 0;
if (DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 eglChooseConfig: recommended fbcfg " + toHexString(recommendedEGLConfig) + ", idx " + recommendedIndex);
+ System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 useRecommendedIndex "+useRecommendedIndex+", skipCapsChooser "+skipCapsChooser);
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 fbcfg caps " + availableCaps.get(recommendedIndex));
}
} else if (DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 eglChooseConfig: no caps for recommended fbcfg " + toHexString(configs.get(0)));
+ System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 useRecommendedIndex "+useRecommendedIndex+", skipCapsChooser "+skipCapsChooser);
}
} else if (DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 eglChooseConfig: no configs");
+ System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 useRecommendedIndex "+useRecommendedIndex+", skipCapsChooser "+skipCapsChooser);
}
// 2nd choice: get all GLCapabilities available, no preferred recommendedIndex available
@@ -388,7 +406,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: #2 Get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError()));
}
if (numConfigs.get(0) > 0) {
- availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag);
+ availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag, false /* onlyFirsValid */);
}
}
@@ -396,7 +414,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if(DEBUG) {
// FIXME: this happens on a ATI PC Emulation ..
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #2 Graphics configuration 1st choice and 2nd choice failed - no configs");
- availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), GLGraphicsConfigurationUtil.ALL_BITS, forceTransparentFlag);
+ availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), GLGraphicsConfigurationUtil.ALL_BITS, forceTransparentFlag, false /* onlyFirsValid */);
printCaps("AllCaps", availableCaps, System.err);
}
return null;
@@ -409,7 +427,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
}
}
- if( VisualIDHolder.VID_UNDEFINED != nativeVisualID ) {
+ if( VisualIDHolder.VID_UNDEFINED != nativeVisualID ) { // implies !hasEGLChosenCaps
List<GLCapabilitiesImmutable> removedCaps = new ArrayList<GLCapabilitiesImmutable>();
for(int i=0; i<availableCaps.size(); ) {
final GLCapabilitiesImmutable aCap = availableCaps.get(i);
@@ -437,7 +455,12 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
}
}
- final int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
+ final int chosenIndex;
+ if( skipCapsChooser && 0 <= recommendedIndex ) {
+ chosenIndex = recommendedIndex;
+ } else {
+ chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
+ }
if ( 0 > chosenIndex ) {
if (DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #2 chooseCapabilities failed");
@@ -452,12 +475,15 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
return res;
}
- static List<GLCapabilitiesImmutable> eglConfigs2GLCaps(EGLGraphicsDevice device, GLProfile glp, PointerBuffer configs, int num, int winattrmask, boolean forceTransparentFlag) {
+ static List<GLCapabilitiesImmutable> eglConfigs2GLCaps(EGLGraphicsDevice device, GLProfile glp, PointerBuffer configs, int num, int winattrmask, boolean forceTransparentFlag, boolean onlyFirstValid) {
List<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(num);
for(int i=0; i<num; i++) {
final GLCapabilitiesImmutable caps = EGLGraphicsConfiguration.EGLConfig2Capabilities(device, glp, configs.get(i), winattrmask, forceTransparentFlag);
if(null != caps) {
bucket.add(caps);
+ if(onlyFirstValid) {
+ break;
+ }
}
}
return bucket;
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
index dac058d..dac85e7 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
@@ -157,7 +157,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
} else {
final AbstractGraphicsScreen eglScreen = new DefaultGraphicsScreen(eglDevice, aConfig.getScreen().getIndex());
eglConfig = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
- capsRequested, capsRequested, null, eglScreen, aConfig.getVisualID(VIDType.NATIVE), false);
+ capsRequested, capsRequested, null, eglScreen, aConfig.getVisualID(VIDType.NATIVE), false /* forceTransparencyFlag */);
if (null == eglConfig) {
throw new GLException("Couldn't create EGLGraphicsConfiguration from "+eglScreen);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 037aaca..0d231b8 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -286,35 +286,19 @@ public class MacOSXCGLContext extends GLContextImpl
return false;
}
- protected long createImplPreset(GLContextImpl shareWith) throws GLException {
- long share = 0;
- if (shareWith != null) {
- // Change our OpenGL mode to match that of any share context before we create ourselves
- setOpenGLMode(((MacOSXCGLContext)shareWith).getOpenGLMode());
- share = shareWith.getHandle();
- if (share == 0) {
- throw new GLException("GLContextShareSet returned a NULL OpenGL context");
- }
- }
-
- MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
- GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
- GLProfile glp = capabilitiesChosen.getGLProfile();
+ @Override
+ protected boolean createImpl(final long shareWithHandle) throws GLException {
+ final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
+ final GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+ final GLProfile glp = capabilitiesChosen.getGLProfile();
if( glp.isGLES1() || glp.isGLES2() || glp.isGLES3() ||
( glp.isGL3() && !isLionOrLater ) || ( glp.isGL4() && !isMavericksOrLater ) ) {
throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp);
}
-
- if (DEBUG) {
- System.err.println("Share context is " + toHexString(share) + " for " + this);
+ if( 0 != shareWithHandle && GLBackendType.NSOPENGL != getOpenGLMode() ) {
+ throw new GLException("Context sharing only supported in mode "+GLBackendType.NSOPENGL+": "+this);
}
- return share;
- }
-
- @Override
- protected boolean createImpl(GLContextImpl shareWith) throws GLException {
- long share = createImplPreset(shareWith);
- contextHandle = createContextARB(share, true);
+ contextHandle = createContextARB(shareWithHandle, true);
return 0 != contextHandle;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
index bb36a72..448e3e2 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
@@ -84,7 +84,10 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
// GLPbuffer, a GLJPanel and a GLCanvas simultaneously) but should
// be enough to get things off the ground.
public enum GLBackendType {
- NSOPENGL(0), CGL(1);
+ /** Default OpenGL Backend */
+ NSOPENGL(0),
+ /** Alternative OpenGL Backend, only used for external context! */
+ CGL(1);
public final int id;
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 994eee8..9ce71cf 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -126,7 +126,10 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected final void destroy() {
+ protected final void shutdownImpl() {
+ if( DEBUG ) {
+ System.err.println("MacOSXCGLDrawableFactory.shutdown");
+ }
if(null != sharedMap) {
sharedMap.clear();
sharedMap = null;
@@ -151,7 +154,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
static class SharedResource implements SharedResourceRunner.Resource {
// private MacOSXCGLDrawable drawable;
// private MacOSXCGLContext context;
- private GLRendererQuirks glRendererQuirks;
+ private final GLRendererQuirks glRendererQuirks;
MacOSXGraphicsDevice device;
boolean valid;
boolean hasNPOTTextures;
@@ -211,7 +214,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return false;
}
- private HashSet<String> devicesTried = new HashSet<String>();
+ private final HashSet<String> devicesTried = new HashSet<String>();
private boolean getDeviceTried(String connection) {
synchronized (devicesTried) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
index 5d036d4..ebb0fc6 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -50,7 +50,6 @@ import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import jogamp.nativewindow.WrappedSurface;
-import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLContextShareSet;
import jogamp.opengl.macosx.cgl.MacOSXCGLDrawable.GLBackendType;
@@ -118,7 +117,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
}
@Override
- protected boolean createImpl(GLContextImpl shareWith) throws GLException {
+ protected boolean createImpl(final long shareWithHandle) throws GLException {
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
index ecb6b60..1229eb7 100644
--- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -53,22 +53,22 @@ public class ALAudioSink implements AudioSink {
private static final ALC alc;
private static final AL al;
private static final ALExt alExt;
- private static final boolean staticAvailable;
-
+ private static final boolean staticAvailable;
+
private String deviceSpecifier;
private ALCdevice device;
private boolean hasSOFTBufferSamples;
- private AudioFormat preferredAudioFormat;
+ private AudioFormat preferredAudioFormat;
private ALCcontext context;
private final RecursiveLock lock = LockFactory.createRecursiveLock();
/** Playback speed, range [0.5 - 2.0], default 1.0. */
private float playSpeed;
private float volume = 1.0f;
-
+
static class ALAudioFrame extends AudioFrame {
private final int alBuffer;
-
+
ALAudioFrame(int alBuffer) {
this.alBuffer = alBuffer;
}
@@ -76,20 +76,20 @@ public class ALAudioSink implements AudioSink {
super(pts, duration, dataSize);
this.alBuffer = alBuffer;
}
-
+
/** Get this frame's OpenAL buffer name */
public final int getALBuffer() { return alBuffer; }
-
- public String toString() {
+
+ public String toString() {
return "ALAudioFrame[pts " + pts + " ms, l " + duration + " ms, " + byteSize + " bytes, buffer "+alBuffer+"]";
}
}
-
+
// private ALAudioFrame[] alFrames = null;
private int[] alBufferNames = null;
private int frameGrowAmount = 0;
private int frameLimit = 0;
-
+
private Ringbuffer<ALAudioFrame> alFramesAvail = null;
private Ringbuffer<ALAudioFrame> alFramesPlaying = null;
private volatile int alBufferBytesQueued = 0;
@@ -102,7 +102,7 @@ public class ALAudioSink implements AudioSink {
private int alSampleType;
private int alFormat;
private boolean initialized;
-
+
private volatile boolean playRequested = false;
static {
@@ -110,7 +110,7 @@ public class ALAudioSink implements AudioSink {
AL _al = null;
ALExt _alExt = null;
try {
- _alc = ALFactory.getALC();
+ _alc = ALFactory.getALC();
_al = ALFactory.getAL();
_alExt = ALFactory.getALExt();
} catch(Throwable t) {
@@ -124,41 +124,41 @@ public class ALAudioSink implements AudioSink {
alExt = _alExt;
staticAvailable = null != alc && null != al && null != alExt;
}
-
+
public ALAudioSink() {
initialized = false;
chosenFormat = null;
-
+
if( !staticAvailable ) {
return;
}
-
+
try {
// Get handle to default device.
device = alc.alcOpenDevice(null);
if (device == null) {
throw new RuntimeException("ALAudioSink: Error opening default OpenAL device");
}
-
+
// Get the device specifier.
deviceSpecifier = alc.alcGetString(device, ALC.ALC_DEVICE_SPECIFIER);
if (deviceSpecifier == null) {
throw new RuntimeException("ALAudioSink: Error getting specifier for default OpenAL device");
}
-
+
// Create audio context.
context = alc.alcCreateContext(device, null);
if (context == null) {
throw new RuntimeException("ALAudioSink: Error creating OpenAL context for "+deviceSpecifier);
}
-
+
lockContext();
try {
// Check for an error.
if ( alc.alcGetError(device) != ALC.ALC_NO_ERROR ) {
throw new RuntimeException("ALAudioSink: Error making OpenAL context current");
}
-
+
hasSOFTBufferSamples = al.alIsExtensionPresent(AL_SOFT_buffer_samples);
preferredAudioFormat = queryPreferredAudioFormat();
if( DEBUG ) {
@@ -168,7 +168,7 @@ public class ALAudioSink implements AudioSink {
System.out.println("ALAudioSink: hasSOFTBufferSamples "+hasSOFTBufferSamples);
System.out.println("ALAudioSink: preferredAudioFormat "+preferredAudioFormat);
}
-
+
// Create source
{
alSource = new int[1];
@@ -177,10 +177,10 @@ public class ALAudioSink implements AudioSink {
if( err != AL.AL_NO_ERROR ) {
alSource = null;
throw new RuntimeException("ALAudioSink: Error generating Source: 0x"+Integer.toHexString(err));
- }
+ }
}
-
- if( DEBUG ) {
+
+ if( DEBUG ) {
System.err.println("ALAudioSink: Using device: " + deviceSpecifier);
}
initialized = true;
@@ -195,7 +195,7 @@ public class ALAudioSink implements AudioSink {
destroy();
}
}
-
+
private final AudioFormat queryPreferredAudioFormat() {
int sampleRate = DefaultFormat.sampleRate;
final int[] value = new int[1];
@@ -205,7 +205,7 @@ public class ALAudioSink implements AudioSink {
}
return new AudioFormat(sampleRate, DefaultFormat.sampleSize, DefaultFormat.channelCount, DefaultFormat.signed, DefaultFormat.fixedP, DefaultFormat.planar, DefaultFormat.littleEndian);
}
-
+
private final void lockContext() {
lock.lock();
alc.alcMakeContextCurrent(context);
@@ -236,12 +236,12 @@ public class ALAudioSink implements AudioSink {
lock.unlock();
}
}
-
+
@Override
public final String toString() {
final int alSrcName = null != alSource ? alSource[0] : 0;
final int alBuffersLen = null != alBufferNames ? alBufferNames.length : 0;
- final int ctxHash = context != null ? context.hashCode() : 0;
+ final int ctxHash = context != null ? context.hashCode() : 0;
return "ALAudioSink[init "+initialized+", playRequested "+playRequested+", device "+deviceSpecifier+", ctx "+toHexString(ctxHash)+", alSource "+alSrcName+
", chosen "+chosenFormat+
", al[chan "+ALHelpers.alChannelLayoutName(alChannelLayout)+", type "+ALHelpers.alSampleTypeName(alSampleType)+
@@ -250,12 +250,12 @@ public class ALAudioSink implements AudioSink {
"queued["+alFramesPlaying.size()+", apts "+getPTS()+", "+getQueuedTime() + " ms, " + alBufferBytesQueued+" bytes], "+
"queue[g "+frameGrowAmount+", l "+frameLimit+"]";
}
-
+
public final String getPerfString() {
final int alBuffersLen = null != alBufferNames ? alBufferNames.length : 0;
return "Play [buffer "+alFramesPlaying.size()+"/"+alBuffersLen+", apts "+getPTS()+", "+getQueuedTime() + " ms, " + alBufferBytesQueued+" bytes]";
}
-
+
@Override
public final AudioFormat getPreferredFormat() {
if( !staticAvailable ) {
@@ -263,7 +263,7 @@ public class ALAudioSink implements AudioSink {
}
return preferredAudioFormat;
}
-
+
@Override
public final int getMaxSupportedChannels() {
if( !staticAvailable ) {
@@ -271,14 +271,14 @@ public class ALAudioSink implements AudioSink {
}
return hasSOFTBufferSamples ? 8 : 2;
}
-
+
@Override
public final boolean isSupported(AudioFormat format) {
if( !staticAvailable ) {
return false;
}
if( format.planar || !format.littleEndian ) {
- // FIXME big-endian supported w/ SOFT where it's native format!
+ // FIXME big-endian supported w/ SOFT where it's native format!
return false;
}
final int alChannelLayout = ALHelpers.getDefaultALChannelLayout(format.channelCount);
@@ -286,7 +286,7 @@ public class ALAudioSink implements AudioSink {
final int alSampleType = ALHelpers.getALSampleType(format.sampleSize, format.signed, format.fixedP);
if( AL.AL_NONE != alSampleType ) {
lockContext();
- try {
+ try {
final int alFormat = ALHelpers.getALFormat(alChannelLayout, alSampleType, hasSOFTBufferSamples, al, alExt);
return AL.AL_NONE != alFormat;
} finally {
@@ -296,7 +296,7 @@ public class ALAudioSink implements AudioSink {
}
return false;
}
-
+
@Override
public final boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
if( !staticAvailable ) {
@@ -318,10 +318,10 @@ public class ALAudioSink implements AudioSink {
// Allocate buffers
destroyBuffers();
{
- final float useFrameDuration = frameDuration > 1f ? frameDuration : AudioSink.DefaultFrameDuration;
+ final float useFrameDuration = frameDuration > 1f ? frameDuration : AudioSink.DefaultFrameDuration;
final int initialFrameCount = requestedFormat.getFrameCount(
initialQueueSize > 0 ? initialQueueSize : AudioSink.DefaultInitialQueueSize, useFrameDuration);
- // frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
+ // frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
alBufferNames = new int[initialFrameCount];
al.alGenBuffers(initialFrameCount, alBufferNames, 0);
final int err = al.alGetError();
@@ -333,7 +333,7 @@ public class ALAudioSink implements AudioSink {
for(int i=0; i<initialFrameCount; i++) {
alFrames[i] = new ALAudioFrame(alBufferNames[i]);
}
-
+
alFramesAvail = new LFRingbuffer<ALAudioFrame>(alFrames);
alFramesPlaying = new LFRingbuffer<ALAudioFrame>(ALAudioFrame[].class, initialFrameCount);
this.frameGrowAmount = requestedFormat.getFrameCount(
@@ -344,11 +344,11 @@ public class ALAudioSink implements AudioSink {
} finally {
unlockContext();
}
-
+
chosenFormat = requestedFormat;
return true;
}
-
+
private static int[] concat(int[] first, int[] second) {
final int[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
@@ -360,7 +360,7 @@ public class ALAudioSink implements AudioSink {
System.arraycopy(second, 0, result, first.length, second.length);
return result;
} */
-
+
private boolean growBuffers() {
if( !alFramesAvail.isEmpty() || !alFramesPlaying.isFull() ) {
throw new InternalError("Buffers: Avail is !empty "+alFramesAvail+" or Playing is !full "+alFramesPlaying);
@@ -371,7 +371,7 @@ public class ALAudioSink implements AudioSink {
}
return false;
}
-
+
final int[] newALBufferNames = new int[frameGrowAmount];
al.alGenBuffers(frameGrowAmount, newALBufferNames, 0);
final int err = al.alGetError();
@@ -382,7 +382,7 @@ public class ALAudioSink implements AudioSink {
return false;
}
alBufferNames = concat(alBufferNames, newALBufferNames);
-
+
final ALAudioFrame[] newALBuffers = new ALAudioFrame[frameGrowAmount];
for(int i=0; i<frameGrowAmount; i++) {
newALBuffers[i] = new ALAudioFrame(newALBufferNames[i]);
@@ -399,7 +399,7 @@ public class ALAudioSink implements AudioSink {
}
return true;
}
-
+
private void destroyBuffers() {
if( !staticAvailable ) {
return;
@@ -422,7 +422,7 @@ public class ALAudioSink implements AudioSink {
alBufferNames = null;
}
}
-
+
@Override
public final void destroy() {
initialized = false;
@@ -445,7 +445,7 @@ public class ALAudioSink implements AudioSink {
}
alSource = null;
}
-
+
destroyBuffers();
} finally {
destroyContext();
@@ -459,22 +459,20 @@ public class ALAudioSink implements AudioSink {
t.printStackTrace();
}
}
- device = null;
+ device = null;
}
chosenFormat = null;
}
-
+
@Override
public final boolean isInitialized() {
return initialized;
}
-
- private final int dequeueBuffer(boolean flush, boolean wait) {
+
+ private final int dequeueBuffer(boolean wait) {
int alErr = AL.AL_NO_ERROR;
final int releaseBufferCount;
- if( flush ) {
- releaseBufferCount = alFramesPlaying.size();
- } else if( alBufferBytesQueued > 0 ) {
+ if( alBufferBytesQueued > 0 ) {
final int releaseBufferLimes = Math.max(1, alFramesPlaying.size() / 4 );
final int[] val=new int[1];
int i=0;
@@ -490,8 +488,8 @@ public class ALAudioSink implements AudioSink {
final int avgBufferDura = chosenFormat.getBytesDuration( alBufferBytesQueued / alFramesPlaying.size() );
final int sleep = Math.max(2, Math.min(100, releaseBufferLimes * avgBufferDura));
if( DEBUG || true ) {
- System.err.println(getThreadName()+": ALAudioSink: Dequeue.wait["+i+"]: avgBufferDura "+avgBufferDura+", releaseBufferLimes "+releaseBufferLimes+", sleep "+sleep+" ms, playImpl "+isPlayingImpl1()+", processed "+val[0]+", "+this);
- }
+ System.err.println(getThreadName()+": ALAudioSink: Dequeue.wait["+i+"]: avgBufferDura "+avgBufferDura+", releaseBufferLimes "+releaseBufferLimes+", sleep "+sleep+" ms, playImpl "+(AL.AL_PLAYING == getSourceState())+", processed "+val[0]+", "+this);
+ }
unlockContext();
try {
Thread.sleep( sleep - 1 );
@@ -511,7 +509,7 @@ public class ALAudioSink implements AudioSink {
al.alSourceUnqueueBuffers(alSource[0], releaseBufferCount, buffers, 0);
alErr = al.alGetError();
if( AL.AL_NO_ERROR != alErr ) {
- throw new RuntimeException("ALError "+toHexString(alErr)+" while dequeueing "+releaseBufferCount+" buffers. "+this);
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while dequeueing "+releaseBufferCount+" buffers. "+this);
}
for ( int i=0; i<releaseBufferCount; i++ ) {
final ALAudioFrame releasedBuffer = alFramesPlaying.get();
@@ -520,7 +518,7 @@ public class ALAudioSink implements AudioSink {
}
if( releasedBuffer.alBuffer != buffers[i] ) {
alFramesAvail.dump(System.err, "Avail-deq02-post");
- alFramesPlaying.dump(System.err, "Playi-deq02-post");
+ alFramesPlaying.dump(System.err, "Playi-deq02-post");
throw new InternalError("Buffer name mismatch: dequeued: "+buffers[i]+", released "+releasedBuffer+", "+this);
}
alBufferBytesQueued -= releasedBuffer.getByteSize();
@@ -528,17 +526,27 @@ public class ALAudioSink implements AudioSink {
throw new InternalError("Internal Error: "+this);
}
}
- if( flush && ( !alFramesAvail.isFull() || !alFramesPlaying.isEmpty() ) ) {
- alFramesAvail.dump(System.err, "Avail-deq03-post");
- alFramesPlaying.dump(System.err, "Playi-deq03-post");
- throw new InternalError("Flush failure: "+this);
- }
}
return releaseBufferCount;
}
-
+ private final void dequeueForceAll() {
+ while ( !alFramesPlaying.isEmpty() ) {
+ final ALAudioFrame releasedBuffer = alFramesPlaying.get();
+ if( null == releasedBuffer ) {
+ throw new InternalError("Internal Error: "+this);
+ }
+ alBufferBytesQueued -= releasedBuffer.getByteSize();
+ if( !alFramesAvail.put(releasedBuffer) ) {
+ throw new InternalError("Internal Error: "+this);
+ }
+ }
+ if( 0 != alBufferBytesQueued ) {
+ throw new InternalError("Internal Error: "+this);
+ }
+ }
+
private final int dequeueBuffer(boolean wait, int inPTS, int inDuration) {
- final int dequeuedBufferCount = dequeueBuffer( false /* flush */, wait );
+ final int dequeuedBufferCount = dequeueBuffer( wait );
final ALAudioFrame currentBuffer = alFramesPlaying.peek();
if( null != currentBuffer ) {
playingPTS = currentBuffer.getPTS();
@@ -552,12 +560,12 @@ public class ALAudioSink implements AudioSink {
}
return dequeuedBufferCount;
}
-
+
@Override
public final AudioFrame enqueueData(AudioDataFrame audioDataFrame) {
return enqueueData(audioDataFrame.getPTS(), audioDataFrame.getData(), audioDataFrame.getByteSize());
}
-
+
@Override
public final AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) {
if( !initialized || null == chosenFormat ) {
@@ -565,7 +573,7 @@ public class ALAudioSink implements AudioSink {
}
final ALAudioFrame alFrame;
int alErr = AL.AL_NO_ERROR;
-
+
// OpenAL consumes buffers in the background
// we first need to initialize the OpenAL buffers then
// start continuous playback.
@@ -575,7 +583,7 @@ public class ALAudioSink implements AudioSink {
if(al.alGetError() != AL.AL_NO_ERROR) {
throw new RuntimeException("ALError "+toHexString(alErr)+" while makeCurrent. "+this);
}
-
+
final int duration = chosenFormat.getBytesDuration(byteCount);
final boolean dequeueDone;
if( alFramesAvail.isEmpty() ) {
@@ -592,7 +600,7 @@ public class ALAudioSink implements AudioSink {
final boolean wait = isPlayingImpl0() && alFramesAvail.isEmpty(); // possible if grow failed or already exceeds it's limit!
dequeueBuffer(wait, pts, duration);
}
-
+
alFrame = alFramesAvail.get();
if( null == alFrame ) {
alFramesAvail.dump(System.err, "Avail");
@@ -612,7 +620,7 @@ public class ALAudioSink implements AudioSink {
} else {
al.alBufferData(alFrame.alBuffer, alFormat, bytes, byteCount, chosenFormat.sampleRate);
}
-
+
final int[] alBufferNames = new int[] { alFrame.alBuffer };
al.alSourceQueueBuffers(alSource[0], 1, alBufferNames, 0);
alErr = al.alGetError();
@@ -621,7 +629,7 @@ public class ALAudioSink implements AudioSink {
}
alBufferBytesQueued += byteCount;
enqueuedFrameCount++;
-
+
playImpl(); // continue playing, fixes issue where we ran out of enqueued data!
} finally {
unlockContext();
@@ -640,28 +648,28 @@ public class ALAudioSink implements AudioSink {
return isPlayingImpl0();
} finally {
unlockContext();
- }
+ }
} else {
return false;
}
}
private final boolean isPlayingImpl0() {
if( playRequested ) {
- return isPlayingImpl1();
+ return AL.AL_PLAYING == getSourceState();
} else {
return false;
}
}
- private final boolean isPlayingImpl1() {
+ private final int getSourceState() {
final int[] val = new int[1];
al.alGetSourcei(alSource[0], AL.AL_SOURCE_STATE, val, 0);
final int alErr = al.alGetError();
if(al.alGetError() != AL.AL_NO_ERROR) {
- throw new RuntimeException("ALError "+toHexString(alErr)+" while querying isPlaying. "+this);
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while querying SOURCE_STATE. "+this);
}
- return val[0] == AL.AL_PLAYING;
+ return val[0];
}
-
+
@Override
public final void play() {
if( !initialized || null == chosenFormat ) {
@@ -672,22 +680,22 @@ public class ALAudioSink implements AudioSink {
try {
playImpl();
if( DEBUG ) {
- System.err.println(getThreadName()+": ALAudioSink: PLAY playImpl "+isPlayingImpl1()+", "+this);
- }
+ System.err.println(getThreadName()+": ALAudioSink: PLAY playImpl "+(AL.AL_PLAYING == getSourceState())+", "+this);
+ }
} finally {
unlockContext();
- }
+ }
}
private final void playImpl() {
- if( playRequested && !isPlayingImpl1() ) {
+ if( playRequested && AL.AL_PLAYING != getSourceState() ) {
al.alSourcePlay(alSource[0]);
final int alErr = al.alGetError();
if(al.alGetError() != AL.AL_NO_ERROR) {
throw new RuntimeException("ALError "+toHexString(alErr)+" while start playing. "+this);
}
- }
+ }
}
-
+
@Override
public final void pause() {
if( !initialized || null == chosenFormat ) {
@@ -698,8 +706,8 @@ public class ALAudioSink implements AudioSink {
try {
pauseImpl();
if( DEBUG ) {
- System.err.println(getThreadName()+": ALAudioSink: PAUSE playImpl "+isPlayingImpl1()+", "+this);
- }
+ System.err.println(getThreadName()+": ALAudioSink: PAUSE playImpl "+(AL.AL_PLAYING == getSourceState())+", "+this);
+ }
} finally {
unlockContext();
}
@@ -716,7 +724,7 @@ public class ALAudioSink implements AudioSink {
}
}
private final void stopImpl() {
- if( isPlayingImpl0() ) {
+ if( AL.AL_STOPPED != getSourceState() ) {
playRequested = false;
al.alSourceStop(alSource[0]);
final int alErr = al.alGetError();
@@ -725,12 +733,12 @@ public class ALAudioSink implements AudioSink {
}
}
}
-
+
@Override
public final float getPlaySpeed() { return playSpeed; }
-
+
@Override
- public final boolean setPlaySpeed(float rate) {
+ public final boolean setPlaySpeed(float rate) {
if( !initialized || null == chosenFormat ) {
return false;
}
@@ -739,22 +747,22 @@ public class ALAudioSink implements AudioSink {
if( Math.abs(1.0f - rate) < 0.01f ) {
rate = 1.0f;
}
- if( 0.5f <= rate && rate <= 2.0f ) { // OpenAL limits
+ if( 0.5f <= rate && rate <= 2.0f ) { // OpenAL limits
playSpeed = rate;
al.alSourcef(alSource[0], AL.AL_PITCH, playSpeed);
return true;
- }
+ }
} finally {
unlockContext();
}
- return false;
+ return false;
}
-
+
@Override
public final float getVolume() {
- return volume;
+ return volume;
}
-
+
@Override
public final boolean setVolume(float v) {
if( !initialized || null == chosenFormat ) {
@@ -767,17 +775,17 @@ public class ALAudioSink implements AudioSink {
} else if( Math.abs(1.0f - v) < 0.01f ) {
v = 1.0f;
}
- if( 0.0f <= v && v <= 1.0f ) { // OpenAL limits
+ if( 0.0f <= v && v <= 1.0f ) { // OpenAL limits
volume = v;
al.alSourcef(alSource[0], AL.AL_GAIN, v);
return true;
- }
+ }
} finally {
unlockContext();
}
- return false;
+ return false;
}
-
+
@Override
public final void flush() {
if( !initialized || null == chosenFormat ) {
@@ -787,28 +795,30 @@ public class ALAudioSink implements AudioSink {
try {
// pauseImpl();
stopImpl();
- dequeueBuffer( true /* flush */, false /* wait */ );
+ al.alSourcei(alSource[0], AL.AL_BUFFER, 0); // explicit force zero buffer!
+ dequeueBuffer( false /* wait */ );
+ dequeueForceAll();
if( alBufferNames.length != alFramesAvail.size() || alFramesPlaying.size() != 0 ) {
throw new InternalError("XXX: "+this);
}
if( DEBUG ) {
- System.err.println(getThreadName()+": ALAudioSink: FLUSH playImpl "+isPlayingImpl1()+", "+this);
- }
+ System.err.println(getThreadName()+": ALAudioSink: FLUSH playImpl "+(AL.AL_PLAYING == getSourceState())+", "+this);
+ }
} finally {
unlockContext();
- }
+ }
}
-
+
@Override
public final int getEnqueuedFrameCount() {
return enqueuedFrameCount;
}
-
+
@Override
public final int getFrameCount() {
return null != alBufferNames ? alBufferNames.length : 0;
}
-
+
@Override
public final int getQueuedFrameCount() {
if( !initialized || null == chosenFormat ) {
@@ -816,7 +826,7 @@ public class ALAudioSink implements AudioSink {
}
return alFramesPlaying.size();
}
-
+
@Override
public final int getFreeFrameCount() {
if( !initialized || null == chosenFormat ) {
@@ -824,7 +834,7 @@ public class ALAudioSink implements AudioSink {
}
return alFramesAvail.size();
}
-
+
@Override
public final int getQueuedByteCount() {
if( !initialized || null == chosenFormat ) {
@@ -832,7 +842,7 @@ public class ALAudioSink implements AudioSink {
}
return alBufferBytesQueued;
}
-
+
@Override
public final int getQueuedTime() {
if( !initialized || null == chosenFormat ) {
@@ -840,10 +850,10 @@ public class ALAudioSink implements AudioSink {
}
return chosenFormat.getBytesDuration(alBufferBytesQueued);
}
-
+
@Override
public final int getPTS() { return playingPTS; }
-
+
private static final String toHexString(int v) { return "0x"+Integer.toHexString(v); }
- private static final String getThreadName() { return Thread.currentThread().getName(); }
+ private static final String getThreadName() { return Thread.currentThread().getName(); }
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 9164739..0de308c 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -49,9 +49,11 @@ import com.jogamp.common.net.URIQueryProps;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.LFRingbuffer;
import com.jogamp.common.util.Ringbuffer;
+import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.util.TimeFrameI;
import com.jogamp.opengl.util.av.AudioSink;
import com.jogamp.opengl.util.av.GLMediaPlayer;
+import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureSequence;
import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
@@ -136,6 +138,18 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected int displayedFrameCount = 0;
protected volatile int video_pts_last = 0;
+ /**
+ * Help detect EOS, limit is {@link #MAX_FRAMELESS_MS_UNTIL_EOS}.
+ * To be used either by getNextTexture(..) or StreamWorker for audio-only.
+ */
+ private int nullFrameCount = 0;
+ private int maxNullFrameCountUntilEOS = 0;
+ /**
+ * Help detect EOS, limit {@value} milliseconds without a valid frame.
+ */
+ private static final int MAX_FRAMELESS_MS_UNTIL_EOS = 5000;
+ private static final int MAX_FRAMELESS_UNTIL_EOS_DEFAULT = MAX_FRAMELESS_MS_UNTIL_EOS / 30; // default value assuming 30fps
+
/** See {@link #getAudioSink()}. Set by implementation if used from within {@link #initStreamImpl(int, int)}! */
protected AudioSink audioSink = null;
protected boolean audioSinkPlaySpeedSet = false;
@@ -221,7 +235,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
public String getRequiredExtensionsShaderStub() throws IllegalStateException {
checkGLInit();
if(GLES2.GL_TEXTURE_EXTERNAL_OES == textureTarget) {
- return TextureSequence.GL_OES_EGL_image_external_Required_Prelude;
+ return ShaderCode.createExtensionDirective(GLExtensions.OES_EGL_image_external, ShaderCode.ENABLE);
}
return "";
}
@@ -378,12 +392,20 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if( null != streamWorker ) {
streamWorker.doPause();
}
+ // Adjust target ..
+ if( msec >= duration ) {
+ msec = duration - (int)Math.floor(frame_duration);
+ } else if( msec < 0 ) {
+ msec = 0;
+ }
pts1 = seekImpl(msec);
resetAVPTSAndFlush();
if( null != audioSink && State.Playing == _state ) {
audioSink.play(); // cont. w/ new data
}
- System.err.println("SEEK XXX: "+getPerfString());
+ if(DEBUG) {
+ System.err.println("Seek("+msec+"): "+getPerfString());
+ }
if( null != streamWorker ) {
streamWorker.doResume();
}
@@ -505,6 +527,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
decodedFrameCount = 0;
presentedFrameCount = 0;
displayedFrameCount = 0;
+ nullFrameCount = 0;
+ maxNullFrameCountUntilEOS = MAX_FRAMELESS_UNTIL_EOS_DEFAULT;
this.streamLoc = streamLoc;
// Pre-parse for camera-input scheme
@@ -526,20 +550,17 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.vid = vid;
this.aid = aid;
if ( this.streamLoc != null ) {
- if( TEXTURE_COUNT_MIN < textureCount ) {
- streamWorker = new StreamWorker();
- } else {
- new Thread() {
- public void run() {
- try {
- initStreamImpl(vid, aid);
- } catch (Throwable t) {
- streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t);
- changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized);
- } // also initializes width, height, .. etc
- }
- }.start();
- }
+ new Thread() {
+ public void run() {
+ try {
+ // StreamWorker may be used, see API-doc of StreamWorker
+ initStreamImpl(vid, aid);
+ } catch (Throwable t) {
+ streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t);
+ changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized);
+ } // also initializes width, height, .. etc
+ }
+ }.start();
}
}
}
@@ -744,6 +765,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected TextureFrame cachedFrame = null;
protected long lastTimeMillis = 0;
+ private final boolean[] stGotVFrame = { false };
+
@Override
public final TextureFrame getNextTexture(GL gl) throws IllegalStateException {
synchronized( stateLock ) {
@@ -751,12 +774,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
throw new IllegalStateException("Instance not paused or playing: "+this);
}
if(State.Playing == state) {
- TextureFrame nextFrame = null;
boolean dropFrame = false;
try {
do {
- final long currentTimeMillis;
- final boolean playCached = null != cachedFrame;
final boolean droppedFrame;
if( dropFrame ) {
presentedFrameCount--;
@@ -765,24 +785,69 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
} else {
droppedFrame = false;
}
+ final boolean playCached = null != cachedFrame;
+ final int video_pts;
+ final boolean hasVideoFrame;
+ TextureFrame nextFrame;
if( playCached ) {
nextFrame = cachedFrame;
cachedFrame = null;
presentedFrameCount--;
- } else if( STREAM_ID_NONE != vid ) {
- if( null != videoFramesDecoded ) { // single threaded ? TEXTURE_COUNT_MIN == textureCount
+ video_pts = nextFrame.getPTS();
+ hasVideoFrame = true;
+ } else {
+ if( null != videoFramesDecoded ) {
+ // multi-threaded and video available
nextFrame = videoFramesDecoded.get();
+ if( null != nextFrame ) {
+ video_pts = nextFrame.getPTS();
+ hasVideoFrame = true;
+ } else {
+ video_pts = TimeFrameI.INVALID_PTS;
+ hasVideoFrame = false;
+ }
} else {
- nextFrame = getNextSingleThreaded(gl, lastFrame);
+ // single-threaded or audio-only
+ video_pts = getNextSingleThreaded(gl, lastFrame, stGotVFrame);
+ nextFrame = lastFrame;
+ hasVideoFrame = stGotVFrame[0];
}
}
- currentTimeMillis = Platform.currentTimeMillis();
- if( null != nextFrame ) {
- presentedFrameCount++;
- final int video_pts = nextFrame.getPTS();
- if( video_pts == TimeFrameI.END_OF_STREAM_PTS ) {
- pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
- } else if( video_pts != TimeFrameI.INVALID_PTS ) {
+ final long currentTimeMillis = Platform.currentTimeMillis();
+
+ if( TimeFrameI.END_OF_STREAM_PTS == video_pts ||
+ ( duration > 0 && duration <= video_pts ) || maxNullFrameCountUntilEOS <= nullFrameCount )
+ {
+ // EOS
+ if( DEBUG ) {
+ System.err.println( "AV-EOS (getNextTexture): EOS_PTS "+(TimeFrameI.END_OF_STREAM_PTS == video_pts)+", "+this);
+ }
+ pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
+
+ } else if( TimeFrameI.INVALID_PTS == video_pts ) { // no audio or video frame
+ if( null == videoFramesDecoded || !videoFramesDecoded.isEmpty() ) {
+ nullFrameCount++;
+ }
+ if( DEBUG ) {
+ final int audio_pts = getAudioPTSImpl();
+ final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed );
+ final int d_apts;
+ if( audio_pts != TimeFrameI.INVALID_PTS ) {
+ d_apts = audio_pts - audio_scr;
+ } else {
+ d_apts = 0;
+ }
+ final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed );
+ final int d_vpts = video_pts - video_scr;
+ System.err.println( "AV~: dT "+(currentTimeMillis-lastTimeMillis)+", nullFrames "+nullFrameCount+
+ getPerfStringImpl( video_scr, video_pts, d_vpts, audio_scr, audio_pts, d_apts, 0 ) + ", droppedFrame "+droppedFrame);
+ }
+ } else { // valid pts: has audio or video frame
+ nullFrameCount=0;
+
+ if( hasVideoFrame ) { // has video frame
+ presentedFrameCount++;
+
final int audio_pts = getAudioPTSImpl();
final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed );
final int d_apts;
@@ -836,29 +901,16 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
", avg dpy-fps "+avg_dpy_duration+" ms/f, maxD "+maxVideoDelay+" ms, "+_nextFrame+", playCached " + playCached + ", dropFrame "+dropFrame);
}
}
- } else if( DEBUG ) {
- System.err.println("Invalid PTS: "+nextFrame);
- }
- if( null != nextFrame && null != videoFramesFree ) {
- // Had frame and not single threaded ? (TEXTURE_COUNT_MIN < textureCount)
- final TextureFrame _lastFrame = lastFrame;
- lastFrame = nextFrame;
+ } // has video frame
+ } // has audio or video frame
+
+ if( null != videoFramesFree && null != nextFrame ) {
+ // Had frame and not single threaded ? (TEXTURE_COUNT_MIN < textureCount)
+ final TextureFrame _lastFrame = lastFrame;
+ lastFrame = nextFrame;
+ if( null != _lastFrame ) {
videoFramesFree.putBlocking(_lastFrame);
}
- } else if( DEBUG ) {
- final int video_pts = lastFrame.getPTS();
- final int audio_pts = getAudioPTSImpl();
- final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed );
- final int d_apts;
- if( audio_pts != TimeFrameI.INVALID_PTS ) {
- d_apts = audio_pts - audio_scr;
- } else {
- d_apts = 0;
- }
- final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed );
- final int d_vpts = video_pts - video_scr;
- System.err.println( "AV~: dT "+(currentTimeMillis-lastTimeMillis)+", "+
- getPerfStringImpl( video_scr, video_pts, d_vpts, audio_scr, audio_pts, d_apts, 0 ) + ", droppedFrame "+droppedFrame);
}
lastTimeMillis = currentTimeMillis;
} while( dropFrame );
@@ -895,24 +947,24 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
*/
protected abstract int getNextTextureImpl(GL gl, TextureFrame nextFrame);
- protected final TextureFrame getNextSingleThreaded(final GL gl, final TextureFrame nextFrame) throws InterruptedException {
+ protected final int getNextSingleThreaded(final GL gl, final TextureFrame nextFrame, boolean[] gotVFrame) throws InterruptedException {
+ final int pts;
if( STREAM_ID_NONE != vid ) {
preNextTextureImpl(gl);
- final int vPTS = getNextTextureImpl(gl, nextFrame);
+ pts = getNextTextureImpl(gl, nextFrame);
postNextTextureImpl(gl);
- if( TimeFrameI.INVALID_PTS != vPTS ) {
+ if( TimeFrameI.INVALID_PTS != pts ) {
newFrameAvailable(nextFrame, Platform.currentTimeMillis());
- return nextFrame;
+ gotVFrame[0] = true;
+ } else {
+ gotVFrame[0] = false;
}
} else {
// audio only
- final int vPTS = getNextTextureImpl(null, null);
- if( TimeFrameI.INVALID_PTS != vPTS && TimeFrameI.END_OF_STREAM_PTS == vPTS ) {
- // state transition incl. notification
- pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
- }
+ pts = getNextTextureImpl(null, null);
+ gotVFrame[0] = false;
}
- return null;
+ return pts;
}
@@ -960,6 +1012,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
private void resetAVPTS() {
+ nullFrameCount = 0;
presentedFrameCount = 0;
displayedFrameCount = 0;
decodedFrameCount = 0;
@@ -982,6 +1035,11 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
+ /**
+ * After {@link GLMediaPlayerImpl#initStreamImpl(int, int) initStreamImpl(..)} is completed via
+ * {@link GLMediaPlayerImpl#updateAttributes(int, int, int, int, int, int, int, float, int, int, int, String, String) updateAttributes(..)},
+ * the latter decides whether StreamWorker is being used.
+ */
class StreamWorker extends Thread {
private volatile boolean isRunning = false;
private volatile boolean isActive = false;
@@ -996,14 +1054,23 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
/**
* Starts this daemon thread,
- * which initializes the stream first via {@link GLMediaPlayerImpl#initStreamImpl(int, int)} first.
* <p>
- * After stream initialization, this thread pauses!
+ * This thread pauses after it's started!
* </p>
**/
StreamWorker() {
setDaemon(true);
- start();
+ synchronized(this) {
+ start();
+ while( !isRunning ) {
+ this.notifyAll(); // wake-up startup-block
+ try {
+ this.wait(); // wait until started
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
private void makeCurrent(GLContext ctx) {
@@ -1071,7 +1138,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
shallPause = false;
if( Thread.currentThread() != this ) {
while( !isActive ) {
- this.notify(); // wake-up pause-block
+ this.notifyAll(); // wake-up pause-block
try {
this.wait(); // wait until resumed
} catch (InterruptedException e) {
@@ -1089,7 +1156,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.interrupt();
}
while( isRunning ) {
- this.notify(); // wake-up pause-block (opt)
+ this.notifyAll(); // wake-up pause-block (opt)
try {
this.wait(); // wait until stopped
} catch (InterruptedException e) {
@@ -1109,17 +1176,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
synchronized ( this ) {
isRunning = true;
- try {
- isBlocked = true;
- initStreamImpl(vid, aid);
- isBlocked = false;
- } catch (Throwable t) {
- streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t);
- isBlocked = false;
- isRunning = false;
- changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized);
- return; // end of thread!
- } // also initializes width, height, .. etc
+ this.notifyAll(); // wake-up ctor()
}
while( !shallStop ){
@@ -1131,7 +1188,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
while( shallPause && !shallStop ) {
isActive = false;
- this.notify(); // wake-up doPause()
+ this.notifyAll(); // wake-up doPause()
try {
this.wait(); // wait until resumed
} catch (InterruptedException e) {
@@ -1145,7 +1202,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
preNextTextureImpl(sharedGLCtx.getGL());
}
isActive = true;
- this.notify(); // wake-up doResume()
+ this.notifyAll(); // wake-up doResume()
}
}
if( !sharedGLCtxCurrent && null != sharedGLCtx ) {
@@ -1175,6 +1232,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
isBlocked = false;
final int vPTS = getNextTextureImpl(gl, nextFrame);
+ boolean audioEOS = false;
if( TimeFrameI.INVALID_PTS != vPTS ) {
if( null != nextFrame ) {
if( STREAM_WORKER_DELAY > 0 ) {
@@ -1187,13 +1245,30 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
nextFrame = null;
} else {
// audio only
- if( TimeFrameI.END_OF_STREAM_PTS == vPTS ) {
- // state transition incl. notification
- shallPause = true;
- isActive = false;
- pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
+ if( TimeFrameI.END_OF_STREAM_PTS == vPTS || ( duration > 0 && duration < vPTS ) ) {
+ audioEOS = true;
+ } else {
+ nullFrameCount = 0;
}
}
+ } else if( null == nextFrame ) {
+ // audio only
+ audioEOS = maxNullFrameCountUntilEOS <= nullFrameCount;
+ if( null == audioSink || 0 == audioSink.getEnqueuedFrameCount() ) {
+ nullFrameCount++;
+ }
+ }
+ if( audioEOS ) {
+ // state transition incl. notification
+ synchronized ( this ) {
+ shallPause = true;
+ isActive = false;
+ this.notifyAll(); // wake-up potential do*()
+ }
+ if( DEBUG ) {
+ System.err.println( "AV-EOS (StreamWorker): EOS_PTS "+(TimeFrameI.END_OF_STREAM_PTS == vPTS)+", "+GLMediaPlayerImpl.this);
+ }
+ pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
}
} catch (InterruptedException e) {
isBlocked = false;
@@ -1213,8 +1288,11 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
t.printStackTrace();
}
// state transition incl. notification
- shallPause = true;
- isActive = false;
+ synchronized ( this ) {
+ shallPause = true;
+ isActive = false;
+ this.notifyAll(); // wake-up potential do*()
+ }
pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_ERR);
}
}
@@ -1227,12 +1305,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
destroySharedGL();
isRunning = false;
isActive = false;
- this.notify(); // wake-up doStop()
+ this.notifyAll(); // wake-up doStop()
}
}
}
static int StreamWorkerInstanceId = 0;
- private StreamWorker streamWorker = null;
+ private volatile StreamWorker streamWorker = null;
private volatile StreamException streamErr = null;
protected final int addStateEventMask(int event_mask, State newState) {
@@ -1278,7 +1356,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
int bps_video, int bps_audio, float fps,
int videoFrames, int audioFrames, int duration, String vcodec, String acodec) {
int event_mask = 0;
- if( state == State.Uninitialized ) {
+ final boolean wasUninitialized = state == State.Uninitialized;
+
+ if( wasUninitialized ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_INIT;
state = State.Initialized;
}
@@ -1304,7 +1384,13 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if( this.fps != fps ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_FPS;
this.fps = fps;
- this.frame_duration = 1000f / fps;
+ if( 0 != fps ) {
+ this.frame_duration = 1000f / fps;
+ this.maxNullFrameCountUntilEOS = MAX_FRAMELESS_MS_UNTIL_EOS / (int)this.frame_duration;
+ } else {
+ this.frame_duration = 0;
+ this.maxNullFrameCountUntilEOS = MAX_FRAMELESS_UNTIL_EOS_DEFAULT;
+ }
}
if( this.bps_stream != bps_stream || this.bps_video != bps_video || this.bps_audio != bps_audio ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_BPS;
@@ -1329,6 +1415,17 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if(0==event_mask) {
return;
}
+ if( wasUninitialized ) {
+ if( null != streamWorker ) {
+ throw new InternalError("XXX: StreamWorker not null - "+this);
+ }
+ if( TEXTURE_COUNT_MIN < textureCount || STREAM_ID_NONE == vid ) { // Enable StreamWorker for 'audio only' as well (Bug 918).
+ streamWorker = new StreamWorker();
+ }
+ if( DEBUG ) {
+ System.err.println("XXX Initialize @ updateAttributes: "+this);
+ }
+ }
attributesUpdated(event_mask);
}
@@ -1424,9 +1521,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
final int decVideoFrames = null != videoFramesDecoded ? videoFramesDecoded.size() : 0;
final int video_scr = video_scr_pts + (int) ( ( Platform.currentTimeMillis() - video_scr_t0 ) * playSpeed );
final String camPath = null != cameraPath ? ", camera: "+cameraPath : "";
- return "GLMediaPlayer["+state+", vSCR "+video_scr+", frames[p "+presentedFrameCount+", d "+decodedFrameCount+", t "+videoFrames+" ("+tt+" s)], "+
- "speed "+playSpeed+", "+bps_stream+" bps, "+
- "Texture[count "+textureCount+", free "+freeVideoFrames+", dec "+decVideoFrames+", tagt "+toHexString(textureTarget)+", ifmt "+toHexString(textureInternalFormat)+", fmt "+toHexString(textureFormat)+", type "+toHexString(textureType)+"], "+
+ return "GLMediaPlayer["+state+", vSCR "+video_scr+", frames[p "+presentedFrameCount+", d "+decodedFrameCount+", t "+videoFrames+" ("+tt+" s), z "+nullFrameCount+" / "+maxNullFrameCountUntilEOS+"], "+
+ "speed "+playSpeed+", "+bps_stream+" bps, hasSW "+(null!=streamWorker)+
+ ", Texture[count "+textureCount+", free "+freeVideoFrames+", dec "+decVideoFrames+", tagt "+toHexString(textureTarget)+", ifmt "+toHexString(textureInternalFormat)+", fmt "+toHexString(textureFormat)+", type "+toHexString(textureType)+"], "+
"Video[id "+vid+", <"+vcodec+">, "+width+"x"+height+", glOrient "+isInGLOrientation+", "+fps+" fps, "+frame_duration+" fdur, "+bps_video+" bps], "+
"Audio[id "+aid+", <"+acodec+">, "+bps_audio+" bps, "+audioFrames+" frames], uri "+loc+camPath+"]";
}
@@ -1460,7 +1557,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
freeVideoFrames = 0;
decVideoFrames = 0;
}
- return state+", frames[(p "+presentedFrameCount+", d "+decodedFrameCount+") / "+videoFrames+", "+tt+" s], "+
+ return state+", frames[(p "+presentedFrameCount+", d "+decodedFrameCount+") / "+videoFrames+", "+tt+" s, z "+nullFrameCount+" / "+maxNullFrameCountUntilEOS+"], "+
"speed " + playSpeed+", dAV "+( d_vpts - d_apts )+", vSCR "+video_scr+", vpts "+video_pts+", dSCR["+d_vpts+", avrg "+video_dpts_avg_diff+"], "+
"aSCR "+audio_scr+", apts "+audio_pts+" ( "+d_apts+" ), "+audioSinkInfo+
", Texture[count "+textureCount+", free "+freeVideoFrames+", dec "+decVideoFrames+"]";
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
index d2ef026..034b945 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -232,7 +232,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
private int vBytesPerPixelPerPlane = 0;
private int texWidth, texHeight; // overall (stuffing planes in one texture)
private String singleTexComp = "r";
- private GLPixelStorageModes psm;
+ private final GLPixelStorageModes psm;
//
// Audio
@@ -280,7 +280,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
System.err.println("initStream: p1 "+this);
}
- final String streamLocS=IOUtil.decodeFromURI(streamLoc.toString());
+ final String streamLocS = IOUtil.decodeURIIfFilePath(streamLoc);
destroyAudioSink();
if( GLMediaPlayer.STREAM_ID_NONE == aid ) {
audioSink = AudioSinkFactory.createNull();
@@ -331,6 +331,11 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
final int aMaxChannelCount = audioSink.getMaxSupportedChannels();
final int aPrefSampleRate = preferredAudioFormat.sampleRate;
// setStream(..) issues updateAttributes*(..), and defines avChosenAudioFormat, vid, aid, .. etc
+ if(DEBUG) {
+ System.err.println("initStream: p3 cameraPath "+cameraPath+", isCameraInput "+isCameraInput);
+ System.err.println("initStream: p3 stream "+streamLoc+" -> "+streamLocS+" -> "+resStreamLocS);
+ System.err.println("initStream: p3 vid "+vid+", sizes "+sizes+", reqVideo "+rw+"x"+rh+"@"+rr+", aid "+aid+", aMaxChannelCount "+aMaxChannelCount+", aPrefSampleRate "+aPrefSampleRate);
+ }
natives.setStream0(moviePtr, resStreamLocS, isCameraInput, vid, sizes, rw, rh, rr, aid, aMaxChannelCount, aPrefSampleRate);
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
index 7a4e08d..feacdb9 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
@@ -253,7 +253,7 @@ public class WGLGLCapabilities extends GLCapabilities {
if(null == sink) {
sink = new StringBuilder();
}
- sink.append("wgl vid 0x").append(Integer.toHexString(pfdID)).append(" ");
+ sink.append("wgl vid ").append(pfdID).append(" ");
switch (arb_pixelformat) {
case -1:
sink.append("gdi");
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index b1e4162..b214252 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -268,7 +268,7 @@ public class WindowsWGLContext extends GLContextImpl {
* called by {@link #makeCurrentImpl()}.
*/
@Override
- protected boolean createImpl(GLContextImpl shareWith) {
+ protected boolean createImpl(long shareWithHandle) {
final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice device = config.getScreen().getDevice();
final WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
@@ -278,18 +278,7 @@ public class WindowsWGLContext extends GLContextImpl {
isGLReadDrawableAvailable(); // trigger setup wglGLReadDrawableAvailable
if (DEBUG) {
- System.err.println(getThreadName() + ": createImpl: START "+glCaps+", share "+shareWith);
- }
-
- // Windows can set up sharing of display lists after creation time
- long share;
- if ( null != shareWith ) {
- share = shareWith.getHandle();
- if (share == 0) {
- throw new GLException("GLContextShareSet returned an invalid OpenGL context");
- }
- } else {
- share = 0;
+ System.err.println(getThreadName() + ": createImpl: START "+glCaps+", share "+toHexString(shareWithHandle));
}
boolean createContextARBTried = false;
@@ -300,17 +289,17 @@ public class WindowsWGLContext extends GLContextImpl {
if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) {
throw new GLException("Could not make Shared Context current: "+sharedContext);
}
- contextHandle = createContextARB(share, true);
+ contextHandle = createContextARB(shareWithHandle, true);
sharedContext.release();
if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
throw new GLException("Cannot make previous verified context current: 0x" + toHexString(contextHandle) + ", werr: " + GDI.GetLastError());
}
} else {
- contextHandle = createContextARB(share, true);
+ contextHandle = createContextARB(shareWithHandle, true);
}
createContextARBTried = true;
if ( DEBUG && 0 != contextHandle ) {
- System.err.println(getThreadName() + ": createImpl: OK (ARB, using sharedContext) share "+share);
+ System.err.println(getThreadName() + ": createImpl: OK (ARB, using sharedContext) share "+toHexString(shareWithHandle));
}
}
@@ -343,17 +332,17 @@ public class WindowsWGLContext extends GLContextImpl {
}
if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) {
// initial ARB context creation
- contextHandle = createContextARB(share, true);
+ contextHandle = createContextARB(shareWithHandle, true);
createContextARBTried=true;
if (DEBUG) {
if( 0 != contextHandle ) {
- System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+share);
+ System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+toHexString(shareWithHandle));
} else {
- System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+share);
+ System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+toHexString(shareWithHandle));
}
}
} else if (DEBUG) {
- System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+share+
+ System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+
", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
}
}
@@ -362,7 +351,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
if( 0 != contextHandle ) {
- share = 0; // mark as shared thx to the ARB create method
+ shareWithHandle = 0; // mark as shared thx to the ARB create method
if( 0 != temp_ctx ) {
WGL.wglMakeCurrent(0, 0);
WGL.wglDeleteContext(temp_ctx);
@@ -387,16 +376,17 @@ public class WindowsWGLContext extends GLContextImpl {
WGL.wglDeleteContext(contextHandle);
throw new GLException("Error making old context current: 0x" + toHexString(contextHandle) + ", werr: " + GDI.GetLastError());
}
- if( 0 != share ) {
+ if( 0 != shareWithHandle ) {
+ // Windows can set up sharing of display lists after creation time if using GDI
// Only utilize the classic GDI 'wglShareLists' shared context method
// for traditional non ARB context.
- if ( !WGL.wglShareLists(share, contextHandle) ) {
- throw new GLException("wglShareLists(" + toHexString(share) +
+ if ( !WGL.wglShareLists(shareWithHandle, contextHandle) ) {
+ throw new GLException("wglShareLists(" + toHexString(shareWithHandle) +
", " + toHexString(contextHandle) + ") failed: werr " + GDI.GetLastError());
}
}
if (DEBUG) {
- System.err.println(getThreadName() + ": createImpl: OK (old) share "+share);
+ System.err.println(getThreadName() + ": createImpl: OK (old) share "+toHexString(shareWithHandle));
}
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 95485b0..7fa8775 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -41,7 +41,6 @@
package jogamp.opengl.windows.wgl;
import java.nio.Buffer;
-
import java.nio.ShortBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -141,7 +140,10 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
@Override
- protected final void destroy() {
+ protected final void shutdownImpl() {
+ if( DEBUG ) {
+ System.err.println("WindowsWGLDrawableFactory.shutdown");
+ }
if(null != sharedResourceRunner) {
sharedResourceRunner.stop();
sharedResourceRunner = null;
@@ -171,8 +173,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
private HashMap<String /*connection*/, SharedResourceRunner.Resource> sharedMap;
private long processAffinityChanges = 0;
- private PointerBuffer procMask = PointerBuffer.allocateDirect(1);
- private PointerBuffer sysMask = PointerBuffer.allocateDirect(1);
+ private final PointerBuffer procMask = PointerBuffer.allocateDirect(1);
+ private final PointerBuffer sysMask = PointerBuffer.allocateDirect(1);
@Override
protected void enterThreadCriticalZone() {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 5f2b0c2..5dd9f88 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -62,7 +62,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
protected static final int MAX_PFORMATS = 256;
protected static final int MAX_ATTRIBS = 256;
- private GLCapabilitiesChooser chooser;
+ private final GLCapabilitiesChooser chooser;
private boolean isDetermined = false;
private boolean isExternal = false;
@@ -370,7 +370,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
static List <GLCapabilitiesImmutable> wglARBPFIDs2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource,
- AbstractGraphicsDevice device, GLProfile glp, long hdc, int[] pfdIDs, int winattrbits) {
+ AbstractGraphicsDevice device, GLProfile glp, long hdc, int[] pfdIDs, int winattrbits, boolean onlyFirstValid) {
if (!sharedResource.hasARBPixelFormat()) {
return null;
}
@@ -392,6 +392,9 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
final int j = bucket.size() - 1;
System.err.println("wglARBPFIDs2GLCapabilities: bucket["+i+" -> "+j+"]: "+caps);
}
+ if( onlyFirstValid ) {
+ break;
+ }
} else if(DEBUG) {
GLCapabilitiesImmutable skipped = AttribList2GLCapabilities(device, glp, hdc, pfdIDs[i], iattributes, niattribs, iresults, GLGraphicsConfigurationUtil.ALL_BITS);
System.err.println("wglARBPFIDs2GLCapabilities: bucket["+i+" -> skip]: pfdID "+pfdIDs[i]+", "+skipped+", winattr "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString());
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index 9612952..969e45e 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -112,7 +112,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
final AbstractGraphicsDevice absDevice = absScreen.getDevice();
capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLDrawableFactory.getDesktopFactory(), absDevice);
- return new WindowsWGLGraphicsConfiguration( absScreen, capsChosen, capsReq, (GLCapabilitiesChooser)chooser );
+ return new WindowsWGLGraphicsConfiguration( absScreen, capsChosen, capsReq, chooser );
}
protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(WindowsWGLDrawableFactory factory, AbstractGraphicsDevice device) {
@@ -168,7 +168,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
final int pfdIDCount = WindowsWGLGraphicsConfiguration.wglARBPFDIDCount((WindowsWGLContext)sharedResource.getContext(), hdc);
final int[] pformats = WindowsWGLGraphicsConfiguration.wglAllARBPFDIDs(pfdIDCount);
return WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats,
- GLGraphicsConfigurationUtil.ALL_BITS & ~GLGraphicsConfigurationUtil.BITMAP_BIT); // w/o BITMAP
+ GLGraphicsConfigurationUtil.ALL_BITS & ~GLGraphicsConfigurationUtil.BITMAP_BIT, false); // w/o BITMAP
}
private static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesGDI(AbstractGraphicsDevice device, GLProfile glProfile, long hdc, boolean bitmapOnly) {
@@ -338,7 +338,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
if(DEBUG) {
System.err.println("updateGraphicsConfigurationARB: hdc "+toHexString(hdc)+", pfdIDCount(hdc) "+pfdIDCount+", capsChosen "+capsChosen+", "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString());
- System.err.println("isOpaque "+isOpaque+" (translucency requested: "+(!capsChosen.isBackgroundOpaque())+", compositioning enabled: "+GDI.DwmIsCompositionEnabled()+")");
+ System.err.println("\tisOpaque "+isOpaque+" (translucency requested: "+(!capsChosen.isBackgroundOpaque())+", compositioning enabled: "+GDI.DwmIsCompositionEnabled()+")");
+ final int pformatsNum = null != pformats ? pformats.length : -1;
+ System.err.println("\textHDC "+extHDC+", chooser "+(null!=chooser)+", pformatsNum "+pformatsNum);
}
if(0 >= pfdIDCount) {
@@ -365,7 +367,6 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
pixelFormatCaps = (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(pixelFormatCaps, isOpaque);
} else {
int recommendedIndex = -1; // recommended index
-
if(null == pformats) {
// No given PFD IDs
//
@@ -406,9 +407,10 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
return false;
}
}
+ final boolean skipCapsChooser = 0 <= recommendedIndex && null == chooser && capsChosen.isBackgroundOpaque(); // fast path: skip choosing if using recommended idx and null chooser is used and if not translucent
- List<GLCapabilitiesImmutable> availableCaps =
- WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats, winattrbits);
+ final List<GLCapabilitiesImmutable> availableCaps =
+ WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats, winattrbits, skipCapsChooser /* onlyFirstValid */);
if( null == availableCaps || 0 == availableCaps.size() ) {
if (DEBUG) {
@@ -420,14 +422,19 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
if (DEBUG) {
System.err.println("updateGraphicsConfigurationARB: " + pformats.length +
- " pfd ids, " + GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString() + ", " + availableCaps.size() + " glcaps");
+ " pfd ids, skipCapsChooser " + skipCapsChooser + ", " + GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString() + ", " + availableCaps.size() + " glcaps");
if(0 <= recommendedIndex) {
System.err.println("updateGraphicsConfigurationARB: Used wglChoosePixelFormatARB to recommend pixel format " +
pformats[recommendedIndex] + ", idx " + recommendedIndex +", "+availableCaps.get(recommendedIndex));
}
}
- int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
+ final int chosenIndex;
+ if( skipCapsChooser ) {
+ chosenIndex = recommendedIndex;
+ } else {
+ chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
+ }
if ( 0 > chosenIndex ) {
if (DEBUG) {
Thread.dumpStack();
@@ -438,12 +445,12 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
if( null == pixelFormatCaps) {
throw new GLException("Null Capabilities with "+
" chosen pfdID: native recommended "+ (recommendedIndex+1) +
- " chosen idx "+chosenIndex);
+ " chosen idx "+chosenIndex+", skipCapsChooser "+skipCapsChooser);
}
pixelFormatCaps = (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(pixelFormatCaps, isOpaque);
if (DEBUG) {
System.err.println("chosen pfdID (ARB): native recommended "+ (recommendedIndex+1) +
- " chosen "+pixelFormatCaps);
+ " chosen "+pixelFormatCaps+", skipCapsChooser "+skipCapsChooser);
}
}
@@ -457,7 +464,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
private static boolean updateGraphicsConfigurationGDI(WindowsWGLGraphicsConfiguration config, CapabilitiesChooser chooser, long hdc,
boolean extHDC, int[] pformats) {
- GLCapabilitiesImmutable capsChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+ final GLCapabilitiesImmutable capsChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
if( !capsChosen.isOnscreen() && capsChosen.isPBuffer() ) {
if (DEBUG) {
System.err.println("updateGraphicsConfigurationGDI: no pbuffer supported on GDI: " + capsChosen);
@@ -470,27 +477,28 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen);
if(DEBUG) {
- System.err.println("updateGraphicsConfigurationGDI: capsChosen "+capsChosen+", "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrmask).toString());
+ System.err.println("updateGraphicsConfigurationGDI: hdc "+toHexString(hdc)+", capsChosen "+capsChosen+", "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrmask).toString());
+ final int pformatsNum = null != pformats ? pformats.length : -1;
+ System.err.println("\textHDC "+extHDC+", chooser "+(null!=chooser)+", pformatsNum "+pformatsNum);
}
- AbstractGraphicsDevice device = config.getScreen().getDevice();
- int pfdID; // chosen or preset PFD ID
+ final AbstractGraphicsDevice device = config.getScreen().getDevice();
WGLGLCapabilities pixelFormatCaps = null; // chosen or preset PFD ID's caps
boolean pixelFormatSet = false; // indicates a preset PFD ID [caps]
-
- if ( !extHDC && 1 <= ( pfdID = WGLUtil.GetPixelFormat(hdc) ) ) {
+ final int presetPFDID = extHDC ? -1 : WGLUtil.GetPixelFormat(hdc) ;
+ if ( 1 <= presetPFDID ) {
// Pixelformat already set by either
// - a previous preselectGraphicsConfiguration() call on the same HDC,
// - the graphics driver, copying the HDC's pixelformat to the new one,
// - or the Java2D/OpenGL pipeline's configuration
if (DEBUG) {
System.err.println("updateGraphicsConfigurationGDI: NOTE: pixel format already chosen for HDC: " + toHexString(hdc)
- + ", pixelformat " + pfdID);
+ + ", pixelformat " + presetPFDID);
}
pixelFormatSet = true;
- pixelFormatCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pfdID, winattrmask);
+ pixelFormatCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, presetPFDID, winattrmask);
if(null == pixelFormatCaps) {
- throw new GLException("Could not map PFD2GLCaps w/ already chosen pfdID "+pfdID);
+ throw new GLException("Could not map PFD2GLCaps w/ already chosen pfdID "+presetPFDID);
}
} else {
final boolean givenPFormats = null != pformats;
@@ -498,43 +506,77 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
pformats = WindowsWGLGraphicsConfiguration.wglAllGDIPFIDs(hdc);
}
- List<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>();
- for (int i = 0; i < pformats.length; i++) {
- final WGLGLCapabilities caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pformats[i], winattrmask);
- if(null != caps) {
- availableCaps.add(caps);
- if(DEBUG) {
- final int j = availableCaps.size() - 1;
- System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> "+j+"]: "+caps);
- }
- } else if(DEBUG) {
- GLCapabilitiesImmutable skipped = WindowsWGLGraphicsConfiguration.PFD2GLCapabilitiesNoCheck(device, glProfile, hdc, pformats[i]);
- System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> skip]: pfdID "+pformats[i]+", "+skipped);
- }
- }
-
// 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice
+ final List<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>();
PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(capsChosen, pfd);
- pfdID = WGLUtil.ChoosePixelFormat(hdc, pfd);
+ int chosenPFDID = WGLUtil.ChoosePixelFormat(hdc, pfd);
int recommendedIndex = -1 ;
- if( 1 <= pfdID ) {
+ final boolean skipCapsChooser;
+ if( 1 <= chosenPFDID ) {
+ final boolean _skipCapsChooser = null == chooser && capsChosen.isBackgroundOpaque(); // fast path: skip choosing if using recommended idx and null chooser is used and if not translucent
// seek index .. in all formats _or_ in given formats!
- for (recommendedIndex = availableCaps.size() - 1 ;
- 0 <= recommendedIndex && pfdID != ((WGLGLCapabilities) availableCaps.get(recommendedIndex)).getPFDID();
- recommendedIndex--)
- { /* nop */ }
- if(DEBUG && 0 > recommendedIndex) {
- final GLCapabilitiesImmutable reqPFDCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilitiesNoCheck(device, glProfile, pfd, pfdID);
- final GLCapabilitiesImmutable chosenCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pfdID, winattrmask);
- System.err.println("Chosen PFDID "+pfdID+", but not found in available caps (use given pfdIDs "+givenPFormats+", reqPFDCaps "+reqPFDCaps+", chosenCaps: "+chosenCaps);
+ int chosenIdx;
+ for (chosenIdx = pformats.length - 1 ; 0 <= chosenIdx && chosenPFDID != pformats[chosenIdx]; chosenIdx--) { /* nop */ }
+ if( 0 <= chosenIdx ) {
+ if( _skipCapsChooser ) {
+ final WGLGLCapabilities caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, chosenPFDID, winattrmask);
+ availableCaps.add(caps);
+ recommendedIndex = 0;
+ skipCapsChooser = true;
+ } else {
+ skipCapsChooser = false;
+ }
+ if( DEBUG ) {
+ System.err.println("Chosen PFDID "+chosenPFDID+" (idx "+chosenIdx+") -> recommendedIndex "+recommendedIndex+", skipCapsChooser "+skipCapsChooser);
+ }
+ } else {
+ if(DEBUG) {
+ final GLCapabilitiesImmutable reqPFDCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilitiesNoCheck(device, glProfile, pfd, chosenPFDID);
+ final GLCapabilitiesImmutable chosenCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, chosenPFDID, winattrmask);
+ System.err.println("Chosen PFDID "+chosenPFDID+" (idx "+chosenIdx+"), but not found in available caps (use given pfdIDs "+givenPFormats+", reqPFDCaps "+reqPFDCaps+", chosenCaps: "+chosenCaps);
+ }
+ chosenPFDID = 0; // not found in pformats -> clear
+ skipCapsChooser = false;
}
+ } else {
+ skipCapsChooser = false;
}
if (DEBUG) {
- System.err.println("updateGraphicsConfigurationGDI: ChoosePixelFormat(HDC " + toHexString(hdc) + ") = pfdID " + pfdID + ", idx " + recommendedIndex + " (LastError: " + GDI.GetLastError() + ")");
+ System.err.println("updateGraphicsConfigurationGDI: ChoosePixelFormat(HDC " + toHexString(hdc) + ") = pfdID " + chosenPFDID + ", skipCapsChooser "+skipCapsChooser+", idx " + recommendedIndex + " (LastError: " + GDI.GetLastError() + ")");
+ }
+
+ if( !skipCapsChooser ) {
+ for (int i = 0; i < pformats.length; i++) {
+ final int pfdid = pformats[i];
+ final WGLGLCapabilities caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pfdid, winattrmask);
+ if(null != caps) {
+ availableCaps.add(caps);
+ if(DEBUG) {
+ final int j = availableCaps.size() - 1;
+ System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> "+j+"]: "+caps);
+ }
+ } else if(DEBUG) {
+ GLCapabilitiesImmutable skipped = WindowsWGLGraphicsConfiguration.PFD2GLCapabilitiesNoCheck(device, glProfile, hdc, pformats[i]);
+ System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> skip]: pfdID "+pformats[i]+", "+skipped);
+ }
+ }
+ // seek recommendedIndex in all _or_ given formats!
+ if( 1 <= chosenPFDID && 0 > recommendedIndex) {
+ for (recommendedIndex = availableCaps.size() - 1 ;
+ 0 <= recommendedIndex && chosenPFDID != ((WGLGLCapabilities) availableCaps.get(recommendedIndex)).getPFDID();
+ recommendedIndex--)
+ { /* nop */ }
+ }
}
+
// 2nd choice: if no preferred recommendedIndex available
- int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
+ final int chosenIndex;
+ if( skipCapsChooser ) {
+ chosenIndex = recommendedIndex;
+ } else {
+ chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
+ }
if ( 0 > chosenIndex ) {
if (DEBUG) {
System.err.println("updateGraphicsConfigurationGDI: failed, return false");
@@ -544,7 +586,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
pixelFormatCaps = (WGLGLCapabilities) availableCaps.get(chosenIndex);
if (DEBUG) {
- System.err.println("chosen pfdID (GDI): chosenIndex "+ chosenIndex + ", caps " + pixelFormatCaps +
+ System.err.println("chosen pfdID (GDI): recommendedIndex "+recommendedIndex+" -> chosenIndex "+ chosenIndex + ", skipCapsChooser "+skipCapsChooser+", caps " + pixelFormatCaps +
" (" + WGLGLCapabilities.PFD2String(pixelFormatCaps.getPFD(), pixelFormatCaps.getPFDID()) +")");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
index 9b7b0f5..ff9363c 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
@@ -51,7 +51,6 @@ import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
-import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLContextShareSet;
import com.jogamp.common.nio.Buffers;
@@ -114,7 +113,7 @@ public class X11ExternalGLXContext extends X11GLXContext {
}
@Override
- protected boolean createImpl(GLContextImpl shareWith) {
+ protected boolean createImpl(final long shareWithHandle) {
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 10f21f0..94620c4 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -283,7 +283,7 @@ public class X11GLXContext extends GLContextImpl {
}
@Override
- protected boolean createImpl(GLContextImpl shareWith) {
+ protected boolean createImpl(final long shareWithHandle) {
boolean direct = true; // try direct always
isDirect = false; // fall back
@@ -293,15 +293,8 @@ public class X11GLXContext extends GLContextImpl {
final X11GLXContext sharedContext = (X11GLXContext) factory.getOrCreateSharedContext(device);
long display = device.getHandle();
- final long share;
- if ( null != shareWith ) {
- share = shareWith.getHandle();
- if (share == 0) {
- throw new GLException("GLContextShareSet returned an invalid OpenGL context");
- }
- direct = GLX.glXIsDirect(display, share);
- } else {
- share = 0;
+ if ( 0 != shareWithHandle ) {
+ direct = GLX.glXIsDirect(display, shareWithHandle);
}
final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
@@ -313,7 +306,7 @@ public class X11GLXContext extends GLContextImpl {
if(glp.isGL3()) {
throw new GLException(getThreadName()+": Unable to create OpenGL >= 3.1 context");
}
- contextHandle = GLX.glXCreateContext(display, config.getXVisualInfo(), share, direct);
+ contextHandle = GLX.glXCreateContext(display, config.getXVisualInfo(), shareWithHandle, direct);
if ( 0 == contextHandle ) {
throw new GLException(getThreadName()+": Unable to create context(0)");
}
@@ -325,7 +318,7 @@ public class X11GLXContext extends GLContextImpl {
}
isDirect = GLX.glXIsDirect(display, contextHandle);
if (DEBUG) {
- System.err.println(getThreadName() + ": createContextImpl: OK (old-1) share "+share+", direct "+isDirect+"/"+direct);
+ System.err.println(getThreadName() + ": createContextImpl: OK (old-1) share "+toHexString(shareWithHandle)+", direct "+isDirect+"/"+direct);
}
return true;
}
@@ -334,10 +327,10 @@ public class X11GLXContext extends GLContextImpl {
// utilize the shared context's GLXExt in case it was using the ARB method and it already exists
if( null != sharedContext && sharedContext.isCreatedWithARBMethod() ) {
- contextHandle = createContextARB(share, direct);
+ contextHandle = createContextARB(shareWithHandle, direct);
createContextARBTried = true;
if ( DEBUG && 0 != contextHandle ) {
- System.err.println(getThreadName() + ": createContextImpl: OK (ARB, using sharedContext) share "+share);
+ System.err.println(getThreadName() + ": createContextImpl: OK (ARB, using sharedContext) share "+toHexString(shareWithHandle));
}
}
@@ -345,7 +338,7 @@ public class X11GLXContext extends GLContextImpl {
if( 0 == contextHandle ) {
// To use GLX_ARB_create_context, we have to make a temp context current,
// so we are able to use GetProcAddress
- temp_ctx = GLX.glXCreateNewContext(display, config.getFBConfig(), GLX.GLX_RGBA_TYPE, share, direct);
+ temp_ctx = GLX.glXCreateNewContext(display, config.getFBConfig(), GLX.GLX_RGBA_TYPE, shareWithHandle, direct);
if ( 0 == temp_ctx ) {
throw new GLException(getThreadName()+": Unable to create temp OpenGL context(1)");
}
@@ -360,17 +353,17 @@ public class X11GLXContext extends GLContextImpl {
final boolean isExtARBCreateContextAvailable = isExtensionAvailable("GLX_ARB_create_context");
if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) {
// initial ARB context creation
- contextHandle = createContextARB(share, direct);
+ contextHandle = createContextARB(shareWithHandle, direct);
createContextARBTried=true;
if (DEBUG) {
if( 0 != contextHandle ) {
- System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+share);
+ System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+toHexString(shareWithHandle));
} else {
- System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+share);
+ System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+toHexString(shareWithHandle));
}
}
} else if (DEBUG) {
- System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+share+
+ System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+
", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
}
}
@@ -404,7 +397,7 @@ public class X11GLXContext extends GLContextImpl {
throw new GLException(getThreadName()+": Error making context(1) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable);
}
if (DEBUG) {
- System.err.println(getThreadName() + ": createContextImpl: OK (old-2) share "+share);
+ System.err.println(getThreadName() + ": createContextImpl: OK (old-2) share "+toHexString(shareWithHandle));
}
}
isDirect = GLX.glXIsDirect(display, contextHandle);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 78e5495..f7938f4 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -137,7 +137,10 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected final void destroy() {
+ protected final void shutdownImpl() {
+ if( DEBUG ) {
+ System.err.println("X11GLXDrawableFactory.shutdown");
+ }
if(null != sharedResourceRunner) {
sharedResourceRunner.stop();
sharedResourceRunner = null;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
index 4d1ed39..ee3e1a3 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -34,6 +34,8 @@
package jogamp.opengl.x11.glx;
import java.nio.IntBuffer;
+import java.util.ArrayList;
+import java.util.List;
import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.GraphicsConfigurationFactory;
@@ -61,7 +63,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implements Cloneable {
public static final int MAX_ATTRIBS = 128;
- private GLCapabilitiesChooser chooser;
+ private final GLCapabilitiesChooser chooser;
X11GLXGraphicsConfiguration(X11GraphicsScreen screen,
X11GLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
@@ -274,15 +276,47 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
}
return renderPictFmt.getDirect();
}
+ static XRenderDirectFormat XVisual2XRenderMask(long dpy, long visual, XRenderPictFormat dest) {
+ if( !X11Lib.XRenderFindVisualFormat(dpy, visual, dest) ) {
+ return null;
+ } else {
+ return dest.getDirect();
+ }
+ }
+
+ static X11GLCapabilities GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final long fbcfg,
+ final int winattrmask, final boolean isMultisampleAvailable) {
+ final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
+ final XRenderPictFormat xRenderPictFormat= XRenderPictFormat.create();
+ return GLXFBConfig2GLCapabilities(device, glp, fbcfg, winattrmask, isMultisampleAvailable, tmp, xRenderPictFormat);
+ }
- static X11GLCapabilities GLXFBConfig2GLCapabilities(X11GraphicsDevice device, GLProfile glp, long fbcfg,
- int winattrmask, boolean isMultisampleAvailable) {
+ static List<GLCapabilitiesImmutable> GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final PointerBuffer fbcfgsL,
+ final int winattrmask, final boolean isMultisampleAvailable, boolean onlyFirstValid) {
+ final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
+ final XRenderPictFormat xRenderPictFormat= XRenderPictFormat.create();
+ final List<GLCapabilitiesImmutable> result = new ArrayList<GLCapabilitiesImmutable>();
+ for (int i = 0; i < fbcfgsL.limit(); i++) {
+ final long fbcfg = fbcfgsL.get(i);
+ final GLCapabilitiesImmutable c = GLXFBConfig2GLCapabilities(device, glp, fbcfg, winattrmask, isMultisampleAvailable, tmp, xRenderPictFormat);
+ if( null != c ) {
+ result.add(c);
+ if( onlyFirstValid ) {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+ static X11GLCapabilities GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final long fbcfg,
+ final int winattrmask, final boolean isMultisampleAvailable,
+ final IntBuffer tmp, final XRenderPictFormat xRenderPictFormat) {
+ final long display = device.getHandle();
final int allDrawableTypeBits = FBCfgDrawableTypeBits(device, fbcfg);
int drawableTypeBits = winattrmask & allDrawableTypeBits;
- final long display = device.getHandle();
- int fbcfgid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg);
- XVisualInfo visualInfo = GLX.glXGetVisualFromFBConfig(display, fbcfg);
+ final int fbcfgid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg);
+ final XVisualInfo visualInfo = GLX.glXGetVisualFromFBConfig(display, fbcfg);
if(null == visualInfo) {
if(DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities: Null XVisualInfo for FBConfigID 0x" + Integer.toHexString(fbcfgid));
@@ -290,51 +324,87 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
// onscreen must have an XVisualInfo
drawableTypeBits &= ~(GLGraphicsConfigurationUtil.WINDOW_BIT | GLGraphicsConfigurationUtil.FBO_BIT);
}
-
if( 0 == drawableTypeBits ) {
- return null;
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities: zero drawablebits: winattrmask: "+toHexString(winattrmask)+", offscreen "+(null == visualInfo));
+ }
+ return null;
}
- final IntBuffer tmp = Buffers.newDirectIntBuffer(1);
if(GLX.GLX_BAD_ATTRIBUTE == GLX.glXGetFBConfigAttrib(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp)) {
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities: FBConfig invalid (1): fbcfg: "+toHexString(fbcfg));
+ }
return null;
}
if( 0 == ( GLX.GLX_RGBA_BIT & tmp.get(0) ) ) {
- return null; // no RGBA -> color index not supported
+ // no RGBA -> color index not supported
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities: FBConfig not RGBA (2): fbcfg: "+toHexString(fbcfg));
+ }
+ return null;
}
- final X11GLCapabilities res = new X11GLCapabilities(visualInfo, fbcfg, fbcfgid, glp);
- if (isMultisampleAvailable) {
- res.setSampleBuffers(glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLE_BUFFERS, tmp) != 0);
- res.setNumSamples (glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLES, tmp));
- }
+ final X11GLCapabilities caps = new X11GLCapabilities(visualInfo, fbcfg, fbcfgid, glp);
+
final XRenderDirectFormat xrmask = ( null != visualInfo ) ?
- XVisual2XRenderMask( display, visualInfo.getVisual() ) :
+ XVisual2XRenderMask( display, visualInfo.getVisual(), xRenderPictFormat) :
null ;
+
+ final int _attributes[] = {
+ GLX.GLX_SAMPLE_BUFFERS,
+ GLX.GLX_SAMPLES,
+ GLX.GLX_DOUBLEBUFFER,
+ GLX.GLX_STEREO,
+ GLX.GLX_CONFIG_CAVEAT,
+ GLX.GLX_RED_SIZE,
+ GLX.GLX_GREEN_SIZE,
+ GLX.GLX_BLUE_SIZE,
+ GLX.GLX_ALPHA_SIZE,
+ GLX.GLX_ACCUM_RED_SIZE,
+ GLX.GLX_ACCUM_GREEN_SIZE,
+ GLX.GLX_ACCUM_BLUE_SIZE,
+ GLX.GLX_ACCUM_ALPHA_SIZE,
+ GLX.GLX_DEPTH_SIZE,
+ GLX.GLX_STENCIL_SIZE
+ };
+ final int offset = isMultisampleAvailable ? 0 : 2;
+ final IntBuffer attributes = Buffers.newDirectIntBuffer(_attributes);
+ attributes.position(offset);
+ final IntBuffer values = Buffers.newDirectIntBuffer(attributes.remaining());
+ final int err = GLX.glXGetFBConfigAttributes(display, fbcfg, attributes, values);
+ if (0 != err) {
+ throw new GLException("glXGetFBConfig("+toHexString(attributes.get(offset+values.get(0)))+") failed: error code " + glXGetFBConfigErrorCode(err));
+ }
+ int j=0;
+ if (isMultisampleAvailable) {
+ caps.setSampleBuffers(values.get(j++) != 0);
+ caps.setNumSamples (values.get(j++));
+ }
final int alphaMask = ( null != xrmask ) ? xrmask.getAlphaMask() : 0;
- res.setBackgroundOpaque( 0 >= alphaMask );
- if( !res.isBackgroundOpaque() ) {
- res.setTransparentRedValue(xrmask.getRedMask());
- res.setTransparentGreenValue(xrmask.getGreenMask());
- res.setTransparentBlueValue(xrmask.getBlueMask());
- res.setTransparentAlphaValue(alphaMask);
+ caps.setBackgroundOpaque( 0 >= alphaMask );
+ if( !caps.isBackgroundOpaque() ) {
+ caps.setTransparentRedValue(xrmask.getRedMask());
+ caps.setTransparentGreenValue(xrmask.getGreenMask());
+ caps.setTransparentBlueValue(xrmask.getBlueMask());
+ caps.setTransparentAlphaValue(alphaMask);
}
// ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples)
- res.setDoubleBuffered(glXGetFBConfig(display, fbcfg, GLX.GLX_DOUBLEBUFFER, tmp) != 0);
- res.setStereo (glXGetFBConfig(display, fbcfg, GLX.GLX_STEREO, tmp) != 0);
- res.setHardwareAccelerated(glXGetFBConfig(display, fbcfg, GLX.GLX_CONFIG_CAVEAT, tmp) != GLX.GLX_SLOW_CONFIG);
- res.setRedBits (glXGetFBConfig(display, fbcfg, GLX.GLX_RED_SIZE, tmp));
- res.setGreenBits (glXGetFBConfig(display, fbcfg, GLX.GLX_GREEN_SIZE, tmp));
- res.setBlueBits (glXGetFBConfig(display, fbcfg, GLX.GLX_BLUE_SIZE, tmp));
- res.setAlphaBits (glXGetFBConfig(display, fbcfg, GLX.GLX_ALPHA_SIZE, tmp));
- res.setAccumRedBits (glXGetFBConfig(display, fbcfg, GLX.GLX_ACCUM_RED_SIZE, tmp));
- res.setAccumGreenBits(glXGetFBConfig(display, fbcfg, GLX.GLX_ACCUM_GREEN_SIZE, tmp));
- res.setAccumBlueBits (glXGetFBConfig(display, fbcfg, GLX.GLX_ACCUM_BLUE_SIZE, tmp));
- res.setAccumAlphaBits(glXGetFBConfig(display, fbcfg, GLX.GLX_ACCUM_ALPHA_SIZE, tmp));
- res.setDepthBits (glXGetFBConfig(display, fbcfg, GLX.GLX_DEPTH_SIZE, tmp));
- res.setStencilBits (glXGetFBConfig(display, fbcfg, GLX.GLX_STENCIL_SIZE, tmp));
-
- return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
+ caps.setDoubleBuffered(values.get(j++) != 0);
+ caps.setStereo (values.get(j++) != 0);
+ caps.setHardwareAccelerated(values.get(j++) != GLX.GLX_SLOW_CONFIG);
+ caps.setRedBits (values.get(j++));
+ caps.setGreenBits (values.get(j++));
+ caps.setBlueBits (values.get(j++));
+ caps.setAlphaBits (values.get(j++));
+ caps.setAccumRedBits (values.get(j++));
+ caps.setAccumGreenBits(values.get(j++));
+ caps.setAccumBlueBits (values.get(j++));
+ caps.setAccumAlphaBits(values.get(j++));
+ caps.setDepthBits (values.get(j++));
+ caps.setStencilBits (values.get(j++));
+
+ return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps);
}
private static String glXGetFBConfigErrorCode(int err) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 6050dab..1f92960 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -287,33 +287,36 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
final IntBuffer attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, true, isMultisampleAvailable, display, screen);
final IntBuffer count = Buffers.newDirectIntBuffer(1);
count.put(0, -1);
- List<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>();
final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen);
+ List<GLCapabilitiesImmutable> availableCaps;
// 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice,
// skipped if xvisualID is given
+ final boolean hasGLXChosenCaps;
if( VisualIDHolder.VID_UNDEFINED == xvisualID ) {
fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count);
+ hasGLXChosenCaps = fbcfgsL != null && fbcfgsL.limit()>0;
+ } else {
+ hasGLXChosenCaps = false;
}
- if (fbcfgsL != null && fbcfgsL.limit()>0) {
- for (int i = 0; i < fbcfgsL.limit(); i++) {
- final GLCapabilitiesImmutable caps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glProfile, fbcfgsL.get(i), winattrmask, isMultisampleAvailable);
- if( null != caps ) {
- availableCaps.add(caps);
- } else if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: FBConfig invalid (1): ("+x11Screen+","+capsChosen+"): fbcfg: "+toHexString(fbcfgsL.get(i)));
- }
- }
+ final boolean useRecommendedIndex = hasGLXChosenCaps && capsChosen.isBackgroundOpaque(); // only use recommended idx if not translucent
+ final boolean skipCapsChooser = null == chooser && useRecommendedIndex; // fast path: skip choosing if using recommended idx and null chooser is used
+ if (hasGLXChosenCaps) {
+ availableCaps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glProfile, fbcfgsL, winattrmask, isMultisampleAvailable, skipCapsChooser /* onlyFirstValid */);
if(availableCaps.size() > 0) {
- recommendedIndex = capsChosen.isBackgroundOpaque() ? 0 : -1; // only use recommended idx if not translucent
+ recommendedIndex = useRecommendedIndex ? 0 : -1;
if (DEBUG) {
System.err.println("glXChooseFBConfig recommended fbcfg " + toHexString(fbcfgsL.get(0)) + ", idx " + recommendedIndex);
+ System.err.println("useRecommendedIndex "+useRecommendedIndex+", skipCapsChooser "+skipCapsChooser);
System.err.println("user caps " + capsChosen);
- System.err.println("fbcfg caps " + availableCaps.get(0));
+ System.err.println("fbcfg caps " + fbcfgsL.limit()+", availCaps "+availableCaps.get(0));
}
} else if (DEBUG) {
System.err.println("glXChooseFBConfig no caps for recommended fbcfg " + toHexString(fbcfgsL.get(0)));
+ System.err.println("useRecommendedIndex "+useRecommendedIndex+", skipCapsChooser "+skipCapsChooser);
System.err.println("user caps " + capsChosen);
}
+ } else {
+ availableCaps = new ArrayList<GLCapabilitiesImmutable>();
}
// 2nd choice: get all GLCapabilities available, no preferred recommendedIndex available
@@ -328,15 +331,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
}
return null;
}
-
- for (int i = 0; i < fbcfgsL.limit(); i++) {
- final GLCapabilitiesImmutable caps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glProfile, fbcfgsL.get(i), winattrmask, isMultisampleAvailable);
- if( null != caps ) {
- availableCaps.add(caps);
- } else if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: FBConfig invalid (2): ("+x11Screen+"): fbcfg: "+toHexString(fbcfgsL.get(i)));
- }
- }
+ availableCaps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glProfile, fbcfgsL, winattrmask, isMultisampleAvailable, false /* onlyOneValid */);
}
if(DEBUG) {
@@ -346,9 +341,9 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
}
}
- if( VisualIDHolder.VID_UNDEFINED != xvisualID ) {
+ if( VisualIDHolder.VID_UNDEFINED != xvisualID ) { // implies !hasGLXChosenCaps
for(int i=0; i<availableCaps.size(); ) {
- VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i);
+ final VisualIDHolder vidh = availableCaps.get(i);
if(vidh.getVisualID(VIDType.X11_XVISUAL) != xvisualID ) {
availableCaps.remove(i);
} else {
@@ -365,7 +360,12 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
}
}
- int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
+ final int chosenIndex;
+ if( skipCapsChooser && 0 <= recommendedIndex ) {
+ chosenIndex = recommendedIndex;
+ } else {
+ chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
+ }
if ( 0 > chosenIndex ) {
if (DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: failed, return null");
@@ -445,7 +445,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if( VisualIDHolder.VID_UNDEFINED != xvisualID ) {
for(int i=0; i<availableCaps.size(); ) {
- VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i);
+ VisualIDHolder vidh = availableCaps.get(i);
if(vidh.getVisualID(VIDType.X11_XVISUAL) != xvisualID ) {
availableCaps.remove(i);
} else {
diff --git a/src/jogl/native/libav/ffmpeg_impl_template.c b/src/jogl/native/libav/ffmpeg_impl_template.c
index 34a2bae..44acfe4 100644
--- a/src/jogl/native/libav/ffmpeg_impl_template.c
+++ b/src/jogl/native/libav/ffmpeg_impl_template.c
@@ -846,14 +846,9 @@ JNIEXPORT void JNICALL FF_FUNC(setStream0)
pAV->frames_audio = pAV->pAStream->nb_frames;
pAV->aSinkSupport = _isAudioFormatSupported(env, pAV->ffmpegMediaPlayer, pAV->aSampleFmt, pAV->aSampleRate, pAV->aChannels);
if( pAV->verbose ) {
- fprintf(stderr, "A channels %d [l %"PRId64"], sample_rate %d, frame_size %d, frame_number %d, [afps %f, rfps %f, cfps %f, sfps %f], nb_frames %"PRId64", [maxChan %d, prefRate %d, req_chan_layout %"PRId64", req_chan %d], sink-support %d \n",
+ fprintf(stderr, "A channels %d [l %"PRId64"], sample_rate %d, frame_size %d, frame_number %d, [afps %f, cfps %f, sfps %f], nb_frames %"PRId64", [maxChan %d, prefRate %d, req_chan_layout %"PRId64", req_chan %d], sink-support %d \n",
pAV->aChannels, pAV->pACodecCtx->channel_layout, pAV->aSampleRate, pAV->aFrameSize, pAV->pACodecCtx->frame_number,
my_av_q2f(pAV->pAStream->avg_frame_rate),
- #if LIBAVCODEC_VERSION_MAJOR < 55
- my_av_q2f(pAV->pVStream->r_frame_rate),
- #else
- 0.0f,
- #endif
my_av_q2f_r(pAV->pAStream->codec->time_base),
my_av_q2f_r(pAV->pAStream->time_base),
pAV->pAStream->nb_frames,
@@ -1149,6 +1144,11 @@ JNIEXPORT jint JNICALL FF_FUNC(readNextPacket0)
pkt_odata = packet.data;
pkt_osize = packet.size;
if( AVERROR_EOF == avRes || ( pAV->pFormatCtx->pb && pAV->pFormatCtx->pb->eof_reached ) ) {
+ if( pAV->verbose ) {
+ fprintf(stderr, "EOS: avRes[res %d, eos %d], pb-EOS %d\n",
+ avRes, AVERROR_EOF == avRes,
+ ( pAV->pFormatCtx->pb && pAV->pFormatCtx->pb->eof_reached ) );
+ }
resPTS = END_OF_STREAM_PTS;
} else if( 0 <= avRes ) {
if( pAV->verbose ) {
@@ -1275,6 +1275,7 @@ JNIEXPORT jint JNICALL FF_FUNC(readNextPacket0)
pNIOBufferCurrent->nioRef = (*env)->NewGlobalRef(env, jSampleData);
pNIOBufferCurrent->origPtr = data_ptr;
pNIOBufferCurrent->size = data_size;
+ (*env)->DeleteLocalRef(env, jSampleData);
if(pAV->verbose) {
fprintf(stderr, "A NIO: Alloc ptr %p / ref %p, %d bytes\n",
pNIOBufferCurrent->origPtr, pNIOBufferCurrent->nioRef, pNIOBufferCurrent->size);
@@ -1479,15 +1480,16 @@ JNIEXPORT jint JNICALL FF_FUNC(seek0)
(JNIEnv *env, jobject instance, jlong ptr, jint pos1)
{
const FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
- const int64_t pos0 = pAV->vPTS;
- int64_t pts0;
+ int64_t pos0, pts0;
int streamID;
AVRational time_base;
if( pAV->vid >= 0 ) {
+ pos0 = pAV->vPTS;
streamID = pAV->vid;
time_base = pAV->pVStream->time_base;
pts0 = pAV->pVFrame->pkt_pts;
} else if( pAV->aid >= 0 ) {
+ pos0 = pAV->aPTS;
streamID = pAV->aid;
time_base = pAV->pAStream->time_base;
pts0 = pAV->pAFrames[pAV->aFrameCurrent]->pkt_pts;
@@ -1497,16 +1499,16 @@ JNIEXPORT jint JNICALL FF_FUNC(seek0)
int64_t pts1 = (int64_t) (pos1 * (int64_t) time_base.den)
/ (1000 * (int64_t) time_base.num);
if(pAV->verbose) {
- fprintf(stderr, "SEEK: vid %d, aid %d, pos1 %d, pts: %"PRId64" -> %"PRId64"\n", pAV->vid, pAV->aid, pos1, pts0, pts1);
+ fprintf(stderr, "SEEK: vid %d, aid %d, pos0 %d, pos1 %d, pts: %"PRId64" -> %"PRId64"\n", pAV->vid, pAV->aid, pos0, pos1, pts0, pts1);
}
int flags = 0;
if(pos1 < pos0) {
flags |= AVSEEK_FLAG_BACKWARD;
}
- int res;
+ int res = -2;
if(HAS_FUNC(sp_av_seek_frame)) {
if(pAV->verbose) {
- fprintf(stderr, "SEEK.0: pre : s %"PRId64" / %"PRId64" -> t %d / %"PRId64"\n", pos0, pts0, pos1, pts1);
+ fprintf(stderr, "SEEK.0: pre : s %d / %"PRId64" -> t %d / %"PRId64"\n", pos0, pts0, pos1, pts1);
}
sp_av_seek_frame(pAV->pFormatCtx, streamID, pts1, flags);
} else if(HAS_FUNC(sp_avformat_seek_file)) {
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
index 27275c6..aadecb4 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
@@ -40,11 +40,11 @@ import jogamp.nativewindow.awt.AWTMisc;
public class AWTWindowClosingProtocol implements WindowClosingProtocol {
- private Component comp;
- private Runnable closingOperationClose;
- private Runnable closingOperationNOP;
- private boolean closingListenerSet = false;
- private Object closingListenerLock = new Object();
+ private final Component comp;
+ private Window listenTo;
+ private final Runnable closingOperationClose;
+ private final Runnable closingOperationNOP;
+ private final Object closingListenerLock = new Object();
private WindowClosingMode defaultCloseOperation = WindowClosingMode.DISPOSE_ON_CLOSE;
private boolean defaultCloseOperationSetByUser = false;
@@ -55,6 +55,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
*/
public AWTWindowClosingProtocol(Component comp, Runnable closingOperationClose, Runnable closingOperationNOP) {
this.comp = comp;
+ this.listenTo = null;
this.closingOperationClose = closingOperationClose;
this.closingOperationNOP = closingOperationNOP;
}
@@ -86,13 +87,12 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
*/
public final boolean addClosingListener() throws IllegalStateException {
synchronized(closingListenerLock) {
- if(closingListenerSet) {
+ if(null != listenTo) {
throw new IllegalStateException("WindowClosingListener already set");
}
- final Window w = AWTMisc.getWindow(comp);
- if(null!=w) {
- w.addWindowListener(windowClosingAdapter);
- closingListenerSet = true;
+ listenTo = AWTMisc.getWindow(comp);
+ if(null!=listenTo) {
+ listenTo.addWindowListener(windowClosingAdapter);
return true;
}
}
@@ -101,13 +101,10 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
public final boolean removeClosingListener() {
synchronized(closingListenerLock) {
- if(closingListenerSet) {
- final Window w = AWTMisc.getWindow(comp);
- if(null!=w) {
- w.removeWindowListener(windowClosingAdapter);
- closingListenerSet = false;
- return true;
- }
+ if(null != listenTo) {
+ listenTo.removeWindowListener(windowClosingAdapter);
+ listenTo = null;
+ return true;
}
}
return false;
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
index a997376..9a19a7f 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -113,116 +113,153 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
this.component = (Component)comp;
this.config = (AWTGraphicsConfiguration) config;
this.jawtComponentListener = new JAWTComponentListener();
- this.component.addComponentListener(jawtComponentListener);
- this.component.addHierarchyListener(jawtComponentListener);
invalidate();
this.isApplet = false;
this.offscreenSurfaceLayer = 0;
}
+ private static String id(Object obj) { return "0x" + ( null!=obj ? Integer.toHexString(obj.hashCode()) : "nil" ); }
+ private String jawtStr() { return "JAWTWindow["+id(JAWTWindow.this)+"]"; }
+
private class JAWTComponentListener implements ComponentListener, HierarchyListener {
private boolean localVisibility = component.isVisible();
private boolean globalVisibility = localVisibility;
private boolean visibilityPropagation = false;
- private String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); }
-
+ private String str(Object obj) {
+ if( null == obj ) {
+ return "0xnil: null";
+ } else if( obj instanceof Component ) {
+ final Component c = (Component)obj;
+ return id(obj)+": "+c.getClass().getSimpleName()+"[visible "+c.isVisible()+", showing "+c.isShowing()+", valid "+c.isValid()+
+ ", displayable "+c.isDisplayable()+", "+c.getX()+"/"+c.getY()+" "+c.getWidth()+"x"+c.getHeight()+"]";
+ } else {
+ return id(obj)+": "+obj.getClass().getSimpleName()+"[..]";
+ }
+ }
private String s(ComponentEvent e) {
return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"],"+Platform.getNewline()+
- " ** COMP "+id(e.getComponent())+": "+e.getComponent()+Platform.getNewline()+
- " ** SOURCE "+id(e.getSource())+": "+e.getSource()+Platform.getNewline()+
- " ** THIS "+component;
+ " ** COMP "+str(e.getComponent())+Platform.getNewline()+
+ " ** SOURCE "+str(e.getSource())+Platform.getNewline()+
+ " ** THIS "+str(component)+Platform.getNewline()+
+ " ** THREAD "+getThreadName();
}
private String s(HierarchyEvent e) {
return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"], changeBits 0x"+Long.toHexString(e.getChangeFlags())+Platform.getNewline()+
- " ** COMP "+id(e.getComponent())+": "+e.getComponent()+Platform.getNewline()+
- " ** SOURCE "+id(e.getSource())+": "+e.getSource()+Platform.getNewline()+
- " ** CHANGED "+id(e.getChanged())+": "+e.getChanged()+Platform.getNewline()+
- " ** CHANGEDPARENT "+id(e.getChangedParent())+": "+e.getChangedParent()+Platform.getNewline()+
- " ** THIS "+component;
+ " ** COMP "+str(e.getComponent())+Platform.getNewline()+
+ " ** SOURCE "+str(e.getSource())+Platform.getNewline()+
+ " ** CHANGED "+str(e.getChanged())+Platform.getNewline()+
+ " ** CHANGEDPARENT "+str(e.getChangedParent())+Platform.getNewline()+
+ " ** THIS "+str(component)+Platform.getNewline()+
+ " ** THREAD "+getThreadName();
+ }
+ @Override
+ public final String toString() {
+ return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"],"+Platform.getNewline()+
+ " ** THIS "+str(component)+Platform.getNewline()+
+ " ** THREAD "+getThreadName();
+ }
+
+ public JAWTComponentListener() {
+ if(DEBUG) {
+ System.err.println(jawtStr()+".attach: "+toString());
+ }
+ component.addComponentListener(jawtComponentListener);
+ component.addHierarchyListener(jawtComponentListener);
+ }
+
+ public final void detach() {
+ if(DEBUG) {
+ System.err.println(jawtStr()+".detach: "+toString());
+ }
+ component.removeComponentListener(jawtComponentListener);
+ component.removeHierarchyListener(jawtComponentListener);
}
@Override
- public void componentResized(ComponentEvent e) {
+ public final void componentResized(ComponentEvent e) {
if(DEBUG) {
- System.err.println("JAWTWindow.componentResized: "+s(e));
+ System.err.println(jawtStr()+".componentResized: "+s(e));
}
layoutSurfaceLayerIfEnabled(globalVisibility && localVisibility);
}
@Override
- public void componentMoved(ComponentEvent e) {
+ public final void componentMoved(ComponentEvent e) {
if(DEBUG) {
- System.err.println("JAWTWindow.componentMoved: "+s(e));
+ System.err.println(jawtStr()+".componentMoved: "+s(e));
}
layoutSurfaceLayerIfEnabled(globalVisibility && localVisibility);
}
@Override
- public void componentShown(ComponentEvent e) {
+ public final void componentShown(ComponentEvent e) {
if(DEBUG) {
- System.err.println("JAWTWindow.componentShown: "+s(e));
+ System.err.println(jawtStr()+".componentShown: "+s(e));
}
layoutSurfaceLayerIfEnabled(globalVisibility && localVisibility);
}
@Override
- public void componentHidden(ComponentEvent e) {
+ public final void componentHidden(ComponentEvent e) {
if(DEBUG) {
- System.err.println("JAWTWindow.componentHidden: "+s(e));
+ System.err.println(jawtStr()+".componentHidden: "+s(e));
}
layoutSurfaceLayerIfEnabled(globalVisibility && localVisibility);
}
@Override
- public void hierarchyChanged(HierarchyEvent e) {
+ public final void hierarchyChanged(HierarchyEvent e) {
final long bits = e.getChangeFlags();
final java.awt.Component changed = e.getChanged();
+ final boolean compIsVisible = component.isVisible();
if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) {
final boolean displayable = changed.isDisplayable();
- final boolean propagateDisplayability = changed == component && ( displayable && localVisibility ) != component.isVisible();
+ final boolean propagateDisplayability = changed == component && ( displayable && localVisibility ) != compIsVisible;
if( propagateDisplayability ) {
// Propagate parent's displayability, i.e. 'removeNotify()' and 'addNotify()'
final boolean _visible = displayable && localVisibility;
visibilityPropagation = true;
globalVisibility = displayable;
if(DEBUG) {
- System.err.println("JAWTWindow.hierarchyChanged DISPLAYABILITY_CHANGED (1): displayable "+displayable+" -> visible "+_visible+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged DISPLAYABILITY_CHANGED (1): displayable "+displayable+" -> visible "+_visible+", "+s(e));
}
component.setVisible(_visible);
} else if(DEBUG) {
- System.err.println("JAWTWindow.hierarchyChanged DISPLAYABILITY_CHANGED (x): displayable "+displayable+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged DISPLAYABILITY_CHANGED (x): displayable "+displayable+", "+s(e));
}
} else if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) {
final boolean showing = changed.isShowing();
- final boolean propagateVisibility = changed != component && ( showing && localVisibility ) != component.isVisible();
+ final boolean propagateVisibility = changed != component && ( showing && localVisibility ) != compIsVisible;
if( propagateVisibility ) {
// Propagate parent's visibility
final boolean _visible = showing && localVisibility;
visibilityPropagation = true;
globalVisibility = showing;
if(DEBUG) {
- System.err.println("JAWTWindow.hierarchyChanged SHOWING_CHANGED (1): showing "+showing+" -> visible "+_visible+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (1): showing "+showing+" -> visible "+_visible+", "+s(e));
}
component.setVisible(_visible);
} else if( changed == component ) {
// Update component's local visibility state
if(!visibilityPropagation) {
- localVisibility = showing;
+ localVisibility = compIsVisible;
}
visibilityPropagation = false;
if(DEBUG) {
- System.err.println("JAWTWindow.hierarchyChanged SHOWING_CHANGED (0): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (0): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e));
}
} else if(DEBUG) {
- System.err.println("JAWTWindow.hierarchyChanged SHOWING_CHANGED (x): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (x): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e));
}
}
}
}
+ private static String getThreadName() { return Thread.currentThread().getName(); }
+
protected synchronized void invalidate() {
if(DEBUG) {
- System.err.println("JAWTWindow.invalidate() - "+Thread.currentThread().getName());
+ System.err.println(jawtStr()+".invalidate() - "+jawtComponentListener.toString());
if( isSurfaceLayerAttached() ) {
System.err.println("OffscreenSurfaceLayer still attached: 0x"+Long.toHexString(offscreenSurfaceLayer));
}
@@ -560,6 +597,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
public void destroy() {
surfaceLock.lock();
try {
+ jawtComponentListener.detach();
invalidate();
} finally {
surfaceLock.unlock();
@@ -702,7 +740,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("JAWT-Window[");
+ sb.append(jawtStr()+"[");
jawt2String(sb);
sb.append( ", shallUseOffscreenLayer "+shallUseOffscreenLayer+", isOffscreenLayerSurface "+isOffscreenLayerSurface+
", attachedSurfaceLayer "+toHexString(getAttachedSurfaceLayer())+
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
index 361d61c..36bf646 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
@@ -63,10 +63,10 @@ public class SWTAccessor {
private static Field swt_osx_view_id = null;
private static final String nwt;
- private static final boolean isOSX;
- private static final boolean isWindows;
- private static final boolean isX11;
- private static final boolean isX11GTK;
+ public static final boolean isOSX;
+ public static final boolean isWindows;
+ public static final boolean isX11;
+ public static final boolean isX11GTK;
// X11/GTK, Windows/GDI, ..
private static final String str_handle = "handle";
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
index 40d212d..10e3f78 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
@@ -65,13 +65,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
* @see DefaultGraphicsDevice#DefaultGraphicsDevice(String, String, int, long)
*/
public X11GraphicsDevice(long display, int unitID, boolean owner) {
- // FIXME: derive unitID from connection could be buggy, one DISPLAY for all screens for example..
- super(NativeWindowFactory.TYPE_X11, X11Lib.XDisplayString(display), unitID, display);
- if(0==display) {
- throw new NativeWindowException("null display");
- }
- handleOwner = owner;
- isXineramaEnabled = X11Util.XineramaIsEnabled(this);
+ this(display, unitID, NativeWindowFactory.getDefaultToolkitLock(NativeWindowFactory.TYPE_X11, display), owner);
}
/**
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index d74954a..f916a8e 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -50,12 +50,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* @param type
*/
public DefaultGraphicsDevice(String type, String connection, int unitID) {
- this.type = type;
- this.connection = connection;
- this.unitID = unitID;
- this.uniqueID = getUniqueID(type, connection, unitID);
- this.handle = 0;
- this.toolkitLock = NativeWindowFactory.getDefaultToolkitLock(type);
+ this(type, connection, unitID, 0, NativeWindowFactory.getDefaultToolkitLock(type));
}
/**
@@ -65,19 +60,14 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* @param handle
*/
public DefaultGraphicsDevice(String type, String connection, int unitID, long handle) {
- this.type = type;
- this.connection = connection;
- this.unitID = unitID;
- this.uniqueID = getUniqueID(type, connection, unitID);
- this.handle = handle;
- this.toolkitLock = NativeWindowFactory.getDefaultToolkitLock(type, handle);
+ this(type, connection, unitID, handle, NativeWindowFactory.getDefaultToolkitLock(type, handle));
}
/**
- * Create an instance with the given {@link ToolkitLock} instance.
+ * Create an instance with the given {@link ToolkitLock} instance, or <i>null</i> {@link ToolkitLock} if null.
* @param type
* @param handle
- * @param locker
+ * @param locker if null, a non blocking <i>null</i> lock is used.
*/
public DefaultGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) {
this.type = type;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
index db61b1e..a872e63 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
@@ -59,7 +59,10 @@ public class GDIUtil implements ToolkitProperties {
if( !initIDs0() ) {
throw new NativeWindowException("GDI: Could not initialized native stub");
}
- dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0());
+ dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0(), true /* useDummyDispatchThread */);
+ if(DEBUG) {
+ System.out.println("GDI.initSingleton() dummyWindowClassFactory "+dummyWindowClassFactory);
+ }
isInit = true;
}
}
@@ -91,7 +94,11 @@ public class GDIUtil implements ToolkitProperties {
public static long CreateDummyWindow(int x, int y, int width, int height) {
synchronized(dummyWindowSync) {
dummyWindowClass = dummyWindowClassFactory.getSharedClass();
- return CreateDummyWindow0(dummyWindowClass.getHInstance(), dummyWindowClass.getName(), dummyWindowClass.getName(), x, y, width, height);
+ if(DEBUG) {
+ System.out.println("GDI.CreateDummyWindow() dummyWindowClassFactory "+dummyWindowClassFactory);
+ System.out.println("GDI.CreateDummyWindow() dummyWindowClass "+dummyWindowClass);
+ }
+ return CreateDummyWindow0(dummyWindowClass.getHInstance(), dummyWindowClass.getName(), dummyWindowClass.getHDispThreadContext(), dummyWindowClass.getName(), x, y, width, height);
}
}
@@ -101,7 +108,7 @@ public class GDIUtil implements ToolkitProperties {
if( null == dummyWindowClass ) {
throw new InternalError("GDI Error ("+dummyWindowClassFactory.getSharedRefCount()+"): SharedClass is null");
}
- res = GDI.DestroyWindow(hwnd);
+ res = DestroyWindow0(dummyWindowClass.getHDispThreadContext(), hwnd);
dummyWindowClassFactory.releaseSharedClass();
}
return res;
@@ -119,8 +126,11 @@ public class GDIUtil implements ToolkitProperties {
return IsChild0(win);
}
- public static native boolean CreateWindowClass(long hInstance, String clazzName, long wndProc);
- public static native boolean DestroyWindowClass(long hInstance, String className);
+ private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI
+
+ static native boolean CreateWindowClass0(long hInstance, String clazzName, long wndProc);
+ static native boolean DestroyWindowClass0(long hInstance, String className, long dispThreadCtx);
+ static native long CreateDummyDispatchThread0();
private static native boolean initIDs0();
private static native long getDummyWndProc0();
@@ -128,5 +138,6 @@ public class GDIUtil implements ToolkitProperties {
private static native boolean IsChild0(long win);
private static native boolean IsUndecorated0(long win);
- static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height);
+ private static native long CreateDummyWindow0(long hInstance, String className, long dispThreadCtx, String windowName, int x, int y, int width, int height);
+ private static native boolean DestroyWindow0(long dispThreadCtx, long win);
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
index 976693e..1f6cb7c 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
@@ -29,12 +29,14 @@
package jogamp.nativewindow.windows;
public class RegisteredClass {
- long hInstance;
- String className;
+ private final long hInstance;
+ private final String className;
+ private final long hDDTCtx;
- RegisteredClass(long hInst, String name) {
- hInstance = hInst;
- className = name;
+ RegisteredClass(long hInst, String name, long hDispatchThreadCtx) {
+ this.hInstance = hInst;
+ this.className = name;
+ this.hDDTCtx = hDispatchThreadCtx;
}
/** Application handle, same as {@link RegisteredClassFactory#getHInstance()}. */
@@ -43,6 +45,9 @@ public class RegisteredClass {
/** Unique Window Class Name */
public final String getName() { return className; }
+ /** Unique associated dispatch thread context for this Window Class, or 0 for none. */
+ public final long getHDispThreadContext() { return hDDTCtx; }
+
@Override
- public final String toString() { return "RegisteredClass[handle 0x"+Long.toHexString(hInstance)+", "+className+"]"; }
+ public final String toString() { return "RegisteredClass[handle 0x"+Long.toHexString(hInstance)+", "+className+", dtx 0x"+Long.toHexString(hDDTCtx)+"]"; }
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
index e033a9f..ee41fe1 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
@@ -29,7 +29,9 @@
package jogamp.nativewindow.windows;
import jogamp.nativewindow.Debug;
+
import java.util.ArrayList;
+
import javax.media.nativewindow.NativeWindowException;
public class RegisteredClassFactory {
@@ -45,30 +47,42 @@ public class RegisteredClassFactory {
registeredFactories = new ArrayList<RegisteredClassFactory>();
}
- private String classBaseName;
- private long wndProc;
+ private final String classBaseName;
+ private final long wndProc;
+ private final boolean useDummyDispatchThread;
private RegisteredClass sharedClass = null;
private int classIter = 0;
private int sharedRefCount = 0;
private final Object sync = new Object();
+ private String toHexString(long l) { return "0x"+Long.toHexString(l); }
+
+ @Override
+ public final String toString() { return "RegisteredClassFactory[moduleHandle "+toHexString(hInstance)+", "+classBaseName+
+ ", wndProc "+toHexString(wndProc)+", useDDT "+useDummyDispatchThread+", shared[refCount "+sharedRefCount+", class "+sharedClass+"]]"; }
+
/**
* Release the {@link RegisteredClass} of all {@link RegisteredClassFactory}.
*/
public static void shutdownSharedClasses() {
synchronized(registeredFactories) {
+ if( DEBUG ) {
+ System.err.println("RegisteredClassFactory.shutdownSharedClasses: "+registeredFactories.size());
+ }
for(int j=0; j<registeredFactories.size(); j++) {
final RegisteredClassFactory rcf = registeredFactories.get(j);
synchronized(rcf.sync) {
if(null != rcf.sharedClass) {
- GDIUtil.DestroyWindowClass(rcf.sharedClass.getHInstance(), rcf.sharedClass.getName());
+ GDIUtil.DestroyWindowClass0(rcf.sharedClass.getHInstance(), rcf.sharedClass.getName(), rcf.sharedClass.getHDispThreadContext());
rcf.sharedClass = null;
rcf.sharedRefCount = 0;
rcf.classIter = 0;
if(DEBUG) {
- System.err.println("RegisteredClassFactory #"+j+"/"+registeredFactories.size()+" shutdownSharedClasses : "+rcf.sharedClass);
+ System.err.println("RegisteredClassFactory #"+j+"/"+registeredFactories.size()+": shutdownSharedClasses : "+rcf.sharedClass);
}
+ } else if(DEBUG) {
+ System.err.println("RegisteredClassFactory #"+j+"/"+registeredFactories.size()+": null");
}
}
}
@@ -78,9 +92,10 @@ public class RegisteredClassFactory {
/** Application handle. */
public static long getHInstance() { return hInstance; }
- public RegisteredClassFactory(String classBaseName, long wndProc) {
+ public RegisteredClassFactory(String classBaseName, long wndProc, boolean useDummyDispatchThread) {
this.classBaseName = classBaseName;
this.wndProc = wndProc;
+ this.useDummyDispatchThread = useDummyDispatchThread;
synchronized(registeredFactories) {
registeredFactories.add(this);
}
@@ -99,12 +114,21 @@ public class RegisteredClassFactory {
// Retry with next clazz name, this could happen if more than one JVM is running
clazzName = classBaseName + classIter;
classIter++;
- registered = GDIUtil.CreateWindowClass(hInstance, clazzName, wndProc);
+ registered = GDIUtil.CreateWindowClass0(hInstance, clazzName, wndProc);
}
if( !registered ) {
throw new NativeWindowException("Error: Could not create WindowClass: "+clazzName);
}
- sharedClass = new RegisteredClass(hInstance, clazzName);
+ final long hDispatchThread;
+ if( useDummyDispatchThread ) {
+ hDispatchThread = GDIUtil.CreateDummyDispatchThread0();
+ if( 0 == hDispatchThread ) {
+ throw new NativeWindowException("Error: Could not create DDT "+clazzName);
+ }
+ } else {
+ hDispatchThread = 0;
+ }
+ sharedClass = new RegisteredClass(hInstance, clazzName, hDispatchThread);
if(DEBUG) {
System.err.println("RegisteredClassFactory getSharedClass ("+sharedRefCount+") initialized: "+sharedClass);
}
@@ -129,7 +153,7 @@ public class RegisteredClassFactory {
throw new InternalError("Error ("+sharedRefCount+"): SharedClass is null");
}
if( 0 == sharedRefCount ) {
- GDIUtil.DestroyWindowClass(sharedClass.getHInstance(), sharedClass.getName());
+ GDIUtil.DestroyWindowClass0(sharedClass.getHInstance(), sharedClass.getName(), sharedClass.getHDispThreadContext());
if(DEBUG) {
System.err.println("RegisteredClassFactory releaseSharedClass ("+sharedRefCount+") released: "+sharedClass);
}
diff --git a/src/nativewindow/native/NativewindowCommon.c b/src/nativewindow/native/NativewindowCommon.c
index e909c04..212bdf8 100644
--- a/src/nativewindow/native/NativewindowCommon.c
+++ b/src/nativewindow/native/NativewindowCommon.c
@@ -1,6 +1,7 @@
#include "NativewindowCommon.h"
#include <string.h>
+#include <sys/time.h>
static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException";
static jclass runtimeExceptionClz=NULL;
@@ -106,3 +107,9 @@ JNIEnv* NativewindowCommon_GetJNIEnv (JavaVM * jvmHandle, int jvmVersion, int as
return curEnv;
}
+int64_t NativewindowCommon_CurrentTimeMillis() {
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ return (int64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000;
+}
+
diff --git a/src/nativewindow/native/NativewindowCommon.h b/src/nativewindow/native/NativewindowCommon.h
index a2975f3..a23fad9 100644
--- a/src/nativewindow/native/NativewindowCommon.h
+++ b/src/nativewindow/native/NativewindowCommon.h
@@ -4,6 +4,7 @@
#include <jni.h>
#include <stdlib.h>
+#include <gluegen_stdint.h>
int NativewindowCommon_init(JNIEnv *env);
@@ -15,4 +16,6 @@ void NativewindowCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, .
JNIEnv* NativewindowCommon_GetJNIEnv (JavaVM * jvmHandle, int jvmVersion, int asDaemon, int * shallBeDetached);
+int64_t NativewindowCommon_CurrentTimeMillis();
+
#endif
diff --git a/src/nativewindow/native/win32/GDImisc.c b/src/nativewindow/native/win32/GDImisc.c
index 23be473..b55988c 100644
--- a/src/nativewindow/native/win32/GDImisc.c
+++ b/src/nativewindow/native/win32/GDImisc.c
@@ -20,8 +20,10 @@
#ifdef VERBOSE_ON
#define DBG_PRINT(args...) fprintf(stderr, args);
+ #define DBG_PRINT_FLUSH(args...) fprintf(stderr, args); fflush(stderr);
#else
#define DBG_PRINT(args...)
+ #define DBG_PRINT_FLUSH(args...)
#endif
static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point";
@@ -30,6 +32,162 @@ static const char * const ClazzNamePointCstrSignature = "(II)V";
static jclass pointClz = NULL;
static jmethodID pointCstr = NULL;
+static jmethodID dumpStackID = NULL;
+
+typedef struct {
+ HANDLE threadHandle;
+ DWORD threadId;
+ volatile BOOL threadReady;
+ volatile BOOL threadDead;
+} DummyThreadContext;
+
+typedef struct {
+ HINSTANCE hInstance;
+ const TCHAR* wndClassName;
+ const TCHAR* wndName;
+ jint x;
+ jint y;
+ jint width;
+ jint height;
+ volatile HWND hWnd;
+ volatile BOOL threadReady;
+} DummyThreadCommand;
+
+#define TM_OPENWIN WM_APP+1
+#define TM_CLOSEWIN WM_APP+2
+#define TM_STOP WM_APP+3
+
+static const char * sTM_OPENWIN = "TM_OPENWIN";
+static const char * sTM_CLOSEWIN = "TM_CLOSEWIN";
+static const char * sTM_STOP = "TM_STOP";
+
+/** 3s timeout */
+static const int64_t TIME_OUT = 3000000;
+
+static jboolean DDT_CheckAlive(JNIEnv *env, const char *msg, DummyThreadContext *ctx) {
+ if( ctx->threadDead ) {
+ NativewindowCommon_throwNewRuntimeException(env, "DDT is dead at %s", msg);
+ return JNI_FALSE;
+ } else {
+ DBG_PRINT_FLUSH("*** DDT-Check ALIVE @ %s\n", msg);
+ return JNI_TRUE;
+ }
+}
+
+static jboolean DDT_WaitUntilCreated(JNIEnv *env, DummyThreadContext *ctx, BOOL created) {
+ const int64_t t0 = NativewindowCommon_CurrentTimeMillis();
+ int64_t t1 = t0;
+ if( created ) {
+ while( !ctx->threadReady && t1-t0 < TIME_OUT ) {
+ t1 = NativewindowCommon_CurrentTimeMillis();
+ }
+ if( !ctx->threadReady ) {
+ NativewindowCommon_throwNewRuntimeException(env, "TIMEOUT (%d ms) while waiting for DDT CREATED", (int)(t1-t0));
+ return JNI_FALSE;
+ }
+ DBG_PRINT_FLUSH("*** DDT-Check CREATED\n");
+ } else {
+ while( !ctx->threadDead && t1-t0 < TIME_OUT ) {
+ t1 = NativewindowCommon_CurrentTimeMillis();
+ }
+ if( !ctx->threadDead ) {
+ NativewindowCommon_throwNewRuntimeException(env, "TIMEOUT (%d ms) while waiting for DDT DESTROYED", (int)(t1-t0));
+ return JNI_FALSE;
+ }
+ DBG_PRINT_FLUSH("*** DDT-Check DEAD\n");
+ }
+ return JNI_TRUE;
+}
+
+static jboolean DDT_WaitUntilReady(JNIEnv *env, const char *msg, DummyThreadCommand *cmd) {
+ const int64_t t0 = NativewindowCommon_CurrentTimeMillis();
+ int64_t t1 = t0;
+ while( !cmd->threadReady && t1-t0 < TIME_OUT ) {
+ t1 = NativewindowCommon_CurrentTimeMillis();
+ }
+ if( !cmd->threadReady ) {
+ NativewindowCommon_throwNewRuntimeException(env, "TIMEOUT (%d ms) while waiting for DDT %s", (int)(t1-t0), msg);
+ return JNI_FALSE;
+ }
+ DBG_PRINT_FLUSH("*** DDT-Check READY @ %s\n", msg);
+ return JNI_TRUE;
+}
+
+static HWND DummyWindowCreate
+ (HINSTANCE hInstance, const TCHAR* wndClassName, const TCHAR* wndName, jint x, jint y, jint width, jint height)
+{
+ DWORD dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
+ DWORD dwStyle = WS_OVERLAPPEDWINDOW;
+ HWND hWnd = CreateWindowEx( dwExStyle,
+ wndClassName,
+ wndName,
+ dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
+ x, y, width, height,
+ NULL, NULL, hInstance, NULL );
+ return hWnd;
+}
+
+static DWORD WINAPI DummyDispatchThreadFunc(LPVOID param)
+{
+ MSG msg;
+ BOOL bRet;
+ BOOL bEOL=FALSE;
+ DummyThreadContext *threadContext = (DummyThreadContext*)param;
+
+ /* there can not be any messages for us now, as the creator waits for
+ threadReady before continuing, but we must use this PeekMessage() to
+ create the thread message queue */
+ PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
+
+ /* now we can safely say: we have a qeue and are ready to receive messages */
+ // threadContext->threadId = GetCurrentThreadId();
+ threadContext->threadDead = FALSE;
+ threadContext->threadReady = TRUE;
+
+ while( !bEOL && (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0 ) {
+ if ( -1 == bRet ) {
+ fprintf(stderr, "DummyDispatchThread (id %d): GetMessage Error %d, werr %d\n",
+ (int)threadContext->threadId, (int)bRet, (int)GetLastError());
+ fflush(stderr);
+ bEOL = TRUE;
+ break; // EOL
+ } else {
+ switch(msg.message) {
+ case TM_OPENWIN: {
+ DummyThreadCommand *tParam = (DummyThreadCommand*)msg.wParam;
+ DBG_PRINT_FLUSH("*** DDT-Dispatch OPENWIN\n");
+ tParam->hWnd = DummyWindowCreate(tParam->hInstance, tParam->wndClassName, tParam->wndName, tParam->x, tParam->y, tParam->width, tParam->height);
+ tParam->threadReady = TRUE;
+ }
+ break;
+ case TM_CLOSEWIN: {
+ DummyThreadCommand *tParam = (DummyThreadCommand*)msg.wParam;
+ DBG_PRINT_FLUSH("*** DDT-Dispatch CLOSEWIN\n");
+ DestroyWindow(tParam->hWnd);
+ tParam->threadReady = TRUE;
+ }
+ break;
+ case TM_STOP: {
+ DummyThreadCommand *tParam = (DummyThreadCommand*)msg.wParam;
+ DBG_PRINT_FLUSH("*** DDT-Dispatch STOP -> DEAD\n");
+ tParam->threadReady = TRUE;
+ bEOL = TRUE;
+ }
+ break; // EOL
+ default:
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ break;
+ }
+ }
+ }
+ /* dead */
+ DBG_PRINT_FLUSH("*** DDT-Dispatch DEAD\n");
+ threadContext->threadDead = TRUE;
+ ExitThread(0);
+ return 0;
+}
+
HINSTANCE GetApplicationHandle() {
return GetModuleHandle(NULL);
@@ -37,12 +195,49 @@ HINSTANCE GetApplicationHandle() {
/* Java->C glue code:
* Java package: jogamp.nativewindow.windows.GDIUtil
- * Java method: boolean CreateWindowClass(long hInstance, java.lang.String clazzName, long wndProc)
- * C function: BOOL CreateWindowClass(HANDLE hInstance, LPCSTR clazzName, HANDLE wndProc);
+ * Java method: long CreateDummyDispatchThread0()
+ */
+JNIEXPORT jlong JNICALL
+Java_jogamp_nativewindow_windows_GDIUtil_CreateDummyDispatchThread0
+ (JNIEnv *env, jclass _unused)
+{
+ DWORD threadId = 0;
+ DummyThreadContext * dispThreadCtx = calloc(1, sizeof(DummyThreadContext));
+
+ dispThreadCtx->threadHandle = CreateThread(NULL, 0, DummyDispatchThreadFunc, (LPVOID)dispThreadCtx, 0, &threadId);
+ if( NULL == dispThreadCtx->threadHandle || 0 == threadId ) {
+ const HANDLE threadHandle = dispThreadCtx->threadHandle;
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ NativewindowCommon_throwNewRuntimeException(env, "DDT CREATE failed handle %p, id %d, werr %d",
+ (void*)threadHandle, (int)threadId, (int)GetLastError());
+ return (jlong)0;
+ }
+ if( JNI_FALSE == DDT_WaitUntilCreated(env, dispThreadCtx, TRUE) ) {
+ const HANDLE threadHandle = dispThreadCtx->threadHandle;
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ NativewindowCommon_throwNewRuntimeException(env, "DDT CREATE (ack) failed handle %p, id %d, werr %d",
+ (void*)threadHandle, (int)threadId, (int)GetLastError());
+ return (jlong)0;
+ }
+ DBG_PRINT_FLUSH("*** DDT Created %d\n", (int)threadId);
+ dispThreadCtx->threadId = threadId;
+ return (jlong) (intptr_t) dispThreadCtx;
+}
+
+/* Java->C glue code:
+ * Java package: jogamp.nativewindow.windows.GDIUtil
+ * Java method: boolean CreateWindowClass0(long hInstance, java.lang.String clazzName, long wndProc)
+ * C function: BOOL CreateWindowClass0(HANDLE hInstance, LPCSTR clazzName, HANDLE wndProc);
*/
JNIEXPORT jboolean JNICALL
-Java_jogamp_nativewindow_windows_GDIUtil_CreateWindowClass
- (JNIEnv *env, jclass _unused, jlong jHInstance, jstring jClazzName, jlong wndProc)
+Java_jogamp_nativewindow_windows_GDIUtil_CreateWindowClass0
+ (JNIEnv *env, jclass _unused, jlong jHInstance, jstring jClazzName, jlong wndProc)
{
HINSTANCE hInstance = (HINSTANCE) (intptr_t) jHInstance;
const TCHAR* clazzName = NULL;
@@ -86,15 +281,15 @@ Java_jogamp_nativewindow_windows_GDIUtil_CreateWindowClass
/* Java->C glue code:
* Java package: jogamp.nativewindow.windows.GDIUtil
- * Java method: boolean DestroyWindowClass(long hInstance, java.lang.String className)
- * C function: BOOL DestroyWindowClass(HANDLE hInstance, LPCSTR className);
+ * Java method: boolean DestroyWindowClass0(long hInstance, java.lang.String className, long dispThreadCtx)
*/
JNIEXPORT jboolean JNICALL
-Java_jogamp_nativewindow_windows_GDIUtil_DestroyWindowClass
- (JNIEnv *env, jclass _unused, jlong jHInstance, jstring jClazzName)
+Java_jogamp_nativewindow_windows_GDIUtil_DestroyWindowClass0
+ (JNIEnv *env, jclass gdiClazz, jlong jHInstance, jstring jClazzName, jlong jDispThreadCtx)
{
HINSTANCE hInstance = (HINSTANCE) (intptr_t) jHInstance;
const TCHAR* clazzName = NULL;
+ DummyThreadContext * dispThreadCtx = (DummyThreadContext *) (intptr_t) jDispThreadCtx;
jboolean res;
#ifdef UNICODE
@@ -111,55 +306,175 @@ Java_jogamp_nativewindow_windows_GDIUtil_DestroyWindowClass
(*env)->ReleaseStringUTFChars(env, jClazzName, clazzName);
#endif
+ if( NULL != dispThreadCtx) {
+ const HANDLE threadHandle = dispThreadCtx->threadHandle;
+ const DWORD threadId = dispThreadCtx->threadId;
+ DummyThreadCommand tParam = {0};
+ tParam.threadReady = FALSE;
+ DBG_PRINT_FLUSH("*** DDT Destroy %d\n", (int)threadId);
+#ifdef VERBOSE_ON
+ (*env)->CallStaticVoidMethod(env, gdiClazz, dumpStackID);
+#endif
+
+ if( JNI_FALSE == DDT_CheckAlive(env, sTM_STOP, dispThreadCtx) ) {
+ free(dispThreadCtx);
+ NativewindowCommon_throwNewRuntimeException(env, "DDT %s (alive) failed handle %p, id %d, werr %d",
+ sTM_STOP, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ return JNI_FALSE;
+ }
+ if ( 0 != PostThreadMessage(dispThreadCtx->threadId, TM_STOP, (WPARAM)&tParam, 0) ) {
+ if( JNI_FALSE == DDT_WaitUntilReady(env, sTM_STOP, &tParam) ) {
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ NativewindowCommon_throwNewRuntimeException(env, "DDT Post %s (ack) failed handle %p, id %d, werr %d",
+ sTM_STOP, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ return JNI_FALSE;
+ }
+ if( JNI_FALSE == DDT_WaitUntilCreated(env, dispThreadCtx, FALSE) ) {
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ NativewindowCommon_throwNewRuntimeException(env, "DDT KILL %s (ack) failed handle %p, id %d, werr %d",
+ sTM_STOP, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ return JNI_FALSE;
+ }
+ free(dispThreadCtx); // free after proper DDT shutdown!
+ } else {
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ NativewindowCommon_throwNewRuntimeException(env, "DDT Post %s failed handle %p, id %d, werr %d",
+ sTM_STOP, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ return JNI_FALSE;
+ }
+ }
+
return res;
}
-
/* Java->C glue code:
* Java package: jogamp.nativewindow.windows.GDIUtil
- * Java method: long CreateDummyWindow0(long hInstance, java.lang.String className, java.lang.String windowName, int x, int y, int width, int height)
- * C function: HANDLE CreateDummyWindow0(HANDLE hInstance, LPCSTR className, LPCSTR windowName, int x, int y, int width, int height);
+ * Java method: long CreateDummyWindow0(long hInstance, java.lang.String className, jlong dispThreadCtx, java.lang.String windowName, int x, int y, int width, int height)
*/
JNIEXPORT jlong JNICALL
Java_jogamp_nativewindow_windows_GDIUtil_CreateDummyWindow0
- (JNIEnv *env, jclass _unused, jlong jHInstance, jstring jWndClassName, jstring jWndName, jint x, jint y, jint width, jint height)
+ (JNIEnv *env, jclass _unused, jlong jHInstance, jstring jWndClassName, jlong jDispThreadCtx, jstring jWndName, jint x, jint y, jint width, jint height)
{
- HINSTANCE hInstance = (HINSTANCE) (intptr_t) jHInstance;
- const TCHAR* wndClassName = NULL;
- const TCHAR* wndName = NULL;
- DWORD dwExStyle;
- DWORD dwStyle;
- HWND hWnd;
+ DummyThreadContext * dispThreadCtx = (DummyThreadContext *) (intptr_t) jDispThreadCtx;
+ DummyThreadCommand tParam = {0};
+
+ tParam.hInstance = (HINSTANCE) (intptr_t) jHInstance;
+ tParam.x = x;
+ tParam.y = y;
+ tParam.width = width;
+ tParam.height = height;
+ tParam.hWnd = 0;
+ tParam.threadReady = FALSE;
#ifdef UNICODE
- wndClassName = NewtCommon_GetNullTerminatedStringChars(env, jWndClassName);
- wndName = NewtCommon_GetNullTerminatedStringChars(env, jWndName);
+ tParam.wndClassName = NewtCommon_GetNullTerminatedStringChars(env, jWndClassName);
+ tParam.wndName = NewtCommon_GetNullTerminatedStringChars(env, jWndName);
#else
- wndClassName = (*env)->GetStringUTFChars(env, jWndClassName, NULL);
- wndName = (*env)->GetStringUTFChars(env, jWndName, NULL);
+ tParam.wndClassName = (*env)->GetStringUTFChars(env, jWndClassName, NULL);
+ tParam.wndName = (*env)->GetStringUTFChars(env, jWndName, NULL);
#endif
- dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
- dwStyle = WS_OVERLAPPEDWINDOW;
-
- hWnd = CreateWindowEx( dwExStyle,
- wndClassName,
- wndName,
- dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- x, y, width, height,
- NULL, NULL, hInstance, NULL );
+ if( NULL == dispThreadCtx ) {
+ tParam.hWnd = DummyWindowCreate(tParam.hInstance, tParam.wndClassName, tParam.wndName, tParam.x, tParam.y, tParam.width, tParam.height);
+ } else {
+ const HANDLE threadHandle = dispThreadCtx->threadHandle;
+ const DWORD threadId = dispThreadCtx->threadId;
+ if( JNI_FALSE == DDT_CheckAlive(env, sTM_OPENWIN, dispThreadCtx) ) {
+ free(dispThreadCtx);
+ NativewindowCommon_throwNewRuntimeException(env, "DDT %s (alive) failed handle %p, id %d, werr %d",
+ sTM_OPENWIN, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ } else {
+ if( 0 != PostThreadMessage(dispThreadCtx->threadId, TM_OPENWIN, (WPARAM)&tParam, 0) ) {
+ if( JNI_FALSE == DDT_WaitUntilReady(env, sTM_OPENWIN, &tParam) ) {
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ tParam.hWnd = 0;
+ NativewindowCommon_throwNewRuntimeException(env, "DDT Post %s (ack) failed handle %p, id %d, werr %d",
+ sTM_OPENWIN, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ }
+ } else {
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ tParam.hWnd = 0;
+ NativewindowCommon_throwNewRuntimeException(env, "DDT Post %s to handle %p, id %d failed, werr %d",
+ sTM_OPENWIN, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ }
+ }
+ }
#ifdef UNICODE
- free((void*) wndClassName);
- free((void*) wndName);
+ free((void*) tParam.wndClassName);
+ free((void*) tParam.wndName);
#else
- (*env)->ReleaseStringUTFChars(env, jWndClassName, wndClassName);
- (*env)->ReleaseStringUTFChars(env, jWndName, wndName);
+ (*env)->ReleaseStringUTFChars(env, jWndClassName, tParam.wndClassName);
+ (*env)->ReleaseStringUTFChars(env, jWndName, tParam.wndName);
#endif
- return (jlong) (intptr_t) hWnd;
+ return (jlong) (intptr_t) tParam.hWnd;
}
+/*
+ * Class: jogamp_nativewindow_windows_GDIUtil
+ * Method: DestroyWindow0
+ */
+JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_windows_GDIUtil_DestroyWindow0
+(JNIEnv *env, jclass unused, jlong jDispThreadCtx, jlong jwin)
+{
+ jboolean res = JNI_TRUE;
+ DummyThreadContext * dispThreadCtx = (DummyThreadContext *) (intptr_t) jDispThreadCtx;
+ HWND hWnd = (HWND) (intptr_t) jwin;
+ if( NULL == dispThreadCtx ) {
+ DestroyWindow(hWnd);
+ } else {
+ const HANDLE threadHandle = dispThreadCtx->threadHandle;
+ const DWORD threadId = dispThreadCtx->threadId;
+ DummyThreadCommand tParam = {0};
+
+ tParam.hWnd = hWnd;
+ tParam.threadReady = FALSE;
+
+ if( JNI_FALSE == DDT_CheckAlive(env, sTM_CLOSEWIN, dispThreadCtx) ) {
+ free(dispThreadCtx);
+ res = JNI_FALSE;
+ NativewindowCommon_throwNewRuntimeException(env, "DDT %s (alive) failed handle %p, id %d, werr %d",
+ sTM_CLOSEWIN, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ } else {
+ if ( 0 != PostThreadMessage(dispThreadCtx->threadId, TM_CLOSEWIN, (WPARAM)&tParam, 0) ) {
+ if( JNI_FALSE == DDT_WaitUntilReady(env, sTM_CLOSEWIN, &tParam) ) {
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ res = JNI_FALSE;
+ NativewindowCommon_throwNewRuntimeException(env, "DDT Post %s (ack) failed handle %p, id %d, werr %d",
+ sTM_CLOSEWIN, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ }
+ } else {
+ if( NULL != threadHandle ) {
+ TerminateThread(threadHandle, 0);
+ }
+ free(dispThreadCtx);
+ res = JNI_FALSE;
+ NativewindowCommon_throwNewRuntimeException(env, "DDT Post %s to handle %p, id %d failed, werr %d",
+ sTM_CLOSEWIN, (void*)threadHandle, (int)threadId, (int)GetLastError());
+ }
+ }
+ }
+ return res;
+}
/*
* Class: jogamp_nativewindow_windows_GDIUtil
@@ -167,7 +482,7 @@ Java_jogamp_nativewindow_windows_GDIUtil_CreateDummyWindow0
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_windows_GDIUtil_initIDs0
- (JNIEnv *env, jclass clazz)
+ (JNIEnv *env, jclass gdiClazz)
{
if(NativewindowCommon_init(env)) {
jclass c = (*env)->FindClass(env, ClazzNamePoint);
@@ -184,12 +499,16 @@ JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_windows_GDIUtil_initIDs0
NativewindowCommon_FatalError(env, "FatalError jogamp_nativewindow_windows_GDIUtil: can't fetch %s.%s %s",
ClazzNamePoint, ClazzAnyCstrName, ClazzNamePointCstrSignature);
}
+ dumpStackID = (*env)->GetStaticMethodID(env, gdiClazz, "dumpStack", "()V");
+ if(NULL==dumpStackID) {
+ NativewindowCommon_FatalError(env, "FatalError jogamp_nativewindow_windows_GDIUtil: can't get method dumpStack");
+ }
}
return JNI_TRUE;
}
-LRESULT CALLBACK DummyWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
- return DefWindowProc(hWnd,uMsg,wParam,lParam);
+static LRESULT CALLBACK DummyWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+ return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
/*
@@ -231,8 +550,8 @@ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_windows_GDIUtil_GetRelativeLo
JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_windows_GDIUtil_IsChild0
(JNIEnv *env, jclass unused, jlong jwin)
{
- HWND hwnd = (HWND) (intptr_t) jwin;
- LONG style = GetWindowLong(hwnd, GWL_STYLE);
+ HWND hWnd = (HWND) (intptr_t) jwin;
+ LONG style = GetWindowLong(hWnd, GWL_STYLE);
BOOL bIsChild = 0 != (style & WS_CHILD) ;
return bIsChild ? JNI_TRUE : JNI_FALSE;
}
@@ -244,8 +563,8 @@ JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_windows_GDIUtil_IsChild0
JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_windows_GDIUtil_IsUndecorated0
(JNIEnv *env, jclass unused, jlong jwin)
{
- HWND hwnd = (HWND) (intptr_t) jwin;
- LONG style = GetWindowLong(hwnd, GWL_STYLE);
+ HWND hWnd = (HWND) (intptr_t) jwin;
+ LONG style = GetWindowLong(hWnd, GWL_STYLE);
BOOL bIsUndecorated = 0 != (style & (WS_CHILD|WS_POPUP)) ;
return bIsUndecorated ? JNI_TRUE : JNI_FALSE;
}
diff --git a/src/nativewindow/native/x11/Xmisc.c b/src/nativewindow/native/x11/Xmisc.c
index 31620d7..7b9dc34 100644
--- a/src/nativewindow/native/x11/Xmisc.c
+++ b/src/nativewindow/native/x11/Xmisc.c
@@ -33,6 +33,11 @@
#include <X11/Xatom.h>
+#include <X11/extensions/Xrender.h>
+
+/** Remove memcpy GLIBC > 2.4 dependencies */
+#include <glibc-compat-symbols.h>
+
// #define VERBOSE_ON 1
#ifdef VERBOSE_ON
@@ -322,6 +327,19 @@ Java_jogamp_nativewindow_x11_X11Util_setX11ErrorHandler0(JNIEnv *env, jclass _un
/* Java->C glue code:
* Java package: jogamp.nativewindow.x11.X11Lib
+ * Java method: boolean XRenderFindVisualFormat(long dpy, long visual, XRenderPictFormat dest)
+ */
+JNIEXPORT jboolean JNICALL
+Java_jogamp_nativewindow_x11_X11Lib_XRenderFindVisualFormat1(JNIEnv *env, jclass _unused, jlong dpy, jlong visual, jobject xRenderPictFormat) {
+ XRenderPictFormat * dest = (XRenderPictFormat *) (*env)->GetDirectBufferAddress(env, xRenderPictFormat);
+ XRenderPictFormat * src = XRenderFindVisualFormat((Display *) (intptr_t) dpy, (Visual *) (intptr_t) visual);
+ if (NULL == src) return JNI_FALSE;
+ memcpy(dest, src, sizeof(XRenderPictFormat));
+ return JNI_TRUE;
+}
+
+/* Java->C glue code:
+ * Java package: jogamp.nativewindow.x11.X11Lib
* Java method: XVisualInfo XGetVisualInfo(long arg0, long arg1, XVisualInfo arg2, java.nio.IntBuffer arg3)
* C function: XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * );
*/
@@ -353,6 +371,7 @@ Java_jogamp_nativewindow_x11_X11Lib_XGetVisualInfo1__JJLjava_nio_ByteBuffer_2Lja
jbyteSource = (*env)->NewDirectByteBuffer(env, _res, count * sizeof(XVisualInfo));
jbyteCopy = (*env)->CallStaticObjectMethod(env, clazzBuffers, cstrBuffers, jbyteSource);
+ (*env)->DeleteLocalRef(env, jbyteSource);
XFree(_res);
@@ -368,7 +387,7 @@ Java_jogamp_nativewindow_x11_X11Lib_GetVisualIDFromWindow(JNIEnv *env, jclass _u
if(NULL==dpy) {
NativewindowCommon_throwNewRuntimeException(env, "invalid display connection..");
- return;
+ return 0;
}
NativewindowCommon_x11ErrorHandlerEnable(env, dpy, 0, 1, errorHandlerQuiet, 1);
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 04eb07a..5c3bb78 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -158,10 +158,21 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
void setWindowDestroyNotifyAction(Runnable r);
/**
- * <code>setVisible</code> makes the window and children visible if <code>visible</code> is true,
+ * Calls {@link #setVisible(boolean, boolean) setVisible(true, visible)},
+ * i.e. blocks until the window becomes visible.
+ * @see #setVisible(boolean, boolean)
+ */
+ void setVisible(boolean visible);
+
+ /**
+ * <code>setVisible(..)</code> makes the window and children visible if <code>visible</code> is true,
* otherwise the window and children becomes invisible.
* <p>
- * The <code>setVisible(true)</code> is responsible to actual create the native window.
+ * <code>setVisible(wait, true)</code> is responsible to actual create the native window.
+ * </p>
+ * <p>
+ * If <code>wait</code> is true, method blocks until window is {@link #isVisible() visible} and {@link #isNativeValid() valid},
+ * otherwise method returns immediately.
* </p>
* <p>
* Zero size semantics are respected, see {@link #setSize(int,int)}:<br>
@@ -178,12 +189,12 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* </pre></p>
* <p>
* In case this window is a child window and has a {@link javax.media.nativewindow.NativeWindow} parent,<br>
- * <code>setVisible(true)</code> has no effect as long the parent's is not valid yet,
+ * <code>setVisible(wait, true)</code> has no effect as long the parent's is not valid yet,
* i.e. {@link javax.media.nativewindow.NativeWindow#getWindowHandle()} returns <code>null</code>.<br>
- * <code>setVisible(true)</code> shall be repeated when the parent becomes valid.
+ * <code>setVisible(wait, true)</code> shall be repeated when the parent becomes valid.
* </p>
*/
- void setVisible(boolean visible);
+ void setVisible(boolean wait, boolean visible);
boolean isVisible();
@@ -342,6 +353,11 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
ACTION_NATIVE_CREATION_PENDING;
}
+ /** Reparenting hint (bitfield value): Force destroy and hence {@link ReparentOperation#ACTION_NATIVE_CREATION re-creating} the window. */
+ public static final int REPARENT_HINT_FORCE_RECREATION = 1 << 0;
+ /** Reparenting hint (bitfield value): Claim window becomes visible after reparenting, which is important for e.g. preserving the GL-states in case window is invisible while reparenting. */
+ public static final int REPARENT_HINT_BECOMES_VISIBLE = 1 << 1;
+
/**
* Change this window's parent window.<br>
* <P>
@@ -354,6 +370,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
*
* @return The issued reparent action type (strategy) as defined in Window.ReparentAction
* @see #reparentWindow(NativeWindow, int, int, boolean)
+ * @deprecated Use {@link #reparentWindow(NativeWindow, int, int, int)}
*/
ReparentOperation reparentWindow(NativeWindow newParent);
@@ -371,11 +388,28 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* @param forceDestroyCreate if true, uses re-creation strategy for reparenting, default is <code>false</code>.
*
* @return The issued reparent action type (strategy) as defined in Window.ReparentAction
- * @see #reparentWindow(NativeWindow)
+ * @deprecated Use {@link #reparentWindow(NativeWindow, int, int, int)}
*/
ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, boolean forceDestroyCreate);
/**
+ * Change this window's parent window.<br>
+ * <P>
+ * In case the old parent is not null and a Window,
+ * this window is removed from it's list of children.<br>
+ * In case the new parent is not null and a Window,
+ * this window is added to it's list of children.<br></P>
+ *
+ * @param newParent The new parent NativeWindow. If null, this Window becomes a top level window.
+ * @param x new top-level position, use -1 for default position.
+ * @param y new top-level position, use -1 for default position.
+ * @param hints May contain hints (bitfield values) like {@link #REPARENT_HINT_FORCE_RECREATION} or {@link #REPARENT_HINT_BECOMES_VISIBLE}.
+ *
+ * @return The issued reparent action type (strategy) as defined in Window.ReparentAction
+ */
+ ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints);
+
+ /**
* Enable or disable fullscreen mode for this window.
* <p>
* Fullscreen mode is established on the {@link #getMainMonitor() main monitor}.
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 70157fe..00c3f1e 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -29,6 +29,7 @@
package com.jogamp.newt.awt;
+import java.applet.Applet;
import java.awt.AWTKeyStroke;
import java.awt.Canvas;
import java.awt.Component;
@@ -95,26 +96,38 @@ import com.jogamp.opengl.util.TileRenderer;
public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProtocol, OffscreenLayerOption, AWTPrintLifecycle {
public static final boolean DEBUG = Debug.debug("Window");
+ private final Object sync = new Object();
private JAWTWindow jawtWindow = null;
+ private boolean isApplet = false;
private boolean shallUseOffscreenLayer = false;
private Window newtChild = null;
private boolean newtChildAttached = false;
private boolean isOnscreen = true;
private WindowClosingMode newtChildCloseOp;
- private AWTParentWindowAdapter awtAdapter = null;
- private AWTAdapter awtMouseAdapter = null;
- private AWTAdapter awtKeyAdapter = null;
+ private final AWTParentWindowAdapter awtAdapter;
+ private final AWTAdapter awtMouseAdapter;
+ private final AWTAdapter awtKeyAdapter;
+
+ /** Mitigates Bug 910 (IcedTea-Web), i.e. crash via removeNotify() invoked before Applet.destroy(). */
+ private boolean destroyJAWTPending = false;
+ /** Mitigates Bug 910 (IcedTea-Web), i.e. crash via removeNotify() invoked before Applet.destroy(). */
+ private boolean skipJAWTDestroy = false;
+
+ /** Safeguard for AWTWindowClosingProtocol and 'removeNotify()' on other thread than AWT-EDT. */
+ private volatile boolean componentAdded = false;
private final AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
@Override
public void run() {
- NewtCanvasAWT.this.destroyImpl(false /* removeNotify */, true /* windowClosing */);
+ if( componentAdded ) {
+ NewtCanvasAWT.this.destroyImpl(false /* removeNotify */, true /* windowClosing */);
+ }
}
}, new Runnable() {
@Override
public void run() {
- if( newtChild != null ) {
+ if( componentAdded && newtChild != null ) {
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
}
}
@@ -125,6 +138,10 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
*/
public NewtCanvasAWT() {
super();
+ awtMouseAdapter = new AWTMouseAdapter().addTo(this);
+ awtKeyAdapter = new AWTKeyAdapter().addTo(this);
+ awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
+ awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
}
/**
@@ -132,6 +149,10 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
*/
public NewtCanvasAWT(GraphicsConfiguration gc) {
super(gc);
+ awtMouseAdapter = new AWTMouseAdapter().addTo(this);
+ awtKeyAdapter = new AWTKeyAdapter().addTo(this);
+ awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
+ awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
}
/**
@@ -139,6 +160,10 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
*/
public NewtCanvasAWT(Window child) {
super();
+ awtMouseAdapter = new AWTMouseAdapter().addTo(this);
+ awtKeyAdapter = new AWTKeyAdapter().addTo(this);
+ awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
+ awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
setNEWTChild(child);
}
@@ -147,6 +172,10 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
*/
public NewtCanvasAWT(GraphicsConfiguration gc, Window child) {
super(gc);
+ awtMouseAdapter = new AWTMouseAdapter().addTo(this);
+ awtKeyAdapter = new AWTKeyAdapter().addTo(this);
+ awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
+ awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
setNEWTChild(child);
}
@@ -162,24 +191,26 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
@Override
public final boolean isOffscreenLayerSurfaceEnabled() {
- return jawtWindow.isOffscreenLayerSurfaceEnabled();
+ final JAWTWindow w = jawtWindow;
+ return null != w && w.isOffscreenLayerSurfaceEnabled();
}
/**
* Returns true if the AWT component is parented to an {@link java.applet.Applet},
- * otherwise false. This information is valid only after {@link #addNotify()} is issued,
- * ie. before adding the component to the AWT tree and make it visible.
+ * otherwise false. This information is valid only after {@link #addNotify()} is issued.
*/
- public boolean isApplet() {
- return jawtWindow.isApplet();
+ public final boolean isApplet() {
+ return isApplet;
}
- boolean isParent() {
- return null!=newtChild && jawtWindow == newtChild.getParent();
+ private final boolean isParent() {
+ final Window nw = newtChild;
+ return null!=nw && jawtWindow == nw.getParent();
}
- boolean isFullscreen() {
- return null != newtChild && newtChild.isFullscreen();
+ private final boolean isFullscreen() {
+ final Window nw = newtChild;
+ return null != nw && nw.isFullscreen();
}
class FocusAction implements Window.FocusRunnable {
@@ -190,15 +221,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if(DEBUG) {
System.err.println("NewtCanvasAWT.FocusAction: "+Display.getThreadName()+", isOnscreen "+isOnscreen+", hasFocus "+hasFocus()+", isParent "+isParent+", isFS "+isFullscreen);
}
- if(isParent && !isFullscreen) {
- // Newt-EDT -> AWT-EDT may freeze Window's native peer requestFocus.
- if(!hasFocus()) {
- // Acquire the AWT focus 1st for proper AWT traversal
- NewtCanvasAWT.super.requestFocus();
- }
- if(isOnscreen) {
+ if( isParent && !isFullscreen ) { // must be parent of newtChild _and_ newtChild not fullscreen
+ if( isOnscreen ) {
// Remove the AWT focus in favor of the native NEWT focus
- KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ AWTEDTExecutor.singleton.invoke(false, awtClearGlobalFocusOwner);
+ } else if( !hasFocus() ) {
+ // In offscreen mode we require the focus!
+ // Newt-EDT -> AWT-EDT may freeze Window's native peer requestFocus.
+ NewtCanvasAWT.super.requestFocus();
}
}
return false; // NEWT shall proceed requesting the native focus
@@ -206,7 +236,22 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
private final FocusAction focusAction = new FocusAction();
- WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() {
+ private static class ClearFocusOwner implements Runnable {
+ @Override
+ public void run() {
+ KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ }
+ }
+ private static final Runnable awtClearGlobalFocusOwner = new ClearFocusOwner();
+
+ /** Must run on AWT-EDT non-blocking, since it invokes tasks on AWT-EDT w/ waiting otherwise. */
+ private final Runnable awtClearSelectedMenuPath = new Runnable() {
+ @Override
+ public void run() {
+ MenuSelectionManager.defaultManager().clearSelectedPath();
+ }
+ };
+ private final WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() {
@Override
public void windowResized(WindowEvent e) {
updateLayoutSize();
@@ -214,7 +259,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
@Override
public void windowGainedFocus(WindowEvent arg0) {
if( isParent() && !isFullscreen() ) {
- MenuSelectionManager.defaultManager().clearSelectedPath();
+ AWTEDTExecutor.singleton.invoke(false, awtClearSelectedMenuPath);
}
}
};
@@ -310,7 +355,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if(null!=newtChild) {
newtChild.setFocusAction(null);
if(isOnscreen) {
- KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ AWTEDTExecutor.singleton.invoke(false, awtClearGlobalFocusOwner);
}
newtChild.requestFocus();
newtChild.setFocusAction(focusAction);
@@ -330,29 +375,32 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
* @return the previous attached newt child.
*/
public Window setNEWTChild(Window newChild) {
- final Window prevChild = newtChild;
- if(DEBUG) {
- System.err.println("NewtCanvasAWT.setNEWTChild.0: win "+newtWinHandleToHexString(prevChild)+" -> "+newtWinHandleToHexString(newChild));
- }
- final java.awt.Container cont = AWTMisc.getContainer(this);
- // remove old one
- if(null != newtChild) {
- detachNewtChild( cont );
- newtChild = null;
- }
- // add new one, reparent only if ready
- newtChild = newChild;
+ synchronized(sync) {
+ final Window prevChild = newtChild;
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.setNEWTChild.0: win "+newtWinHandleToHexString(prevChild)+" -> "+newtWinHandleToHexString(newChild));
+ }
+ final java.awt.Container cont = AWTMisc.getContainer(this);
+ // remove old one
+ if(null != newtChild) {
+ detachNewtChild( cont );
+ newtChild = null;
+ }
+ // add new one, reparent only if ready
+ newtChild = newChild;
- updateLayoutSize();
- // will be done later at paint/display/..: attachNewtChild(cont);
+ updateLayoutSize();
+ // will be done later at paint/display/..: attachNewtChild(cont);
- return prevChild;
+ return prevChild;
+ }
}
private final void updateLayoutSize() {
- if( null != newtChild ) {
+ final Window w = newtChild;
+ if( null != w ) {
// use NEWT child's size for min/pref size!
- java.awt.Dimension minSize = new java.awt.Dimension(newtChild.getWidth(), newtChild.getHeight());
+ java.awt.Dimension minSize = new java.awt.Dimension(w.getWidth(), w.getHeight());
setMinimumSize(minSize);
setPreferredSize(minSize);
}
@@ -377,6 +425,29 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
return awtWindowClosingProtocol.setDefaultCloseOperation(op);
}
+ /**
+ * Mitigates Bug 910 (IcedTea-Web), i.e. crash via removeNotify() invoked before Applet.destroy().
+ * <p>
+ * <code>skipJAWTDestroy</code> defaults to <code>false</code>.
+ * Due to above IcedTea-Web issue the <code>Applet</code> code needs to avoid JAWT destruction before
+ * <code>Applet.destroy()</code> is reached by setting <code>skipJAWTDestroy</code> to <code>true</code>.
+ * Afterwards the value should be reset to <code>false</code> and {@link #destroy()} needs to be called,
+ * which finally will perform the pending JAWT destruction.
+ * </p>
+ */
+ public final void setSkipJAWTDestroy(boolean v) { skipJAWTDestroy = v; }
+ /** See {@link #setSkipJAWTDestroy(boolean)}. */
+ public final boolean getSkipJAWTDestroy() { return skipJAWTDestroy; }
+
+ private final void determineIfApplet() {
+ isApplet = false;
+ Component c = this;
+ while(!isApplet && null != c) {
+ isApplet = c instanceof Applet;
+ c = c.getParent();
+ }
+ }
+
@Override
public void addNotify() {
if( Beans.isDesignTime() ) {
@@ -391,29 +462,43 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
// after native peer is valid: Windows
disableBackgroundErase();
- jawtWindow = NewtFactoryAWT.getNativeWindow(this, null != newtChild ? newtChild.getRequestedCapabilities() : null);
- jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
-
- if(DEBUG) {
- // if ( isShowing() == false ) -> Container was not visible yet.
- // if ( isShowing() == true ) -> Container is already visible.
- System.err.println("NewtCanvasAWT.addNotify: win "+newtWinHandleToHexString(newtChild)+
- ", comp "+this+", visible "+isVisible()+", showing "+isShowing()+
- ", displayable "+isDisplayable()+", cont "+AWTMisc.getContainer(this));
+ synchronized(sync) {
+ determineIfApplet();
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.addNotify.0 - isApplet "+isApplet+", addedOnAWTEDT "+EventQueue.isDispatchThread()+" @ "+currentThreadName());
+ Thread.dumpStack();
+ }
+ jawtWindow = NewtFactoryAWT.getNativeWindow(NewtCanvasAWT.this, null != newtChild ? newtChild.getRequestedCapabilities() : null);
+ jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
+ awtWindowClosingProtocol.addClosingListener();
+ componentAdded = true; // Bug 910
+ if(DEBUG) {
+ // if ( isShowing() == false ) -> Container was not visible yet.
+ // if ( isShowing() == true ) -> Container is already visible.
+ System.err.println("NewtCanvasAWT.addNotify.X: twin "+newtWinHandleToHexString(newtChild)+
+ ", comp "+this+", visible "+isVisible()+", showing "+isShowing()+
+ ", displayable "+isDisplayable()+", cont "+AWTMisc.getContainer(this));
+ }
}
}
- awtWindowClosingProtocol.addClosingListener();
}
@Override
public void removeNotify() {
- awtWindowClosingProtocol.removeClosingListener();
-
if( Beans.isDesignTime() ) {
super.removeNotify();
} else {
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.removeNotify.0 - isApplet "+isApplet+" @ "+currentThreadName());
+ Thread.dumpStack();
+ }
+ componentAdded = false; // Bug 910
+ awtWindowClosingProtocol.removeClosingListener();
destroyImpl(true /* removeNotify */, false /* windowClosing */);
super.removeNotify();
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.removeNotify.X @ "+currentThreadName());
+ }
}
}
@@ -428,38 +513,60 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
* @see Window#destroy()
*/
public final void destroy() {
- destroyImpl(false /* removeNotify */, false /* windowClosing */);
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.destroy() @ "+currentThreadName());
+ Thread.dumpStack();
+ }
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ @Override
+ public void run() {
+ destroyImpl(false /* removeNotify */, false /* windowClosing */);
+ } } );
}
private final void destroyImpl(boolean removeNotify, boolean windowClosing) {
- if( null !=newtChild ) {
- java.awt.Container cont = AWTMisc.getContainer(this);
+ synchronized(sync) {
+ final java.awt.Container cont = AWTMisc.getContainer(this);
if(DEBUG) {
- System.err.println("NewtCanvasAWT.destroy(removeNotify "+removeNotify+", windowClosing "+windowClosing+"): nw "+newtWinHandleToHexString(newtChild)+", from "+cont);
+ System.err.println("NewtCanvasAWT.destroyImpl @ "+currentThreadName());
+ System.err.println("NewtCanvasAWT.destroyImpl.0 - isApplet "+isApplet+", isOnAWTEDT "+EventQueue.isDispatchThread()+", skipJAWTDestroy "+skipJAWTDestroy+
+ "; removeNotify "+removeNotify+", windowClosing "+windowClosing+", destroyJAWTPending "+destroyJAWTPending+
+ ", hasJAWT "+(null!=jawtWindow)+", hasNEWT "+(null!=newtChild)+
+ "): nw "+newtWinHandleToHexString(newtChild)+", from "+cont);
+ }
+ if( null !=newtChild ) {
+ detachNewtChild(cont);
+
+ if( !removeNotify ) {
+ final Window cWin = newtChild;
+ final Window dWin = cWin.getDelegatedWindow();
+ newtChild=null;
+ if( windowClosing && dWin instanceof WindowImpl ) {
+ ((WindowImpl)dWin).windowDestroyNotify(true);
+ } else {
+ cWin.destroy();
+ }
+ }
}
- detachNewtChild(cont);
-
- if( !removeNotify ) {
- final Window cWin = newtChild;
- final Window dWin = cWin.getDelegatedWindow();
- newtChild=null;
- if( windowClosing && dWin instanceof WindowImpl ) {
- ((WindowImpl)dWin).windowDestroyNotify(true);
+ if( ( destroyJAWTPending || removeNotify || windowClosing ) && null!=jawtWindow ) {
+ if( skipJAWTDestroy ) {
+ // Bug 910 - See setSkipJAWTDestroy(boolean)
+ destroyJAWTPending = true;
} else {
- cWin.destroy();
+ NewtFactoryAWT.destroyNativeWindow(jawtWindow);
+ jawtWindow=null;
+ destroyJAWTPending = false;
}
}
}
- if( ( removeNotify || windowClosing ) && null!=jawtWindow ) {
- NewtFactoryAWT.destroyNativeWindow(jawtWindow);
- jawtWindow=null;
- }
}
@Override
public void paint(Graphics g) {
- if( validateComponent(true) && !printActive ) {
- newtChild.windowRepaint(0, 0, getWidth(), getHeight());
+ synchronized(sync) {
+ if( validateComponent(true) && !printActive ) {
+ newtChild.windowRepaint(0, 0, getWidth(), getHeight());
+ }
}
}
@Override
@@ -471,12 +578,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
@Override
public void reshape(int x, int y, int width, int height) {
synchronized (getTreeLock()) { // super.reshape(..) claims tree lock, so we do extend it's lock over reshape
- super.reshape(x, y, width, height);
- if(DEBUG) {
- System.err.println("NewtCanvasAWT.reshape: "+x+"/"+y+" "+width+"x"+height);
- }
- if( validateComponent(true) ) {
- // newtChild.setSize(width, height);
+ synchronized(sync) {
+ super.reshape(x, y, width, height);
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.reshape: "+x+"/"+y+" "+width+"x"+height);
+ }
+ if( validateComponent(true) ) {
+ // newtChild.setSize(width, height);
+ }
}
}
}
@@ -504,73 +613,75 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private final Runnable setupPrintOnEDT = new Runnable() {
@Override
public void run() {
- if( !validateComponent(true) ) {
- if(DEBUG) {
- System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable not valid yet");
+ synchronized(sync) {
+ if( !validateComponent(true) ) {
+ if(DEBUG) {
+ System.err.println(currentThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable not valid yet");
+ }
+ printActive = false;
+ return; // not yet available ..
}
- printActive = false;
- return; // not yet available ..
- }
- if( !isVisible() ) {
- if(DEBUG) {
- System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable visible");
+ if( !isVisible() ) {
+ if(DEBUG) {
+ System.err.println(currentThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable visible");
+ }
+ printActive = false;
+ return; // not yet available ..
}
- printActive = false;
- return; // not yet available ..
- }
- final GLAutoDrawable glad = getGLAD();
- if( null == glad ) {
+ final GLAutoDrawable glad = getGLAD();
+ if( null == glad ) {
+ if( DEBUG ) {
+ System.err.println("AWT print.setup exit, newtChild not a GLAutoDrawable: "+newtChild);
+ }
+ printActive = false;
+ return;
+ }
+ printAnimator = glad.getAnimator();
+ if( null != printAnimator ) {
+ printAnimator.remove(glad);
+ }
+ printGLAD = glad; // _not_ default, shall be replaced by offscreen GLAD
+ final GLCapabilities caps = (GLCapabilities)glad.getChosenGLCapabilities().cloneMutable();
+ final int printNumSamples = printAWTTiles.getNumSamples(caps);
+ GLDrawable printDrawable = printGLAD.getDelegatedDrawable();
+ final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples();
+ final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() ||
+ printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight();
+ final boolean reqNewGLADOnscrn = caps.isOnscreen();
+
+ // It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context.
+ // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX
+ final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize );
if( DEBUG ) {
- System.err.println("AWT print.setup exit, newtChild not a GLAutoDrawable: "+newtChild);
+ System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+
+ ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+
+ ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+
+ ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+
+ ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator);
}
- printActive = false;
- return;
- }
- printAnimator = glad.getAnimator();
- if( null != printAnimator ) {
- printAnimator.remove(glad);
- }
- printGLAD = glad; // _not_ default, shall be replaced by offscreen GLAD
- final GLCapabilities caps = (GLCapabilities)glad.getChosenGLCapabilities().cloneMutable();
- final int printNumSamples = printAWTTiles.getNumSamples(caps);
- GLDrawable printDrawable = printGLAD.getDelegatedDrawable();
- final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples();
- final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() ||
- printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight();
- final boolean reqNewGLADOnscrn = caps.isOnscreen();
-
- // It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context.
- // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX
- final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize );
- if( DEBUG ) {
- System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+
- ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+
- ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+
- ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+
- ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator);
- }
- if( reqNewGLAD ) {
- caps.setDoubleBuffered(false);
- caps.setOnscreen(false);
- if( printNumSamples != caps.getNumSamples() ) {
- caps.setSampleBuffers(0 < printNumSamples);
- caps.setNumSamples(printNumSamples);
+ if( reqNewGLAD ) {
+ caps.setDoubleBuffered(false);
+ caps.setOnscreen(false);
+ if( printNumSamples != caps.getNumSamples() ) {
+ caps.setSampleBuffers(0 < printNumSamples);
+ caps.setNumSamples(printNumSamples);
+ }
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
+ printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
+ printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(glad, printGLAD);
+ printDrawable = printGLAD.getDelegatedDrawable();
+ }
+ printAWTTiles.setGLOrientation(printGLAD.isGLOriented(), printGLAD.isGLOriented());
+ printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
+ printAWTTiles.renderer.attachAutoDrawable(printGLAD);
+ if( DEBUG ) {
+ System.err.println("AWT print.setup "+printAWTTiles);
+ System.err.println("AWT print.setup AA "+printNumSamples+", "+caps);
+ System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD);
+ System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable);
}
- final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
- printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
- printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
- GLDrawableUtil.swapGLContextAndAllGLEventListener(glad, printGLAD);
- printDrawable = printGLAD.getDelegatedDrawable();
- }
- printAWTTiles.setIsGLOriented(printGLAD.isGLOriented());
- printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
- printAWTTiles.renderer.attachAutoDrawable(printGLAD);
- if( DEBUG ) {
- System.err.println("AWT print.setup "+printAWTTiles);
- System.err.println("AWT print.setup AA "+printNumSamples+", "+caps);
- System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD);
- System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable);
}
}
};
@@ -587,61 +698,65 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private final Runnable releasePrintOnEDT = new Runnable() {
@Override
public void run() {
- if( DEBUG ) {
- System.err.println("AWT print.release "+printAWTTiles);
- }
- final GLAutoDrawable glad = getGLAD();
- printAWTTiles.dispose();
- printAWTTiles= null;
- if( printGLAD != glad ) {
- GLDrawableUtil.swapGLContextAndAllGLEventListener(printGLAD, glad);
- printGLAD.destroy();
- }
- printGLAD = null;
- if( null != printAnimator ) {
- printAnimator.add(glad);
- printAnimator = null;
+ synchronized(sync) {
+ if( DEBUG ) {
+ System.err.println("AWT print.release "+printAWTTiles);
+ }
+ final GLAutoDrawable glad = getGLAD();
+ printAWTTiles.dispose();
+ printAWTTiles= null;
+ if( printGLAD != glad ) {
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(printGLAD, glad);
+ printGLAD.destroy();
+ }
+ printGLAD = null;
+ if( null != printAnimator ) {
+ printAnimator.add(glad);
+ printAnimator = null;
+ }
+ printActive = false;
}
- printActive = false;
}
};
@Override
public void print(Graphics graphics) {
- if( !printActive || null == printGLAD ) {
- throw new IllegalStateException("setupPrint() not called");
- }
- if(DEBUG && !EventQueue.isDispatchThread()) {
- System.err.println(getThreadName()+": Warning: GLCanvas print - not called from AWT-EDT");
- // we cannot dispatch print on AWT-EDT due to printing internal locking ..
- }
-
- final Graphics2D g2d = (Graphics2D)graphics;
- try {
- printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight());
- final TileRenderer tileRenderer = printAWTTiles.renderer;
- if( DEBUG ) {
- System.err.println("AWT print.0: "+tileRenderer);
+ synchronized(sync) {
+ if( !printActive || null == printGLAD ) {
+ throw new IllegalStateException("setupPrint() not called");
}
- if( !tileRenderer.eot() ) {
- try {
- do {
- tileRenderer.display();
- } while ( !tileRenderer.eot() );
- if( DEBUG ) {
- System.err.println("AWT print.1: "+printAWTTiles);
+ if(DEBUG && !EventQueue.isDispatchThread()) {
+ System.err.println(currentThreadName()+": Warning: GLCanvas print - not called from AWT-EDT");
+ // we cannot dispatch print on AWT-EDT due to printing internal locking ..
+ }
+
+ final Graphics2D g2d = (Graphics2D)graphics;
+ try {
+ printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight());
+ final TileRenderer tileRenderer = printAWTTiles.renderer;
+ if( DEBUG ) {
+ System.err.println("AWT print.0: "+tileRenderer);
+ }
+ if( !tileRenderer.eot() ) {
+ try {
+ do {
+ tileRenderer.display();
+ } while ( !tileRenderer.eot() );
+ if( DEBUG ) {
+ System.err.println("AWT print.1: "+printAWTTiles);
+ }
+ tileRenderer.reset();
+ } finally {
+ printAWTTiles.resetGraphics2D();
}
- tileRenderer.reset();
- } finally {
- printAWTTiles.resetGraphics2D();
}
+ } catch (NoninvertibleTransformException nte) {
+ System.err.println("Catched: Inversion failed of: "+g2d.getTransform());
+ nte.printStackTrace();
+ }
+ if( DEBUG ) {
+ System.err.println("AWT print.X: "+printAWTTiles);
}
- } catch (NoninvertibleTransformException nte) {
- System.err.println("Catched: Inversion failed of: "+g2d.getTransform());
- nte.printStackTrace();
- }
- if( DEBUG ) {
- System.err.println("AWT print.X: "+printAWTTiles);
}
}
@@ -664,18 +779,12 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
private final void configureNewtChild(boolean attach) {
- if(null!=awtAdapter) {
- awtAdapter.removeFrom(this);
- awtAdapter=null;
- }
- if(null!=awtMouseAdapter) {
- awtMouseAdapter.removeFrom(this);
- awtMouseAdapter = null;
- }
- if(null!=awtKeyAdapter) {
- awtKeyAdapter.removeFrom(this);
- awtKeyAdapter = null;
- }
+ awtAdapter.clear();
+ awtMouseAdapter.clear();
+ awtKeyAdapter.setConsumeAWTEvent(false);
+ awtMouseAdapter.clear();
+ awtKeyAdapter.setConsumeAWTEvent(false);
+
if(null != keyboardFocusManager) {
keyboardFocusManager.removePropertyChangeListener("focusOwner", focusPropertyChangeListener);
keyboardFocusManager = null;
@@ -688,8 +797,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
throw new InternalError("XXX");
}
isOnscreen = jawtWindow.getGraphicsConfiguration().getChosenCapabilities().isOnscreen();
- awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter(jawtWindow, newtChild).addTo(this);
- awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
+ awtAdapter.setDownstream(jawtWindow, newtChild);
newtChild.addWindowListener(clearAWTMenusOnNewtFocus);
newtChild.setFocusAction(focusAction); // enable AWT focus traversal
newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
@@ -703,8 +811,12 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
newtChild.setKeyboardFocusHandler(newtFocusTraversalKeyListener);
} else {
// offscreen newt child requires AWT to fwd AWT key/mouse event
- awtMouseAdapter = new AWTMouseAdapter(newtChild).addTo(this);
- awtKeyAdapter = new AWTKeyAdapter(newtChild).addTo(this);
+ awtMouseAdapter.setDownstream(newtChild);
+ // We cannot consume AWT mouse click, since it would disable focus via mouse click!
+ // awtMouseAdapter.setConsumeAWTEvent(true);
+ awtKeyAdapter.setDownstream(newtChild);
+ // We manually transfer the focus via NEWT KeyListener, hence we can mark AWT keys as consumed!
+ awtKeyAdapter.setConsumeAWTEvent(true);
}
} else {
newtChild.removeWindowListener(clearAWTMenusOnNewtFocus);
@@ -715,6 +827,20 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
+ /**
+ * Returns <code>true</code> if Key and Mouse input events will be passed through AWT,
+ * otherwise only the {@link #getNEWTChild() NEWT child} will receive them.
+ * <p>
+ * Normally only the {@link #getNEWTChild() NEWT child} will receive Key and Mouse input events.
+ * In offscreen mode, e.g. OSX/CALayer, the AWT events will be received and translated into NEWT events
+ * and delivered to the NEWT child window.<br/>
+ * Note: AWT key events will {@link java.awt.event.InputEvent#consume() consumed} in pass-through mode.
+ * </p>
+ */
+ public final boolean isAWTEventPassThrough() {
+ return !isOnscreen;
+ }
+
private final void attachNewtChild() {
if( null == newtChild || null == jawtWindow || newtChildAttached ) {
return; // nop
@@ -722,7 +848,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if(DEBUG) {
// if ( isShowing() == false ) -> Container was not visible yet.
// if ( isShowing() == true ) -> Container is already visible.
- System.err.println("NewtCanvasAWT.attachNewtChild.0 @ "+Thread.currentThread().getName()+": win "+newtWinHandleToHexString(newtChild)+
+ System.err.println("NewtCanvasAWT.attachNewtChild.0 @ "+currentThreadName());
+ System.err.println("\twin "+newtWinHandleToHexString(newtChild)+
", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+
", comp "+this+", visible "+isVisible()+", showing "+isShowing()+", displayable "+isDisplayable()+
", cont "+AWTMisc.getContainer(this));
@@ -740,7 +867,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
newtChild.setVisible(false);
newtChild.setSize(w, h);
- newtChild.reparentWindow(jawtWindow);
+ newtChild.reparentWindow(jawtWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE);
newtChild.addSurfaceUpdatedListener(jawtWindow);
if( jawtWindow.isOffscreenLayerSurfaceEnabled() &&
0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) {
@@ -790,7 +917,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
configureNewtChild(false);
newtChild.setVisible(false);
- newtChild.reparentWindow(null); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer
+ newtChild.reparentWindow(null, -1, -1, 0 /* hint */); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer
if(DEBUG) {
System.err.println("NewtCanvasAWT.detachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this);
@@ -848,7 +975,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
- protected static String getThreadName() { return Thread.currentThread().getName(); }
+ protected static String currentThreadName() { return "["+Thread.currentThread().getName()+", isAWT-EDT "+EventQueue.isDispatchThread()+"]"; }
static String newtWinHandleToHexString(Window w) {
return null != w ? toHexString(w.getWindowHandle()) : "nil";
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
index 409f783..74d4d83 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
@@ -32,6 +32,7 @@ import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Component;
import java.awt.Container;
+import java.awt.EventQueue;
import java.awt.event.KeyListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
@@ -44,6 +45,7 @@ import javax.media.opengl.GLProfile;
import jogamp.nativewindow.jawt.JAWTUtil;
+import com.jogamp.common.util.awt.AWTEDTExecutor;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
@@ -105,12 +107,12 @@ public class JOGLNewtApplet1Run extends Applet {
@Override
public void init() {
if(DEBUG) {
- System.err.println("JOGLNewtApplet1Run.init() START");
+ System.err.println("JOGLNewtApplet1Run.init() START - "+currentThreadName());
}
if(!(this instanceof Container)) {
throw new RuntimeException("This Applet is not a AWT Container");
}
- final Container container = (Container) this;
+ final Container container = this;
String glEventListenerClazzName=null;
String glProfileName=null;
@@ -192,10 +194,13 @@ public class JOGLNewtApplet1Run extends Applet {
glWindow.setDefaultCloseOperation(glCloseable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE);
container.setLayout(new BorderLayout());
if(appletDebugTestBorder) {
- container.add(new Button("North"), BorderLayout.NORTH);
- container.add(new Button("South"), BorderLayout.SOUTH);
- container.add(new Button("East"), BorderLayout.EAST);
- container.add(new Button("West"), BorderLayout.WEST);
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ container.add(new Button("North"), BorderLayout.NORTH);
+ container.add(new Button("South"), BorderLayout.SOUTH);
+ container.add(new Button("East"), BorderLayout.EAST);
+ container.add(new Button("West"), BorderLayout.WEST);
+ } } );
}
base.init(glWindow);
if(base.isValid()) {
@@ -212,32 +217,44 @@ public class JOGLNewtApplet1Run extends Applet {
}
}
if( !glStandalone ) {
- newtCanvasAWT = new NewtCanvasAWT(glWindow);
- container.add(newtCanvasAWT, BorderLayout.CENTER);
- container.validate();
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ newtCanvasAWT = new NewtCanvasAWT(glWindow);
+ newtCanvasAWT.setSkipJAWTDestroy(true); // Bug 910
+ container.add(newtCanvasAWT, BorderLayout.CENTER);
+ container.validate();
+ } } );
}
} catch (Throwable t) {
throw new RuntimeException(t);
}
if(DEBUG) {
- System.err.println("JOGLNewtApplet1Run.init() END");
+ System.err.println("JOGLNewtApplet1Run.init() END - "+currentThreadName());
}
}
+ private static String currentThreadName() { return "["+Thread.currentThread().getName()+", isAWT-EDT "+EventQueue.isDispatchThread()+"]"; }
+
@Override
public void start() {
if(DEBUG) {
- System.err.println("JOGLNewtApplet1Run.start() START (isVisible "+isVisible()+", isDisplayable "+isDisplayable()+")");
+ System.err.println("JOGLNewtApplet1Run.start() START (isVisible "+isVisible()+", isDisplayable "+isDisplayable()+") - "+currentThreadName());
}
- this.setVisible(true);
- final java.awt.Point p0 = this.getLocationOnScreen();
- if( null != newtCanvasAWT ) {
- newtCanvasAWT.setFocusable(true);
- newtCanvasAWT.requestFocus();
- } else {
+ final java.awt.Point[] p0 = { null };
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ setVisible(true);
+ p0[0] = getLocationOnScreen();
+ if( null != newtCanvasAWT ) {
+ newtCanvasAWT.setFocusable(true);
+ newtCanvasAWT.requestFocus();
+ }
+ }
+ });
+ if( null == newtCanvasAWT ) {
glWindow.requestFocus();
glWindow.setSize(glWidth, glHeight);
- glWindow.setPosition(p0.x+glXd, p0.y+glYd);
+ glWindow.setPosition(p0[0].x+glXd, p0[0].y+glYd);
}
if(DEBUG) {
Component topC = this;
@@ -258,43 +275,50 @@ public class JOGLNewtApplet1Run extends Applet {
newtCanvasAWT.isOffscreenLayerSurfaceEnabled() &&
0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) {
// force relayout
- final int cW = newtCanvasAWT.getWidth();
- final int cH = newtCanvasAWT.getHeight();
- newtCanvasAWT.setSize(cW+1, cH+1);
- newtCanvasAWT.setSize(cW, cH);
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ final int cW = newtCanvasAWT.getWidth();
+ final int cH = newtCanvasAWT.getHeight();
+ newtCanvasAWT.setSize(cW+1, cH+1);
+ newtCanvasAWT.setSize(cW, cH);
+ } } );
}
if(DEBUG) {
- System.err.println("JOGLNewtApplet1Run.start() END");
+ System.err.println("JOGLNewtApplet1Run.start() END - "+currentThreadName());
}
}
@Override
public void stop() {
if(DEBUG) {
- System.err.println("JOGLNewtApplet1Run.stop() START");
+ System.err.println("JOGLNewtApplet1Run.stop() START - "+currentThreadName());
}
base.stop();
if(DEBUG) {
- System.err.println("JOGLNewtApplet1Run.stop() END");
+ System.err.println("JOGLNewtApplet1Run.stop() END - "+currentThreadName());
}
}
@Override
public void destroy() {
if(DEBUG) {
- System.err.println("JOGLNewtApplet1Run.destroy() START");
- }
- glWindow.setVisible(false); // hide 1st
- if( null != newtCanvasAWT ) {
- glWindow.reparentWindow(null); // get out of newtCanvasAWT
- this.remove(newtCanvasAWT); // remove newtCanvasAWT
+ System.err.println("JOGLNewtApplet1Run.destroy() START - "+currentThreadName());
}
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ glWindow.setVisible(false); // hide 1st
+ if( null != newtCanvasAWT ) {
+ newtCanvasAWT.setSkipJAWTDestroy(false); // Bug 910
+ remove(newtCanvasAWT); // remove newtCanvasAWT incl. glWindow.reparentWindow(null) if not done yet!
+ newtCanvasAWT.destroy();
+ }
+ } } );
base.destroy(); // destroy glWindow unrecoverable
base=null;
glWindow=null;
newtCanvasAWT=null;
if(DEBUG) {
- System.err.println("JOGLNewtApplet1Run.destroy() END");
+ System.err.println("JOGLNewtApplet1Run.destroy() END - "+currentThreadName());
}
}
}
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
index d17d2e7..e6571d2 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
@@ -42,6 +42,7 @@ import javax.media.opengl.GLPipelineFactory;
import jogamp.newt.Debug;
+import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.MouseListener;
@@ -162,25 +163,6 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
public void init(ThreadGroup tg, final GLWindow glWindow) {
isValid = false;
this.glWindow = glWindow;
- this.glWindow.addWindowListener(new WindowAdapter() {
- // Closing action: back to parent!
- @Override
- public void windowDestroyNotify(WindowEvent e) {
- if( isValid() && WindowClosingMode.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() ) {
- if(null == glWindow.getParent()) {
- // we may be called directly by the native EDT
- new Thread(new Runnable() {
- @Override
- public void run() {
- if( glWindow.isNativeValid() ) {
- glWindow.reparentWindow(awtParent);
- }
- }
- }).start();
- }
- }
- } } );
-
glEventListener = createInstance(glEventListenerClazzName);
if(null == glEventListener) {
return;
@@ -225,17 +207,38 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
isValid = true;
}
+ private final WindowListener reparentHomeListener = new WindowAdapter() {
+ // Closing action: back to parent!
+ @Override
+ public void windowDestroyNotify(WindowEvent e) {
+ if( isValid() && WindowClosingMode.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() &&
+ null == glWindow.getParent() && null != awtParent && 0 != awtParent.getWindowHandle() )
+ {
+ // we may be called directly by the native EDT
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ if( glWindow.isNativeValid() && null != awtParent && 0 != awtParent.getWindowHandle() ) {
+ glWindow.reparentWindow(awtParent, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE);
+ }
+ }
+ }).start();
+ }
+ } };
+
public void start() {
if(isValid) {
glWindow.setVisible(true);
glWindow.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED);
glAnimator.start();
awtParent = glWindow.getParent();
+ glWindow.addWindowListener(reparentHomeListener);
}
}
public void stop() {
if(null!=glAnimator) {
+ glWindow.removeWindowListener(reparentHomeListener);
glAnimator.stop();
glWindow.setVisible(false);
}
@@ -306,7 +309,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
glWindow.setAlwaysOnTop(!glWindow.isAlwaysOnTop());
} else if(e.getKeyChar()=='r' && null!=awtParent) {
if(null == glWindow.getParent()) {
- glWindow.reparentWindow(awtParent);
+ glWindow.reparentWindow(awtParent, -1, -1, 0 /* hints */);
} else {
final InsetsImmutable insets = glWindow.getInsets();
final int x, y;
@@ -318,7 +321,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
x = insets.getLeftWidth();
y = insets.getTopHeight();
}
- glWindow.reparentWindow(null, x, y, false /* forceDestroyCreate */);
+ glWindow.reparentWindow(null, x, y, 0 /* hints */);
glWindow.setDefaultCloseOperation( glClosable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE );
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
index 635bdba..272e4be 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
@@ -589,7 +589,9 @@ public class MouseEvent extends InputEvent
private static final PointerType[] constMousePointerTypes = new PointerType[] { PointerType.Mouse };
public static final short EVENT_MOUSE_CLICKED = 200;
+ /** Only generated for {@link PointerType#Mouse} */
public static final short EVENT_MOUSE_ENTERED = 201;
+ /** Only generated for {@link PointerType#Mouse} */
public static final short EVENT_MOUSE_EXITED = 202;
public static final short EVENT_MOUSE_PRESSED = 203;
public static final short EVENT_MOUSE_RELEASED = 204;
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseListener.java b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
index 5378080..6e51420 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
@@ -44,7 +44,9 @@ import com.jogamp.newt.event.MouseEvent.PointerType;
public interface MouseListener extends NEWTEventListener
{
public void mouseClicked(MouseEvent e);
+ /** Only generated for {@link PointerType#Mouse} */
public void mouseEntered(MouseEvent e);
+ /** Only generated for {@link PointerType#Mouse} */
public void mouseExited(MouseEvent e);
public void mousePressed(MouseEvent e);
public void mouseReleased(MouseEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
index e3bf184..864db1f 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -117,17 +117,21 @@ public abstract class AWTAdapter implements java.util.EventListener
com.jogamp.newt.event.NEWTEventListener newtListener;
com.jogamp.newt.Window newtWindow;
+ boolean consumeAWTEvent;
+ protected boolean isSetup;
/**
* Simply wrap aroung a NEWT EventListener, exposed as an AWT EventListener.<br>
* The NEWT EventListener will be called when an event happens.<br>
*/
- public AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener) {
+ protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener) {
if(null==newtListener) {
throw new RuntimeException("Argument newtListener is null");
}
this.newtListener = newtListener;
this.newtWindow = null;
+ this.consumeAWTEvent = false;
+ this.isSetup = true;
}
/**
@@ -135,7 +139,7 @@ public abstract class AWTAdapter implements java.util.EventListener
* where the given NEWT Window impersonates as the event's source.
* The NEWT EventListener will be called when an event happens.<br>
*/
- public AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener, com.jogamp.newt.Window newtProxy) {
+ protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener, com.jogamp.newt.Window newtProxy) {
if(null==newtListener) {
throw new RuntimeException("Argument newtListener is null");
}
@@ -144,6 +148,8 @@ public abstract class AWTAdapter implements java.util.EventListener
}
this.newtListener = newtListener;
this.newtWindow = newtProxy;
+ this.consumeAWTEvent = false;
+ this.isSetup = true;
}
/**
@@ -151,22 +157,52 @@ public abstract class AWTAdapter implements java.util.EventListener
* Once attached to an AWT component, it sends the converted AWT events to the NEWT downstream window.<br>
* This is only supported with EDT enabled!
*/
- public AWTAdapter(com.jogamp.newt.Window downstream) {
+ protected AWTAdapter(com.jogamp.newt.Window downstream) {
+ this();
+ setDownstream(downstream);
+ }
+
+ public AWTAdapter() {
+ clear();
+ this.consumeAWTEvent = false;
+ }
+
+ /**
+ * Setup a pipeline adapter, AWT EventListener.<br>
+ * Once attached to an AWT component, it sends the converted AWT events to the NEWT downstream window.<br>
+ * This is only supported with EDT enabled!
+ */
+ public synchronized AWTAdapter setDownstream(com.jogamp.newt.Window downstream) {
if(null==downstream) {
throw new RuntimeException("Argument downstream is null");
}
this.newtListener = null;
this.newtWindow = downstream;
+ this.consumeAWTEvent = false;
if( null == newtWindow.getScreen().getDisplay().getEDTUtil() ) {
throw new RuntimeException("EDT not enabled");
}
+ this.isSetup = true;
+ return this;
+ }
+
+ /** Removes all references, downstream and NEWT-EventListener. */
+ public synchronized AWTAdapter clear() {
+ this.newtListener = null;
+ this.newtWindow = null;
+ this.isSetup = false;
+ return this;
+ }
+
+ public final synchronized void setConsumeAWTEvent(boolean v) {
+ this.consumeAWTEvent = v;
}
- public final com.jogamp.newt.Window getNewtWindow() {
+ public final synchronized com.jogamp.newt.Window getNewtWindow() {
return newtWindow;
}
- public final com.jogamp.newt.event.NEWTEventListener getNewtEventListener() {
+ public final synchronized com.jogamp.newt.event.NEWTEventListener getNewtEventListener() {
return newtListener;
}
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
index f6f11b8..d4226f5 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
@@ -49,21 +49,29 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe
super(downstream);
}
+ public AWTKeyAdapter() {
+ super();
+ }
+
@Override
- public AWTAdapter addTo(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter addTo(java.awt.Component awtComponent) {
awtComponent.addKeyListener(this);
return this;
}
@Override
- public AWTAdapter removeFrom(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeKeyListener(this);
return this;
}
@Override
- public void keyPressed(java.awt.event.KeyEvent e) {
+ public synchronized void keyPressed(java.awt.event.KeyEvent e) {
+ if( !isSetup ) { return; }
final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED, e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.KeyListener)newtListener).keyPressed(event);
} else {
@@ -72,8 +80,12 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe
}
@Override
- public void keyReleased(java.awt.event.KeyEvent e) {
+ public synchronized void keyReleased(java.awt.event.KeyEvent e) {
+ if( !isSetup ) { return; }
final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED, e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.KeyListener)newtListener).keyReleased(event);
} else {
@@ -82,7 +94,11 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe
}
@Override
- public void keyTyped(java.awt.event.KeyEvent e) {
+ public synchronized void keyTyped(java.awt.event.KeyEvent e) {
+ if( !isSetup ) { return; }
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
index 73a02c9..8ad1fa6 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
@@ -46,8 +46,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
super(downstream);
}
+ public AWTMouseAdapter() {
+ super();
+ }
+
@Override
- public AWTAdapter addTo(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter addTo(java.awt.Component awtComponent) {
awtComponent.addMouseListener(this);
awtComponent.addMouseMotionListener(this);
awtComponent.addMouseWheelListener(this);
@@ -55,7 +59,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public AWTAdapter removeFrom(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeMouseListener(this);
awtComponent.removeMouseMotionListener(this);
awtComponent.removeMouseWheelListener(this);
@@ -63,8 +67,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public void mouseClicked(java.awt.event.MouseEvent e) {
+ public synchronized void mouseClicked(java.awt.event.MouseEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.MouseListener)newtListener).mouseClicked(event);
} else {
@@ -73,8 +81,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public void mouseEntered(java.awt.event.MouseEvent e) {
+ public synchronized void mouseEntered(java.awt.event.MouseEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.MouseListener)newtListener).mouseEntered(event);
} else {
@@ -83,8 +95,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public void mouseExited(java.awt.event.MouseEvent e) {
+ public synchronized void mouseExited(java.awt.event.MouseEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.MouseListener)newtListener).mouseExited(event);
} else {
@@ -93,8 +109,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public void mousePressed(java.awt.event.MouseEvent e) {
+ public synchronized void mousePressed(java.awt.event.MouseEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.MouseListener)newtListener).mousePressed(event);
} else {
@@ -103,8 +123,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public void mouseReleased(java.awt.event.MouseEvent e) {
+ public synchronized void mouseReleased(java.awt.event.MouseEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.MouseListener)newtListener).mouseReleased(event);
} else {
@@ -113,8 +137,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public void mouseDragged(java.awt.event.MouseEvent e) {
+ public synchronized void mouseDragged(java.awt.event.MouseEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.MouseListener)newtListener).mouseDragged(event);
} else {
@@ -123,8 +151,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public void mouseMoved(java.awt.event.MouseEvent e) {
+ public synchronized void mouseMoved(java.awt.event.MouseEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.MouseListener)newtListener).mouseMoved(event);
} else {
@@ -133,8 +165,12 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
@Override
- public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
+ public synchronized void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ if( consumeAWTEvent ) {
+ e.consume();
+ }
if(null!=newtListener) {
((com.jogamp.newt.event.MouseListener)newtListener).mouseWheelMoved(event);
} else {
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
index 8a9a2a4..2e5527e 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
@@ -49,16 +49,17 @@ public class AWTWindowAdapter
public AWTWindowAdapter(com.jogamp.newt.Window downstream) {
super(downstream);
}
+ public AWTWindowAdapter() {
+ super();
+ }
@Override
- public AWTAdapter addTo(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter addTo(java.awt.Component awtComponent) {
java.awt.Window win = getWindow(awtComponent);
awtComponent.addComponentListener(this);
awtComponent.addFocusListener(this);
- if( null == windowClosingListener ) {
+ if( null != win && null == windowClosingListener ) {
windowClosingListener = new WindowClosingListener();
- }
- if( null != win ) {
win.addWindowListener(windowClosingListener);
}
if(awtComponent instanceof java.awt.Window) {
@@ -67,7 +68,7 @@ public class AWTWindowAdapter
return this;
}
- public AWTAdapter removeWindowClosingFrom(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter removeWindowClosingFrom(java.awt.Component awtComponent) {
java.awt.Window win = getWindow(awtComponent);
if( null != win && null != windowClosingListener ) {
win.removeWindowListener(windowClosingListener);
@@ -76,7 +77,7 @@ public class AWTWindowAdapter
}
@Override
- public AWTAdapter removeFrom(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeFocusListener(this);
awtComponent.removeComponentListener(this);
removeWindowClosingFrom(awtComponent);
@@ -97,7 +98,8 @@ public class AWTWindowAdapter
}
@Override
- public void focusGained(java.awt.event.FocusEvent e) {
+ public synchronized void focusGained(java.awt.event.FocusEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: focusGained: "+e+" -> "+event);
@@ -110,7 +112,8 @@ public class AWTWindowAdapter
}
@Override
- public void focusLost(java.awt.event.FocusEvent e) {
+ public synchronized void focusLost(java.awt.event.FocusEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: focusLost: "+e+" -> "+event);
@@ -123,7 +126,8 @@ public class AWTWindowAdapter
}
@Override
- public void componentResized(java.awt.event.ComponentEvent e) {
+ public synchronized void componentResized(java.awt.event.ComponentEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(DEBUG_IMPLEMENTATION) {
final java.awt.Component c = e.getComponent();
@@ -148,7 +152,8 @@ public class AWTWindowAdapter
}
@Override
- public void componentMoved(java.awt.event.ComponentEvent e) {
+ public synchronized void componentMoved(java.awt.event.ComponentEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: componentMoved: "+e+" -> "+event);
@@ -161,7 +166,8 @@ public class AWTWindowAdapter
}
@Override
- public void componentShown(java.awt.event.ComponentEvent e) {
+ public synchronized void componentShown(java.awt.event.ComponentEvent e) {
+ if( !isSetup ) { return; }
final java.awt.Component comp = e.getComponent();
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: componentShown: "+comp);
@@ -179,7 +185,8 @@ public class AWTWindowAdapter
}
@Override
- public void componentHidden(java.awt.event.ComponentEvent e) {
+ public synchronized void componentHidden(java.awt.event.ComponentEvent e) {
+ if( !isSetup ) { return; }
final java.awt.Component comp = e.getComponent();
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: componentHidden: "+comp);
@@ -197,7 +204,8 @@ public class AWTWindowAdapter
}
@Override
- public void windowActivated(java.awt.event.WindowEvent e) {
+ public synchronized void windowActivated(java.awt.event.WindowEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(null!=newtListener) {
((com.jogamp.newt.event.WindowListener)newtListener).windowGainedFocus(event);
@@ -207,13 +215,14 @@ public class AWTWindowAdapter
}
@Override
- public void windowClosed(java.awt.event.WindowEvent e) { }
+ public synchronized void windowClosed(java.awt.event.WindowEvent e) { }
@Override
- public void windowClosing(java.awt.event.WindowEvent e) { }
+ public synchronized void windowClosing(java.awt.event.WindowEvent e) { }
@Override
- public void windowDeactivated(java.awt.event.WindowEvent e) {
+ public synchronized void windowDeactivated(java.awt.event.WindowEvent e) {
+ if( !isSetup ) { return; }
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(null!=newtListener) {
((com.jogamp.newt.event.WindowListener)newtListener).windowLostFocus(event);
@@ -223,31 +232,37 @@ public class AWTWindowAdapter
}
@Override
- public void windowDeiconified(java.awt.event.WindowEvent e) { }
+ public synchronized void windowDeiconified(java.awt.event.WindowEvent e) { }
@Override
- public void windowIconified(java.awt.event.WindowEvent e) { }
+ public synchronized void windowIconified(java.awt.event.WindowEvent e) { }
@Override
- public void windowOpened(java.awt.event.WindowEvent e) { }
+ public synchronized void windowOpened(java.awt.event.WindowEvent e) { }
class WindowClosingListener implements java.awt.event.WindowListener {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
- if(null!=newtListener) {
- ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyNotify(event);
- } else {
- enqueueEvent(true, event);
+ synchronized( AWTWindowAdapter.this ) {
+ if( !isSetup ) { return; }
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ if(null!=newtListener) {
+ ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyNotify(event);
+ } else {
+ enqueueEvent(true, event);
+ }
}
}
@Override
public void windowClosed(java.awt.event.WindowEvent e) {
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
- if(null!=newtListener) {
- ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event);
- } else {
- enqueueEvent(true, event);
+ synchronized( AWTWindowAdapter.this ) {
+ if( !isSetup ) { return; }
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ if(null!=newtListener) {
+ ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event);
+ } else {
+ enqueueEvent(true, event);
+ }
}
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 4f259fe..208602a 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -397,6 +397,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
+ public final ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints) {
+ return window.reparentWindow(newParent, x, y, hints);
+ }
+
+ @Override
public final boolean removeChild(NativeWindow win) {
return window.removeChild(win);
}
@@ -426,6 +431,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
+ public void setVisible(boolean wait, boolean visible) {
+ window.setVisible(wait, visible);
+ }
+
+ @Override
public final void setSize(int width, int height) {
window.setSize(width, height);
}
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index e63a535..43e56c8 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -46,6 +46,8 @@ import javax.media.nativewindow.util.Point;
import javax.media.opengl.GLCapabilities;
import jogamp.nativewindow.macosx.OSXUtil;
+import jogamp.nativewindow.windows.GDIUtil;
+import jogamp.nativewindow.x11.X11Lib;
import jogamp.newt.Debug;
import jogamp.newt.swt.SWTEDTUtil;
@@ -70,7 +72,6 @@ import com.jogamp.newt.util.EDTUtil;
*/
public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
private static final boolean DEBUG = Debug.debug("Window");
- private static final boolean isOSX = NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false);
private final AbstractGraphicsScreen screen;
@@ -145,6 +146,9 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
newtChild.setSize(clientArea.width, clientArea.height);
postSetSize = false;
}
+ if( SWTAccessor.isOSX ) {
+ newtChild.setPosition(parent.getLocation().x,parent.getLocation().y);
+ }
newtChild.windowRepaint(0, 0, clientArea.width, clientArea.height);
}
}
@@ -243,7 +247,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
configureNewtChild(false);
newtChild.setVisible(false);
- newtChild.reparentWindow(null);
+ newtChild.reparentWindow(null, -1, -1, 0 /* hint */);
newtChild.destroy();
newtChild = null;
}
@@ -252,6 +256,9 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
super.dispose();
}
+ private Rectangle getSWTCanvasPosition() {
+ return super.getBounds();
+ }
/** @return this SWT Canvas NativeWindow representation, may be null in case it has not been realized. */
public NativeWindow getNativeWindow() { return nativeWindow; }
@@ -354,7 +361,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
newtChild.setSize(w, h);
- newtChild.reparentWindow(nativeWindow);
+ newtChild.reparentWindow(nativeWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE);
newtChild.setVisible(true);
configureNewtChild(true);
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener
@@ -365,7 +372,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
} else {
configureNewtChild(false);
newtChild.setVisible(false);
- newtChild.reparentWindow(null);
+ newtChild.reparentWindow(null, -1, -1, 0 /* hints */);
}
if(DEBUG) {
System.err.println("NewtCanvasSWT.reparentWindow.X: add="+add+", win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil());
@@ -394,7 +401,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
public SWTNativeWindow(AbstractGraphicsConfiguration config, long nativeWindowHandle) {
this.config = config;
this.nativeWindowHandle = nativeWindowHandle;
- if(isOSX) {
+ if( SWTAccessor.isOSX ) {
this.insets = OSXUtil.GetInsets(nativeWindowHandle);
} else {
this.insets = new Insets(0, 0, 0, 0);
@@ -497,21 +504,25 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
@Override
public Point getLocationOnScreen(Point point) {
- if( isOSX ) {
- final Point los = OSXUtil.GetLocationOnScreen(nativeWindowHandle, false, 0, 0);
- // top-level position -> client window position
- los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight());
- if(null!=point) {
- return point.translate(los);
- } else {
- return los;
- }
+ final Point los; // client window location on screen
+ if( SWTAccessor.isOSX ) {
+ los = OSXUtil.GetLocationOnScreen(nativeWindowHandle, false, 0, 0);
+ // top-level position -> client window position: OSX needs to add SWT parent position incl. insets
+ final Rectangle swtCanvasPosition = getSWTCanvasPosition();
+ los.translate(swtCanvasPosition.x + insets.getLeftWidth(), swtCanvasPosition.y + insets.getTopHeight());
+ } else if (SWTAccessor.isX11) {
+ final AbstractGraphicsScreen s = config.getScreen();
+ los = X11Lib.GetRelativeLocation(s.getDevice().getHandle(), s.getIndex(), nativeWindowHandle, 0 /*root win*/, 0, 0);
+ } else if (SWTAccessor.isWindows) {
+ los = GDIUtil.GetRelativeLocation( nativeWindowHandle, 0 /*root win*/, 0, 0);
} else {
- // client position on 'normal' windowing systems is 0/0
- if(null == point) {
- point = new Point(0, 0);
- }
- return point;
+ // fall-back to 0/0
+ los = new Point(0, 0);
+ }
+ if(null!=point) {
+ return point.translate(los);
+ } else {
+ return los;
}
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 5102fd2..ed7dd56 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -148,7 +148,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private volatile int x = 64, y = 64; // client-area pos w/o insets
private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated)
- private RecursiveLock windowLock = LockFactory.createRecursiveLock(); // Window instance wide lock
+ private final RecursiveLock windowLock = LockFactory.createRecursiveLock(); // Window instance wide lock
private int surfaceLockCount = 0; // surface lock recursion count
private ScreenImpl screen; // never null after create - may change reference though (reparent)
@@ -164,6 +164,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private boolean autoPosition = true; // default: true (allow WM to choose top-level position, if not set by user)
private int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen client-area size/pos w/o insets
+ private boolean nfs_alwaysOnTop; // non fullscreen alwaysOnTop setting
private NativeWindow nfs_parent = null; // non fullscreen parent, in case explicit reparenting is performed (offscreen)
private String title = "Newt Window";
private boolean undecorated = false;
@@ -177,46 +178,54 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private FocusRunnable focusAction = null;
private KeyListener keyboardFocusHandler = null;
- private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
+ private final SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
- private Object childWindowsLock = new Object();
- private ArrayList<NativeWindow> childWindows = new ArrayList<NativeWindow>();
+ private final Object childWindowsLock = new Object();
+ private final ArrayList<NativeWindow> childWindows = new ArrayList<NativeWindow>();
private ArrayList<MouseListener> mouseListeners = new ArrayList<MouseListener>();
/** from event passing: {@link WindowImpl#consumePointerEvent(MouseEvent)}. */
private static class PointerState0 {
- /** mouse entered window - is inside the window (may be synthetic) */
+ /** Pointer entered window - is inside the window (may be synthetic) */
boolean insideWindow = false;
+ /** Mouse EXIT has been sent (only for MOUSE type enter/exit)*/
+ boolean exitSent = false;
- /** last time when a mouse button was pressed */
+ /** last time when a pointer button was pressed */
long lastButtonPressTime = 0;
+ /** Pointer in dragging mode */
+ boolean dragging = false;
+
void clearButton() {
lastButtonPressTime = 0;
}
+ public String toString() { return "PState0[inside "+insideWindow+", exitSent "+exitSent+", lastPress "+lastButtonPressTime+", dragging "+dragging+"]"; }
}
- private PointerState0 pState0 = new PointerState0();
+ private final PointerState0 pState0 = new PointerState0();
/** from direct input: {@link WindowImpl#doPointerEvent(boolean, boolean, int[], short, int, int, boolean, short[], int[], int[], float[], float, float[], float)}. */
private static class PointerState1 extends PointerState0 {
- /** current pressed mouse button number */
+ /** Current pressed mouse button number */
short buttonPressed = (short)0;
- /** current pressed mouse button modifier mask */
+ /** Current pressed mouse button modifier mask */
int buttonPressedMask = 0;
- /** last mouse button click count */
+ /** Last mouse button click count */
short lastButtonClickCount = (short)0;
@Override
final void clearButton() {
super.clearButton();
- lastButtonPressTime = 0;
lastButtonClickCount = (short)0;
- buttonPressed = 0;
- buttonPressedMask = 0;
+ if( !dragging || 0 == buttonPressedMask ) {
+ buttonPressed = 0;
+ buttonPressedMask = 0;
+ dragging = false;
+ }
}
- /** last pointer-move position for 8 touch-down pointers */
+ /** Last pointer-move position for 8 touch-down pointers */
final Point[] movePositions = new Point[] {
new Point(), new Point(), new Point(), new Point(),
new Point(), new Point(), new Point(), new Point() };
@@ -226,10 +235,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return null;
}
+ public final String toString() { return "PState1[inside "+insideWindow+", exitSent "+exitSent+", lastPress "+lastButtonPressTime+
+ ", pressed [button "+buttonPressed+", mask "+buttonPressedMask+", dragging "+dragging+", clickCount "+lastButtonClickCount+"]"; }
}
- private PointerState1 pState1 = new PointerState1();
+ private final PointerState1 pState1 = new PointerState1();
- /** pointer names -> pointer ID (consecutive index, starting w/ 0) */
+ /** Pointer names -> pointer ID (consecutive index, starting w/ 0) */
private final ArrayHashSet<Integer> pName2pID = new ArrayHashSet<Integer>();
private boolean defaultGestureHandlerEnabled = true;
@@ -534,7 +545,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//----------------------------------------------------------------------
// WindowClosingProtocol implementation
//
- private Object closingListenerLock = new Object();
+ private final Object closingListenerLock = new Object();
private WindowClosingMode defaultCloseOperation = WindowClosingMode.DISPOSE_ON_CLOSE;
@Override
@@ -663,37 +674,37 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if( 0 != ( FLAG_CHANGE_PARENTING & flags) ) {
sb.append("*");
}
- sb.append("PARENT_");
+ sb.append("PARENT ");
sb.append(0 != ( FLAG_HAS_PARENT & flags));
sb.append(", ");
if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) {
sb.append("*");
}
- sb.append("FS_");
+ sb.append("FS ");
sb.append(0 != ( FLAG_IS_FULLSCREEN & flags));
- sb.append("_span_");
+ sb.append("[span ");
sb.append(0 != ( FLAG_IS_FULLSCREEN_SPAN & flags));
- sb.append(", ");
+ sb.append("], ");
if( 0 != ( FLAG_CHANGE_DECORATION & flags) ) {
sb.append("*");
}
- sb.append("UNDECOR_");
+ sb.append("UNDECOR ");
sb.append(0 != ( FLAG_IS_UNDECORATED & flags));
sb.append(", ");
if( 0 != ( FLAG_CHANGE_ALWAYSONTOP & flags) ) {
sb.append("*");
}
- sb.append("ALWAYSONTOP_");
+ sb.append("ALWAYSONTOP ");
sb.append(0 != ( FLAG_IS_ALWAYSONTOP & flags));
sb.append(", ");
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
sb.append("*");
}
- sb.append("VISIBLE_");
+ sb.append("VISIBLE ");
sb.append(0 != ( FLAG_IS_VISIBLE & flags));
sb.append("]");
@@ -965,7 +976,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- protected void setVisible(boolean wait, boolean visible) {
+ @Override
+ public void setVisible(boolean wait, boolean visible) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow));
}
@@ -1174,14 +1186,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private class ReparentAction implements Runnable {
final NativeWindow newParentWindow;
final int topLevelX, topLevelY;
- boolean forceDestroyCreate;
+ final int hints;
ReparentOperation operation;
- private ReparentAction(NativeWindow newParentWindow, int topLevelX, int topLevelY, boolean forceDestroyCreate) {
+ private ReparentAction(NativeWindow newParentWindow, int topLevelX, int topLevelY, int hints) {
this.newParentWindow = newParentWindow;
this.topLevelX = topLevelX;
this.topLevelY = topLevelY;
- this.forceDestroyCreate = forceDestroyCreate | DEBUG_TEST_REPARENT_INCOMPATIBLE;
+ if( DEBUG_TEST_REPARENT_INCOMPATIBLE ) {
+ hints |= REPARENT_HINT_FORCE_RECREATION;
+ }
+ this.hints = hints;
this.operation = ReparentOperation.ACTION_INVALID; // ensure it's set
}
@@ -1215,17 +1230,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final int x, y;
int width = oldWidth;
int height = oldHeight;
- boolean wasVisible;
+
+ final boolean wasVisible;
+ final boolean becomesVisible;
+ final boolean forceDestroyCreate;
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
- if(isNativeValid()) {
- // force recreation if offscreen, since it may become onscreen
- forceDestroyCreate |= isOffscreenInstance(WindowImpl.this, newParentWindow);
+ {
+ boolean v = 0 != ( REPARENT_HINT_FORCE_RECREATION & hints );
+ if(isNativeValid()) {
+ // force recreation if offscreen, since it may become onscreen
+ v |= isOffscreenInstance(WindowImpl.this, newParentWindow);
+ }
+ forceDestroyCreate = v;
}
wasVisible = isVisible();
+ becomesVisible = wasVisible || 0 != ( REPARENT_HINT_BECOMES_VISIBLE & hints );
Window newParentWindowNEWT = null;
if(newParentWindow instanceof Window) {
@@ -1234,8 +1257,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
long newParentWindowHandle = 0 ;
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparent: START ("+getThreadName()+") valid "+isNativeValid()+", windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+", visible "+wasVisible+", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow)+", forceDestroyCreate "+forceDestroyCreate);
+ if( DEBUG_IMPLEMENTATION) {
+ System.err.println("Window.reparent: START ("+getThreadName()+") valid "+isNativeValid()+
+ ", windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+
+ ", visible "+wasVisible+", becomesVisible "+becomesVisible+
+ ", forceDestroyCreate "+forceDestroyCreate+
+ ", HINT_FORCE_RECREATION "+( 0 != ( REPARENT_HINT_FORCE_RECREATION & hints ) )+
+ ", HINT_BECOMES_VISIBLE "+( 0 != ( REPARENT_HINT_BECOMES_VISIBLE & hints ) ) +
+ ", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+
+ ", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow) );
}
if(null!=newParentWindow) {
@@ -1262,7 +1292,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
// Destroy this window and use parent's Screen.
// It may be created properly when the parent is made visible.
- destroy( false );
+ destroy( becomesVisible );
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
} else if(newParentWindow != getParent()) {
@@ -1286,7 +1316,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
} else if ( forceDestroyCreate || !NewtFactory.isScreenCompatible(newParentWindow, screen) ) {
// Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
- destroy( wasVisible );
+ destroy( becomesVisible );
if(null!=newParentWindowNEWT) {
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
} else {
@@ -1324,7 +1354,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
} else if( !isNativeValid() || forceDestroyCreate ) {
// Destroy this window and mark it for [pending] creation.
// If isNativeValid() and becoming visible again - try to preserve resources, i.e. b/c on-/offscreen switch.
- destroy( isNativeValid() && wasVisible );
+ destroy( becomesVisible );
if( 0 < width && 0 < height ) {
operation = ReparentOperation.ACTION_NATIVE_CREATION;
} else {
@@ -1425,7 +1455,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparent: native reparenting failed ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+" -> "+toHexString(newParentWindowHandle)+" - Trying recreation");
}
- destroy( wasVisible );
+ destroy( becomesVisible );
operation = ReparentOperation.ACTION_NATIVE_CREATION ;
}
} else {
@@ -1488,12 +1518,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final ReparentOperation reparentWindow(NativeWindow newParent) {
- return reparentWindow(newParent, -1, -1, false);
+ return reparentWindow(newParent, -1, -1, 0);
}
@Override
public ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, boolean forceDestroyCreate) {
- final ReparentAction reparentAction = new ReparentAction(newParent, x, y, forceDestroyCreate);
+ return reparentWindow(newParent, x, y, forceDestroyCreate ? REPARENT_HINT_FORCE_RECREATION : 0);
+ }
+
+ @Override
+ public ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints) {
+ final ReparentAction reparentAction = new ReparentAction(newParent, x, y, hints);
runOnEDTIfAvail(true, reparentAction);
return reparentAction.getOp();
}
@@ -1599,7 +1634,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final void setAlwaysOnTop(boolean value) {
- runOnEDTIfAvail(true, new AlwaysOnTopAction(value));
+ if( isFullscreen() ) {
+ nfs_alwaysOnTop = value;
+ } else {
+ runOnEDTIfAvail(true, new AlwaysOnTopAction(value));
+ }
}
@Override
@@ -2001,6 +2040,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final RectangleImmutable sviewport = screen.getViewport();
final RectangleImmutable viewport;
final int fs_span_flag;
+ final boolean alwaysOnTopChange;
if(fullscreen) {
if( null == fullscreenMonitors ) {
if( fullscreenUseMainMonitor ) {
@@ -2021,10 +2061,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
nfs_y = oldY;
nfs_width = oldWidth;
nfs_height = oldHeight;
+ nfs_alwaysOnTop = alwaysOnTop;
x = viewport.getX();
y = viewport.getY();
w = viewport.getWidth();
h = viewport.getHeight();
+ alwaysOnTop = false;
+ alwaysOnTopChange = nfs_alwaysOnTop != alwaysOnTop;
} else {
fullscreenUseMainMonitor = true;
fullscreenMonitors = null;
@@ -2034,6 +2077,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
y = nfs_y;
w = nfs_width;
h = nfs_height;
+ alwaysOnTopChange = nfs_alwaysOnTop != alwaysOnTop;
+ alwaysOnTop = nfs_alwaysOnTop;
if(null!=parentWindow) {
// reset position to 0/0 within parent space
@@ -2052,7 +2097,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window fs: "+fullscreen+" "+x+"/"+y+" "+w+"x"+h+", "+isUndecorated()+
", virtl-screenSize: "+sviewport+", monitorsViewport "+viewport+
- ", spanning "+(0!=fs_span_flag)+" @ "+Thread.currentThread().getName());
+ ", spanning "+(0!=fs_span_flag)+
+ ", alwaysOnTop "+alwaysOnTop+(alwaysOnTopChange?"*":"")+
+ " @ "+Thread.currentThread().getName());
}
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
@@ -2079,9 +2126,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
parentWindowLocked = null;
}
try {
+ if(alwaysOnTopChange && fullscreen) {
+ // Enter fullscreen - Disable alwaysOnTop
+ reconfigureWindowImpl(nfs_x, nfs_y, nfs_width, nfs_height, getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible()));
+ }
reconfigureWindowImpl(x, y, w, h,
getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) |
fs_span_flag | FLAG_CHANGE_FULLSCREEN | FLAG_CHANGE_DECORATION, isVisible()) );
+ if(alwaysOnTopChange && !fullscreen) {
+ // Leave fullscreen - Restore alwaysOnTop
+ reconfigureWindowImpl(x, y, w, h, getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible()));
+ }
} finally {
if(null!=parentWindowLocked) {
parentWindowLocked.unlockSurface();
@@ -2129,11 +2184,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
fullscreenMonitors = monitors;
fullscreenUseMainMonitor = useMainMonitor;
if( fullScreenAction.init(fullscreen) ) {
- if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
+ if( fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow) ) {
// enable fullscreen on offscreen instance
if(null != parentWindow) {
nfs_parent = parentWindow;
- reparentWindow(null, -1, -1, true /* forceDestroyCreate */);
+ reparentWindow(null, -1, -1, REPARENT_HINT_FORCE_RECREATION | REPARENT_HINT_BECOMES_VISIBLE);
} else {
throw new InternalError("Offscreen instance w/o parent unhandled");
}
@@ -2143,7 +2198,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(!fullScreenAction.fsOn() && null != nfs_parent) {
// disable fullscreen on offscreen instance
- reparentWindow(nfs_parent, -1, -1, true /* forceDestroyCreate */);
+ reparentWindow(nfs_parent, -1, -1, REPARENT_HINT_FORCE_RECREATION | REPARENT_HINT_BECOMES_VISIBLE);
nfs_parent = null;
}
}
@@ -2364,25 +2419,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Native MouseEvents pre-processed to be enqueued or consumed directly
//
- public final void sendMouseEvent(short eventType, int modifiers,
- int x, int y, short button, float rotation) {
+ public final void sendMouseEvent(final short eventType, final int modifiers,
+ final int x, final int y, final short button, final float rotation) {
doMouseEvent(false, false, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
}
- public final void enqueueMouseEvent(boolean wait, short eventType, int modifiers,
- int x, int y, short button, float rotation) {
+ public final void enqueueMouseEvent(final boolean wait, final short eventType, final int modifiers,
+ final int x, final int y, final short button, final float rotation) {
doMouseEvent(true, wait, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
}
- protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers,
- int x, int y, short button, float rotation) {
+ protected final void doMouseEvent(final boolean enqueue, final boolean wait, final short eventType, final int modifiers,
+ final int x, final int y, final short button, final float rotation) {
doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
}
/**
- public final void sendMouseEvent(short eventType, int modifiers,
- int x, int y, short button, float[] rotationXYZ, float rotationScale) {
+ public final void sendMouseEvent(final short eventType, final int modifiers,
+ final int x, final int y, final short button, final float[] rotationXYZ, final float rotationScale) {
doMouseEvent(false, false, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
}
- public final void enqueueMouseEvent(boolean wait, short eventType, int modifiers,
- int x, int y, short button, float[] rotationXYZ, float rotationScale) {
+ public final void enqueueMouseEvent(final boolean wait, final short eventType, final int modifiers,
+ final int x, final int y, final short button, final float[] rotationXYZ, final float rotationScale) {
doMouseEvent(true, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
} */
@@ -2393,8 +2448,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
* @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
*/
- protected void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers,
- int x, int y, short button, final float[] rotationXYZ, float rotationScale) {
+ protected void doMouseEvent(final boolean enqueue, final boolean wait, final short eventType, final int modifiers,
+ final int x, final int y, final short button, final float[] rotationXYZ, final float rotationScale) {
if( 0 > button || button > MouseEvent.BUTTON_COUNT ) {
throw new NativeWindowException("Invalid mouse button number" + button);
}
@@ -2415,6 +2470,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* using a hash-map if <code>normalPNames</code> is <code>false</code>.
* Otherwise a simple <code>int</code> to <code>short</code> type cast is performed.
* </p>
+ * <p>
+ * See {@link #doPointerEvent(boolean, boolean, PointerType[], short, int, int, short[], int[], int[], float[], float, float[], float)}
+ * for details!
+ * </p>
*
* @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
@@ -2432,10 +2491,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param pPressure Pressure for each pointer (multiple pointer)
* @param maxPressure Maximum pointer pressure for all pointer
*/
- public final void doPointerEvent(boolean enqueue, boolean wait,
- final PointerType[] pTypes, short eventType, int modifiers,
- int actionIdx, boolean normalPNames, final int[] pNames,
- final int[] pX, final int[] pY, float[] pPressure,
+ public final void doPointerEvent(final boolean enqueue, final boolean wait,
+ final PointerType[] pTypes, final short eventType, final int modifiers,
+ final int actionIdx, final boolean normalPNames, final int[] pNames,
+ final int[] pX, final int[] pY, final float[] pPressure,
float maxPressure, final float[] rotationXYZ, final float rotationScale) {
final int pCount = pNames.length;
final short[] pIDs = new short[pCount];
@@ -2468,11 +2527,29 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
/**
- * Send multiple-pointer event either to be directly consumed or to be enqueued
+ * Send multiple-pointer event either to be directly consumed or to be enqueued.
+ * <p>
+ * Pointer/Mouse Processing Pass 1 (Pass 2 is performed in {@link #consumePointerEvent(MouseEvent)}.
+ * </p>
+ * <p>
+ * Usually directly called by event source to enqueue and process event.
+ * </p>
* <p>
* The index for the element of multiple-pointer arrays represents the pointer which triggered the event
* is passed via <i>actionIdx</i>.
* </p>
+ * <p>
+ * <ul>
+ * <li>Determine ENTERED/EXITED state</li>
+ * <li>Remove redundant move/drag events</li>
+ * <li>Reset states if applicable</li>
+ * <li>Drop exterior events</li>
+ * <li>Determine CLICK COUNT</li>
+ * <li>Ignore sent CLICKED</li>
+ * <li>Track buttonPressed incl. buttonPressedMask</li>
+ * <li>Synthesize DRAGGED event (from MOVED if pointer is pressed)</li>
+ * </ul>
+ * </p>
*
* @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
* otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
@@ -2488,10 +2565,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param pPressure Pressure for each pointer (multiple pointer)
* @param maxPressure Maximum pointer pressure for all pointer
*/
- public final void doPointerEvent(boolean enqueue, boolean wait,
- final PointerType[] pTypes, short eventType, int modifiers,
- int pActionIdx, final short[] pID, final int[] pX, final int[] pY, final float[] pPressure,
- float maxPressure, final float[] rotationXYZ, float rotationScale) {
+ public final void doPointerEvent(final boolean enqueue, final boolean wait,
+ final PointerType[] pTypes, final short eventType, int modifiers,
+ final int pActionIdx, final short[] pID, final int[] pX, final int[] pY, final float[] pPressure,
+ final float maxPressure, final float[] rotationXYZ, final float rotationScale) {
final long when = System.currentTimeMillis();
final int pCount = pTypes.length;
@@ -2542,9 +2619,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
int x = pX[0];
int y = pY[0];
+ final boolean insideWindow = x >= 0 && y >= 0 && x < getWidth() && y < getHeight();
final Point movePositionP0 = pState1.getMovePosition(id);
switch( eventType ) {
case MouseEvent.EVENT_MOUSE_EXITED:
+ if( pState1.dragging ) {
+ // Drop mouse EXIT if dragging, i.e. due to exterior dragging outside of window.
+ // NOTE-1: X11 produces the 'premature' EXIT, however it also produces 'EXIT' after exterior dragging!
+ // NOTE-2: consumePointerEvent(MouseEvent) will synthesize a missing EXIT event!
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("doPointerEvent: drop "+MouseEvent.getEventTypeString(eventType)+" due to dragging: "+pState1);
+ }
+ return;
+ }
if( null != movePositionP0 ) {
if( x==-1 && y==-1 ) {
x = movePositionP0.getX();
@@ -2555,21 +2642,35 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Fall through intended!
case MouseEvent.EVENT_MOUSE_ENTERED:
+ if( eventType == MouseEvent.EVENT_MOUSE_ENTERED ) {
+ pState1.insideWindow = true;
+ pState1.exitSent = false;
+ } else {
+ pState1.insideWindow = false;
+ pState1.exitSent = true;
+ }
+ pState1.clearButton();
+ if( pTypes[0] != PointerType.Mouse ) {
+ // Drop !MOUSE ENTER/EXIT Events - Safeguard for non compliant implementations only.
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("doPointerEvent: drop "+MouseEvent.getEventTypeString(eventType)+" due to !Mouse but "+pTypes[0]+": "+pState1);
+ }
+ return;
+ }
// clip coordinates to window dimension
x = Math.min(Math.max(x, 0), getWidth()-1);
y = Math.min(Math.max(y, 0), getHeight()-1);
- pState1.insideWindow = eventType == MouseEvent.EVENT_MOUSE_ENTERED;
- pState1.clearButton();
break;
case MouseEvent.EVENT_MOUSE_MOVED:
case MouseEvent.EVENT_MOUSE_DRAGGED:
if( null != movePositionP0 ) {
- if( pState1.insideWindow && movePositionP0.getX() == x && movePositionP0.getY() == y ) {
+ if( movePositionP0.getX() == x && movePositionP0.getY() == y ) {
+ // Drop same position
if(DEBUG_MOUSE_EVENT) {
- System.err.println("doPointerEvent: skip "+MouseEvent.getEventTypeString(eventType)+" w/ same position: "+movePositionP0);
+ System.err.println("doPointerEvent: drop "+MouseEvent.getEventTypeString(eventType)+" w/ same position: "+movePositionP0+", "+pState1);
}
- return; // skip same position
+ return;
}
movePositionP0.set(x, y);
}
@@ -2577,22 +2678,30 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Fall through intended !
default:
- if(!pState1.insideWindow) {
- pState1.insideWindow = true;
+ if( pState1.insideWindow != insideWindow ) {
+ // ENTER/EXIT!
+ pState1.insideWindow = insideWindow;
+ if( insideWindow ) {
+ pState1.exitSent = false;
+ }
pState1.clearButton();
}
}
- if( x < 0 || y < 0 || x >= getWidth() || y >= getHeight() ) {
+ //
+ // Drop exterior events if not dragging pointer and not EXIT event
+ // Safeguard for non compliant implementations!
+ //
+ if( !pState1.dragging && !insideWindow && MouseEvent.EVENT_MOUSE_EXITED != eventType ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("doPointerEvent: drop: "+MouseEvent.getEventTypeString(eventType)+
- ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0);
+ ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0+", insideWindow "+insideWindow+", "+pState1);
}
return; // .. invalid ..
}
if(DEBUG_MOUSE_EVENT) {
System.err.println("doPointerEvent: enqueue "+enqueue+", wait "+wait+", "+MouseEvent.getEventTypeString(eventType)+
- ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0);
+ ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0+", "+pState1);
}
final int buttonMask = InputEvent.getButtonMask(button);
@@ -2613,7 +2722,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// - Determine CLICK COUNT
// - Ignore sent CLICKED
// - Track buttonPressed incl. buttonPressedMask
- // - Fix MOVED/DRAGGED event
+ // - Synthesize DRAGGED event (from MOVED if pointer is pressed)
//
final MouseEvent e;
switch( eventType ) {
@@ -2642,6 +2751,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
break;
case MouseEvent.EVENT_MOUSE_RELEASED:
+ pState1.buttonPressedMask &= ~buttonMask;
if( 1 == pCount ) {
e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale);
@@ -2650,11 +2760,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pState1.lastButtonPressTime = 0;
}
pState1.buttonPressed = 0;
+ pState1.dragging = false;
} else {
e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale);
+ if( 0 == pState1.buttonPressedMask ) {
+ pState1.clearButton();
+ }
}
- pState1.buttonPressedMask &= ~buttonMask;
if( null != movePositionP0 ) {
movePositionP0.set(0, 0);
}
@@ -2663,6 +2776,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if ( 0 != pState1.buttonPressedMask ) { // any button or pointer move -> drag
e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, pState1.buttonPressed, (short)1, rotationXYZ, rotationScale);
+ pState1.dragging = true;
} else {
e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale);
@@ -2672,6 +2786,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if( 0 >= pPressure[0] ) {
pPressure[0] = maxPressure;
}
+ pState1.dragging = true;
// Fall through intended!
default:
e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
@@ -2680,174 +2795,111 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
doEvent(enqueue, wait, e); // actual mouse event
}
- @Override
- public final void addMouseListener(MouseListener l) {
- addMouseListener(-1, l);
- }
-
- @Override
- public final void addMouseListener(int index, MouseListener l) {
- if(l == null) {
- return;
- }
- @SuppressWarnings("unchecked")
- ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
- if(0>index) {
- index = clonedListeners.size();
- }
- clonedListeners.add(index, l);
- mouseListeners = clonedListeners;
- }
-
- @Override
- public final void removeMouseListener(MouseListener l) {
- if (l == null) {
- return;
- }
- @SuppressWarnings("unchecked")
- ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
- clonedListeners.remove(l);
- mouseListeners = clonedListeners;
- }
-
- @Override
- public final MouseListener getMouseListener(int index) {
- @SuppressWarnings("unchecked")
- ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
- if(0>index) {
- index = clonedListeners.size()-1;
- }
- return clonedListeners.get(index);
- }
-
- @Override
- public final MouseListener[] getMouseListeners() {
- return mouseListeners.toArray(new MouseListener[mouseListeners.size()]);
- }
-
- @Override
- public final void setDefaultGesturesEnabled(boolean enable) {
- defaultGestureHandlerEnabled = enable;
- }
- @Override
- public final boolean areDefaultGesturesEnabled() {
- return defaultGestureHandlerEnabled;
- }
-
- @Override
- public final void addGestureHandler(GestureHandler gh) {
- addGestureHandler(-1, gh);
- }
- @Override
- public final void addGestureHandler(int index, GestureHandler gh) {
- if(gh == null) {
- return;
- }
- @SuppressWarnings("unchecked")
- ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone();
- if(0>index) {
- index = cloned.size();
- }
- cloned.add(index, gh);
- pointerGestureHandler = cloned;
- }
- @Override
- public final void removeGestureHandler(GestureHandler gh) {
- if (gh == null) {
- return;
- }
- @SuppressWarnings("unchecked")
- ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone();
- cloned.remove(gh);
- pointerGestureHandler = cloned;
- }
- @Override
- public final void addGestureListener(GestureHandler.GestureListener gl) {
- addGestureListener(-1, gl);
- }
- @Override
- public final void addGestureListener(int index, GestureHandler.GestureListener gl) {
- if(gl == null) {
- return;
- }
- @SuppressWarnings("unchecked")
- ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone();
- if(0>index) {
- index = cloned.size();
- }
- cloned.add(index, gl);
- gestureListeners = cloned;
- }
- @Override
- public final void removeGestureListener(GestureHandler.GestureListener gl) {
- if (gl == null) {
- return;
- }
- @SuppressWarnings("unchecked")
- ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone();
- cloned.remove(gl);
- gestureListeners= cloned;
- }
-
private static int step(int lower, int edge, int value) {
return value < edge ? lower : value;
}
/**
- * Consume the {@link MouseEvent}, i.e.
- * <pre>
- * - validate
- * - handle gestures
- * - synthesize events if applicable (like gestures)
- * - dispatch event to listener
- * </pre>
+ * Consume the {@link MouseEvent}.
+ * <p>
+ * Pointer/Mouse Processing Pass 2 (Pass 1 is performed in {@link #doPointerEvent(boolean, boolean, PointerType[], short, int, int, short[], int[], int[], float[], float, float[], float)}).
+ * </p>
+ * <p>
+ * Invoked before dispatching the dequeued event.
+ * </p>
+ * <p>
+ * <ul>
+ * <li>Validate</li>
+ * <li>Handle gestures</li>
+ * <li>Synthesize events [ENTERED, EXIT, CLICK] and gestures.</li>
+ * <li>Drop exterior events</li>
+ * <li>Dispatch event to listener</li>
+ * </ul>
+ * </p>
*/
protected void consumePointerEvent(MouseEvent pe) {
int x = pe.getX();
int y = pe.getY();
if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumePointerEvent.in: "+pe);
+ System.err.println("consumePointerEvent.in: "+pe+", "+pState0+", pos "+x+"/"+y+" clientSize["+getWidth()+"x"+getHeight()+"]");
}
//
// - Determine ENTERED/EXITED state
- // - Synthesize ENTERED event
+ // - Synthesize ENTERED and EXIT event
// - Reset states if applicable
//
final long when = pe.getWhen();
- int eventType = pe.getEventType();
- final MouseEvent eEntered;
+ final int eventType = pe.getEventType();
+ final boolean insideWindow;
+ boolean eExitAllowed = false;
+ MouseEvent eEntered = null, eExited = null;
switch( eventType ) {
case MouseEvent.EVENT_MOUSE_EXITED:
+ if( pState0.exitSent || pState0.dragging ) {
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent: drop "+(pState0.exitSent?"already sent":"due to dragging")+": "+pe+", "+pState0);
+ }
+ return;
+ }
+ // Fall through intended !
case MouseEvent.EVENT_MOUSE_ENTERED:
// clip coordinates to window dimension
x = Math.min(Math.max(x, 0), getWidth()-1);
y = Math.min(Math.max(y, 0), getHeight()-1);
- pState0.insideWindow = eventType == MouseEvent.EVENT_MOUSE_ENTERED;
pState0.clearButton();
- eEntered = null;
+ if( eventType == MouseEvent.EVENT_MOUSE_ENTERED ) {
+ insideWindow = true;
+ pState0.insideWindow = true;
+ pState0.exitSent = false;
+ pState0.dragging = false;
+ } else {
+ insideWindow = false;
+ pState0.insideWindow = false;
+ pState0.exitSent = true;
+ }
break;
+ case MouseEvent.EVENT_MOUSE_MOVED:
+ case MouseEvent.EVENT_MOUSE_RELEASED:
+ if( 1 >= pe.getButtonDownCount() ) { // MOVE or RELEASE last button
+ eExitAllowed = !pState0.exitSent;
+ pState0.dragging = false;
+ }
+ // Fall through intended !
+
default:
- if(!pState0.insideWindow) {
- pState0.insideWindow = true;
+ insideWindow = x >= 0 && y >= 0 && x < getWidth() && y < getHeight();
+ if( pe.getPointerType(0) == PointerType.Mouse ) {
+ if( !pState0.insideWindow && insideWindow ) {
+ // ENTER .. use clipped coordinates
+ eEntered = new MouseEvent(MouseEvent.EVENT_MOUSE_ENTERED, pe.getSource(), pe.getWhen(), pe.getModifiers(),
+ Math.min(Math.max(x, 0), getWidth()-1),
+ Math.min(Math.max(y, 0), getHeight()-1),
+ (short)0, (short)0, pe.getRotation(), pe.getRotationScale());
+ pState0.exitSent = false;
+ } else if( !insideWindow && eExitAllowed ) {
+ // EXIT .. use clipped coordinates
+ eExited = new MouseEvent(MouseEvent.EVENT_MOUSE_EXITED, pe.getSource(), pe.getWhen(), pe.getModifiers(),
+ Math.min(Math.max(x, 0), getWidth()-1),
+ Math.min(Math.max(y, 0), getHeight()-1),
+ (short)0, (short)0, pe.getRotation(), pe.getRotationScale());
+ pState0.exitSent = true;
+ }
+ }
+ if( pState0.insideWindow != insideWindow || null != eEntered || null != eExited) {
pState0.clearButton();
- eEntered = pe.createVariant(MouseEvent.EVENT_MOUSE_ENTERED);
- } else {
- eEntered = null;
}
+ pState0.insideWindow = insideWindow;
}
if( null != eEntered ) {
if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumePointerEvent.send.0: "+eEntered);
+ System.err.println("consumePointerEvent.send.0: "+eEntered+", "+pState0);
}
dispatchMouseEvent(eEntered);
- } else if( x < 0 || y < 0 || x >= getWidth() || y >= getHeight() ) {
- if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumePointerEvent.drop: "+pe);
- }
- return; // .. invalid ..
+ } else if( DEBUG_MOUSE_EVENT && !insideWindow ) {
+ System.err.println("INFO consumePointerEvent.exterior: "+pState0+", "+pe);
}
//
@@ -2868,7 +2920,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
scaledScrollSlop = Math.round(DoubleTapScrollGesture.SCROLL_SLOP_MM * pixPerMM);
scaledDoubleTapSlop = Math.round(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM * pixPerMM);
if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumePointerEvent.gscroll: scrollSlop "+scaledScrollSlop+", doubleTapSlop "+scaledDoubleTapSlop+", pixPerMM "+pixPerMM+", "+monitor);
+ System.err.println("consumePointerEvent.gscroll: scrollSlop "+scaledScrollSlop+", doubleTapSlop "+scaledDoubleTapSlop+", pixPerMM "+pixPerMM+", "+monitor+", "+pState0);
}
} else {
scaledScrollSlop = DoubleTapScrollGesture.SCROLL_SLOP_PIXEL;
@@ -2881,7 +2933,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pe = (MouseEvent) gesture2PtrTouchScroll.getGestureEvent();
gesture2PtrTouchScroll.clear(false);
if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumePointerEvent.gscroll: "+pe);
+ System.err.println("consumePointerEvent.gscroll: "+pe+", "+pState0);
}
dispatchMouseEvent(pe);
return;
@@ -2924,46 +2976,160 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// - Synthesize mouse CLICKED
// - Ignore sent CLICKED
//
- final MouseEvent eClicked;
+ MouseEvent eClicked = null;
switch( eventType ) {
case MouseEvent.EVENT_MOUSE_PRESSED:
if( 1 == pe.getPointerCount() ) {
pState0.lastButtonPressTime = when;
}
- eClicked = null;
break;
case MouseEvent.EVENT_MOUSE_RELEASED:
if( 1 == pe.getPointerCount() && when - pState0.lastButtonPressTime < MouseEvent.getClickTimeout() ) {
eClicked = pe.createVariant(MouseEvent.EVENT_MOUSE_CLICKED);
} else {
- eClicked = null;
pState0.lastButtonPressTime = 0;
}
break;
case MouseEvent.EVENT_MOUSE_CLICKED:
// ignore - synthesized here ..
if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumePointerEvent: drop recv'ed (synth here) "+pe);
+ System.err.println("consumePointerEvent: drop recv'ed (synth here) "+pe+", "+pState0);
}
pe = null;
- eClicked = null;
break;
- default:
- eClicked = null;
+
+ case MouseEvent.EVENT_MOUSE_DRAGGED:
+ pState0.dragging = true;
+ break;
}
if( null != pe ) {
if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumePointerEvent.send.1: "+pe);
+ System.err.println("consumePointerEvent.send.1: "+pe+", "+pState0);
}
dispatchMouseEvent(pe); // actual mouse event
}
if( null != eClicked ) {
if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumePointerEvent.send.2: "+eClicked);
+ System.err.println("consumePointerEvent.send.2: "+eClicked+", "+pState0);
}
dispatchMouseEvent(eClicked);
}
+ if( null != eExited ) {
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent.send.3: "+eExited+", "+pState0);
+ }
+ dispatchMouseEvent(eExited);
+ }
+ }
+
+ @Override
+ public final void addMouseListener(MouseListener l) {
+ addMouseListener(-1, l);
+ }
+
+ @Override
+ public final void addMouseListener(int index, MouseListener l) {
+ if(l == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
+ if(0>index) {
+ index = clonedListeners.size();
+ }
+ clonedListeners.add(index, l);
+ mouseListeners = clonedListeners;
+ }
+
+ @Override
+ public final void removeMouseListener(MouseListener l) {
+ if (l == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
+ clonedListeners.remove(l);
+ mouseListeners = clonedListeners;
+ }
+
+ @Override
+ public final MouseListener getMouseListener(int index) {
+ @SuppressWarnings("unchecked")
+ ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
+ if(0>index) {
+ index = clonedListeners.size()-1;
+ }
+ return clonedListeners.get(index);
+ }
+
+ @Override
+ public final MouseListener[] getMouseListeners() {
+ return mouseListeners.toArray(new MouseListener[mouseListeners.size()]);
+ }
+
+ @Override
+ public final void setDefaultGesturesEnabled(boolean enable) {
+ defaultGestureHandlerEnabled = enable;
+ }
+ @Override
+ public final boolean areDefaultGesturesEnabled() {
+ return defaultGestureHandlerEnabled;
+ }
+
+ @Override
+ public final void addGestureHandler(GestureHandler gh) {
+ addGestureHandler(-1, gh);
+ }
+ @Override
+ public final void addGestureHandler(int index, GestureHandler gh) {
+ if(gh == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone();
+ if(0>index) {
+ index = cloned.size();
+ }
+ cloned.add(index, gh);
+ pointerGestureHandler = cloned;
+ }
+ @Override
+ public final void removeGestureHandler(GestureHandler gh) {
+ if (gh == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone();
+ cloned.remove(gh);
+ pointerGestureHandler = cloned;
+ }
+ @Override
+ public final void addGestureListener(GestureHandler.GestureListener gl) {
+ addGestureListener(-1, gl);
+ }
+ @Override
+ public final void addGestureListener(int index, GestureHandler.GestureListener gl) {
+ if(gl == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone();
+ if(0>index) {
+ index = cloned.size();
+ }
+ cloned.add(index, gl);
+ gestureListeners = cloned;
+ }
+ @Override
+ public final void removeGestureListener(GestureHandler.GestureListener gl) {
+ if (gl == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone();
+ cloned.remove(gl);
+ gestureListeners= cloned;
}
private final void dispatchMouseEvent(MouseEvent e) {
@@ -3007,7 +3173,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private final IntBitfield keyPressedState = new IntBitfield( keyTrackingRange + 1 );
protected final boolean isKeyCodeTracked(final short keyCode) {
- return ( 0xFFFF & (int)keyCode ) <= keyTrackingRange;
+ return ( 0xFFFF & keyCode ) <= keyTrackingRange;
}
/**
@@ -3016,7 +3182,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @return the previus pressed value
*/
protected final boolean setKeyPressed(short keyCode, boolean pressed) {
- final int v = 0xFFFF & (int)keyCode;
+ final int v = 0xFFFF & keyCode;
if( v <= keyTrackingRange ) {
return keyPressedState.put(v, pressed);
}
@@ -3027,7 +3193,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @return true if pressed, otherwise false
*/
protected final boolean isKeyPressed(short keyCode) {
- final int v = 0xFFFF & (int)keyCode;
+ final int v = 0xFFFF & keyCode;
if( v <= keyTrackingRange ) {
return keyPressedState.get(v);
}
@@ -3167,11 +3333,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
@Override
public void sendWindowEvent(int eventType) {
- consumeWindowEvent( new WindowEvent((short)eventType, this, System.currentTimeMillis()) ); // FIXME
+ consumeWindowEvent( new WindowEvent((short)eventType, this, System.currentTimeMillis()) );
}
public void enqueueWindowEvent(boolean wait, int eventType) {
- enqueueEvent( wait, new WindowEvent((short)eventType, this, System.currentTimeMillis()) ); // FIXME
+ enqueueEvent( wait, new WindowEvent((short)eventType, this, System.currentTimeMillis()) );
}
@Override
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
index 4bcb0fc..e152d96 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
@@ -50,95 +50,120 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
super(downstream);
this.downstreamParent = downstreamParent;
}
+ public AWTParentWindowAdapter() {
+ super();
+ }
+ public AWTParentWindowAdapter setDownstream(NativeWindow downstreamParent, com.jogamp.newt.Window downstream) {
+ setDownstream(downstream);
+ this.downstreamParent = downstreamParent;
+ return this;
+ }
@Override
- public AWTAdapter addTo(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter clear() {
+ super.clear();
+ this.downstreamParent = null;
+ return this;
+ }
+
+ @Override
+ public synchronized AWTAdapter addTo(java.awt.Component awtComponent) {
awtComponent.addHierarchyListener(this);
return super.addTo(awtComponent);
}
@Override
- public AWTAdapter removeFrom(java.awt.Component awtComponent) {
+ public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeHierarchyListener(this);
return super.removeFrom(awtComponent);
}
@Override
- public void focusGained(java.awt.event.FocusEvent e) {
+ public synchronized void focusGained(java.awt.event.FocusEvent e) {
+ if( !isSetup ) { return; }
// forward focus to NEWT child
final com.jogamp.newt.Window newtChild = getNewtWindow();
- final boolean isOnscreen = newtChild.isNativeValid() && newtChild.getGraphicsConfiguration().getChosenCapabilities().isOnscreen();
- final boolean isParent = downstreamParent == newtChild.getParent();
- final boolean isFullscreen = newtChild.isFullscreen();
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("AWT: focusGained: onscreen "+ isOnscreen+", "+e+", isParent: "+isParent+", isFS "+isFullscreen);
- }
- if(isParent) {
- if(isOnscreen && !isFullscreen) {
- KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ if( null != newtChild ) {
+ final boolean isOnscreen = newtChild.isNativeValid() && newtChild.getGraphicsConfiguration().getChosenCapabilities().isOnscreen();
+ final boolean isParent = downstreamParent == newtChild.getParent();
+ final boolean isFullscreen = newtChild.isFullscreen();
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("AWT: focusGained: onscreen "+ isOnscreen+", "+e+", isParent: "+isParent+", isFS "+isFullscreen);
+ }
+ if(isParent) {
+ if(isOnscreen && !isFullscreen) {
+ KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ }
+ newtChild.requestFocus(false);
}
- newtChild.requestFocus(false);
}
}
@Override
- public void focusLost(java.awt.event.FocusEvent e) {
+ public synchronized void focusLost(java.awt.event.FocusEvent e) {
+ if( !isSetup ) { return; }
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: focusLost: "+ e);
}
}
@Override
- public void componentResized(java.awt.event.ComponentEvent e) {
+ public synchronized void componentResized(java.awt.event.ComponentEvent e) {
+ if( !isSetup ) { return; }
// Need to resize the NEWT child window
// the resized event will be send via the native window feedback.
final java.awt.Component comp = e.getComponent();
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: componentResized: "+comp);
}
- final Window newtWindow = getNewtWindow();
- newtWindow.runOnEDTIfAvail(false, new Runnable() {
- @Override
- public void run() {
- int cw = comp.getWidth();
- int ch = comp.getHeight();
- if( 0 < cw && 0 < ch ) {
- if( newtWindow.getWidth() != cw || newtWindow.getHeight() != ch ) {
- newtWindow.setSize(cw, ch);
- if(comp.isVisible() != newtWindow.isVisible()) {
- newtWindow.setVisible(comp.isVisible());
+ final Window newtChild = getNewtWindow();
+ if( null != newtChild ) {
+ newtChild.runOnEDTIfAvail(false, new Runnable() {
+ @Override
+ public void run() {
+ int cw = comp.getWidth();
+ int ch = comp.getHeight();
+ if( 0 < cw && 0 < ch ) {
+ if( newtChild.getWidth() != cw || newtChild.getHeight() != ch ) {
+ newtChild.setSize(cw, ch);
+ if(comp.isVisible() != newtChild.isVisible()) {
+ newtChild.setVisible(comp.isVisible());
+ }
}
+ } else if(newtChild.isVisible()) {
+ newtChild.setVisible(false);
}
- } else if(newtWindow.isVisible()) {
- newtWindow.setVisible(false);
- }
- }});
+ }});
+ }
}
@Override
- public void componentMoved(java.awt.event.ComponentEvent e) {
+ public synchronized void componentMoved(java.awt.event.ComponentEvent e) {
+ if( !isSetup ) { return; }
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: componentMoved: "+e);
}
- final Window newtWindow = getNewtWindow();
- if(newtWindow.getDelegatedWindow() instanceof DriverUpdatePosition) {
- ((DriverUpdatePosition)newtWindow.getDelegatedWindow()).updatePosition(0, 0);
+ final Window newtChild = getNewtWindow();
+ if( null != newtChild && ( newtChild.getDelegatedWindow() instanceof DriverUpdatePosition ) ) {
+ ((DriverUpdatePosition)newtChild.getDelegatedWindow()).updatePosition(0, 0);
}
}
@Override
- public void windowActivated(java.awt.event.WindowEvent e) {
+ public synchronized void windowActivated(java.awt.event.WindowEvent e) {
// no propagation to NEWT child window
}
@Override
- public void windowDeactivated(java.awt.event.WindowEvent e) {
+ public synchronized void windowDeactivated(java.awt.event.WindowEvent e) {
// no propagation to NEWT child window
}
@Override
- public void hierarchyChanged(java.awt.event.HierarchyEvent e) {
- if( null == getNewtEventListener() ) {
+ public synchronized void hierarchyChanged(java.awt.event.HierarchyEvent e) {
+ if( !isSetup ) { return; }
+ final Window newtChild = getNewtWindow();
+ if( null != newtChild && null == getNewtEventListener() ) {
long bits = e.getChangeFlags();
final java.awt.Component changed = e.getChanged();
if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) {
@@ -146,11 +171,11 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: hierarchyChanged SHOWING_CHANGED: showing "+showing+", "+changed+", source "+e.getComponent());
}
- getNewtWindow().runOnEDTIfAvail(false, new Runnable() {
+ newtChild.runOnEDTIfAvail(false, new Runnable() {
@Override
public void run() {
- if(getNewtWindow().isVisible() != showing) {
- getNewtWindow().setVisible(showing);
+ if(newtChild.isVisible() != showing) {
+ newtChild.setVisible(showing);
}
}});
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java b/src/newt/classes/jogamp/newt/driver/android/NewtDebugActivity.java
similarity index 80%
copy from src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java
copy to src/newt/classes/jogamp/newt/driver/android/NewtDebugActivity.java
index c407843..40a6ec6 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtDebugActivity.java
@@ -1,16 +1,16 @@
/**
- * Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright 2013 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,22 +20,19 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
-package com.jogamp.opengl.test.junit.util;
+package jogamp.newt.driver.android;
-import java.util.EventObject;
-import java.util.List;
+import android.os.Bundle;
-public interface InputEventCountAdapter extends EventCountAdapter {
- int getCount();
- boolean isPressed();
-
- public List<EventObject> getQueued();
- public int getQueueSize();
-}
+public class NewtDebugActivity extends NewtVersionBaseActivity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate("NewtDebugActivity - DEBUG MODE", savedInstanceState);
+ }
+}
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java b/src/newt/classes/jogamp/newt/driver/android/NewtDebugActivityLauncher.java
similarity index 65%
copy from src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java
copy to src/newt/classes/jogamp/newt/driver/android/NewtDebugActivityLauncher.java
index 9b3c6e2..9d16fde 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtDebugActivityLauncher.java
@@ -6,16 +6,16 @@ import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
-public class NewtVersionActivityLauncher extends Activity {
+public class NewtDebugActivityLauncher extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtVersionActivity?sys=com.jogamp.common&sys=javax.media.opengl&pkg=com.jogamp.opengl.test");
- final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri);
+
+ final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtDebugActivity?sys=com.jogamp.common&sys=javax.media.opengl&pkg=com.jogamp.opengl.test&jogamp.debug=all&nativewindow.debug=all&jogl.debug=all&newt.debug=all");
+ final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri);
Log.d(getClass().getSimpleName(), "Launching Activity: "+intent);
startActivity (intent);
-
+
finish(); // done
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
index 9f62102..8a7f3af 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,90 +20,18 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
package jogamp.newt.driver.android;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLProfile;
-
-import com.jogamp.common.GlueGenVersion;
-import com.jogamp.common.os.Platform;
-import com.jogamp.common.util.VersionUtil;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.JoglVersion;
-
import android.os.Bundle;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.ViewGroup.LayoutParams;
-import android.widget.ScrollView;
-import android.widget.TextView;
-public class NewtVersionActivity extends NewtBaseActivity {
+public class NewtVersionActivity extends NewtVersionBaseActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setFullscreenFeature(getWindow(), true);
-
- final android.view.ViewGroup viewGroup = new android.widget.FrameLayout(getActivity().getApplicationContext());
- getWindow().setContentView(viewGroup);
-
- final TextView tv = new TextView(getActivity());
- final ScrollView scroller = new ScrollView(getActivity());
- scroller.addView(tv);
- viewGroup.addView(scroller, new android.widget.FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, Gravity.TOP|Gravity.LEFT));
-
- final String info1 = VersionUtil.getPlatformInfo()+Platform.NEWLINE+GlueGenVersion.getInstance()+Platform.NEWLINE+JoglVersion.getInstance()+Platform.NEWLINE;
- Log.d(MD.TAG, info1);
- tv.setText(info1);
-
- // create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
- GLWindow glWindow = GLWindow.create(caps);
- glWindow.setUndecorated(true);
- glWindow.setSize(32, 32);
- glWindow.setPosition(0, 0);
- final android.view.View androidGLView = ((WindowDriver)glWindow.getDelegatedWindow()).getAndroidView();
- viewGroup.addView(androidGLView, new android.widget.FrameLayout.LayoutParams(glWindow.getWidth(), glWindow.getHeight(), Gravity.BOTTOM|Gravity.RIGHT));
- registerNEWTWindow(glWindow);
-
- glWindow.addGLEventListener(new GLEventListener() {
- public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
- final StringBuilder sb = new StringBuilder();
- sb.append(JoglVersion.getGLInfo(gl, null, true)).append(Platform.NEWLINE);
- sb.append("Requested: ").append(Platform.NEWLINE);
- sb.append(drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()).append(Platform.NEWLINE).append(Platform.NEWLINE);
- sb.append("Chosen: ").append(Platform.NEWLINE);
- sb.append(drawable.getChosenGLCapabilities()).append(Platform.NEWLINE).append(Platform.NEWLINE);
- final String info2 = sb.toString();
- // Log.d(MD.TAG, info2); // too big!
- System.err.println(info2);
- viewGroup.post(new Runnable() {
- public void run() {
- tv.append(info2);
- viewGroup.removeView(androidGLView);
- } } );
- }
-
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- }
-
- public void display(GLAutoDrawable drawable) {
- }
-
- public void dispose(GLAutoDrawable drawable) {
- }
- });
- glWindow.setVisible(true);
- Log.d(MD.TAG, "onCreate - X");
- }
+ super.onCreate("NewtVersionActivity - NORMAL MODE", savedInstanceState);
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java
index 9b3c6e2..3374e41 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java
@@ -10,12 +10,12 @@ public class NewtVersionActivityLauncher extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
+
final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtVersionActivity?sys=com.jogamp.common&sys=javax.media.opengl&pkg=com.jogamp.opengl.test");
- final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri);
+ final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri);
Log.d(getClass().getSimpleName(), "Launching Activity: "+intent);
startActivity (intent);
-
+
finish(); // done
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionBaseActivity.java
new file mode 100644
index 0000000..f24fb20
--- /dev/null
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionBaseActivity.java
@@ -0,0 +1,120 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.newt.driver.android;
+
+import javax.media.opengl.GL;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+
+import com.jogamp.common.GlueGenVersion;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.VersionUtil;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.JoglVersion;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.ViewGroup.LayoutParams;
+import android.widget.ScrollView;
+import android.widget.TextView;
+
+public class NewtVersionBaseActivity extends NewtBaseActivity {
+
+ public void onCreate(String prefix, Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setFullscreenFeature(getWindow(), true);
+
+ final android.view.ViewGroup viewGroup = new android.widget.FrameLayout(getActivity().getApplicationContext());
+ getWindow().setContentView(viewGroup);
+
+ final TextView tv = new TextView(getActivity());
+ final ScrollView scroller = new ScrollView(getActivity());
+ scroller.addView(tv);
+ viewGroup.addView(scroller, new android.widget.FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, Gravity.TOP|Gravity.LEFT));
+
+ final String info1 = prefix+Platform.NEWLINE+VersionUtil.getPlatformInfo()+Platform.NEWLINE+GlueGenVersion.getInstance()+Platform.NEWLINE+JoglVersion.getInstance()+Platform.NEWLINE;
+ Log.d(MD.TAG, info1);
+ tv.setText(info1);
+
+ final GLProfile glp;
+ if( GLProfile.isAvailable(GLProfile.GL2ES2) ) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ } else if( GLProfile.isAvailable(GLProfile.GL2ES1) ) {
+ glp = GLProfile.get(GLProfile.GL2ES1);
+ } else {
+ glp = null;
+ tv.append("No GLProfile GL2ES2 nor GL2ES1 available!");
+ }
+ if( null != glp ) {
+ // create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
+ GLCapabilities caps = new GLCapabilities(glp);
+ GLWindow glWindow = GLWindow.create(caps);
+ glWindow.setUndecorated(true);
+ glWindow.setSize(32, 32);
+ glWindow.setPosition(0, 0);
+ final android.view.View androidGLView = ((WindowDriver)glWindow.getDelegatedWindow()).getAndroidView();
+ viewGroup.addView(androidGLView, new android.widget.FrameLayout.LayoutParams(glWindow.getWidth(), glWindow.getHeight(), Gravity.BOTTOM|Gravity.RIGHT));
+ registerNEWTWindow(glWindow);
+
+ glWindow.addGLEventListener(new GLEventListener() {
+ public void init(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ final StringBuilder sb = new StringBuilder();
+ sb.append(JoglVersion.getGLInfo(gl, null, true)).append(Platform.NEWLINE);
+ sb.append("Requested: ").append(Platform.NEWLINE);
+ sb.append(drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()).append(Platform.NEWLINE).append(Platform.NEWLINE);
+ sb.append("Chosen: ").append(Platform.NEWLINE);
+ sb.append(drawable.getChosenGLCapabilities()).append(Platform.NEWLINE).append(Platform.NEWLINE);
+ final String info2 = sb.toString();
+ // Log.d(MD.TAG, info2); // too big!
+ System.err.println(info2);
+ viewGroup.post(new Runnable() {
+ public void run() {
+ tv.append(info2);
+ viewGroup.removeView(androidGLView);
+ } } );
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ }
+ });
+ glWindow.setVisible(true);
+ }
+ Log.d(MD.TAG, "onCreate - X");
+ }
+}
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
index 9da671d..d1b30f7 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
@@ -39,7 +39,6 @@ import javax.media.nativewindow.NativeWindowException;
import jogamp.newt.NEWTJNILibLoader;
import jogamp.opengl.egl.EGL;
-import jogamp.opengl.egl.EGLDisplayUtil;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 7db3e2a..641d743 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -170,14 +170,20 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected void requestFocusImpl(final boolean force) {
+ final boolean _isFullscreen = isFullscreen();
+ final boolean _isOffscreenInstance = isOffscreenInstance;
if(DEBUG_IMPLEMENTATION) {
- System.err.println("MacWindow: requestFocusImpl(), isOffscreenInstance "+isOffscreenInstance);
+ System.err.println("MacWindow: requestFocusImpl(), isOffscreenInstance "+_isOffscreenInstance+", isFullscreen "+_isFullscreen);
}
- if(!isOffscreenInstance) {
+ if(!_isOffscreenInstance) {
OSXUtil.RunOnMainThread(false, new Runnable() {
@Override
public void run() {
requestFocus0(getWindowHandle(), force);
+ if(_isFullscreen) {
+ // 'NewtMacWindow::windowDidBecomeKey()' is not always called in fullscreen-mode!
+ focusChanged(false, true);
+ }
} } );
} else {
focusChanged(false, true);
@@ -516,7 +522,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
public void run() {
initWindow0( parentWinHandle, newWin, pS.getX(), pS.getY(), width, height,
- isOpaque, fullscreen, visible && !offscreenInstance, surfaceHandle);
+ isOpaque, visible && !offscreenInstance, surfaceHandle);
if( offscreenInstance ) {
orderOut0(0!=parentWinHandle ? parentWinHandle : newWin);
} else {
@@ -534,8 +540,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private native long createView0(int x, int y, int w, int h, boolean fullscreen);
private native long createWindow0(int x, int y, int w, int h, boolean fullscreen, int windowStyle, int backingStoreType, long view);
/** Must be called on Main-Thread */
- private native void initWindow0(long parentWindow, long window, int x, int y, int w, int h,
- boolean opaque, boolean fullscreen, boolean visible, long view);
+ private native void initWindow0(long parentWindow, long window, int x, int y, int w, int h, boolean opaque, boolean visible, long view);
private native boolean lockSurface0(long window, long view);
private native boolean unlockSurface0(long window, long view);
/** Must be called on Main-Thread */
diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
index d8ff7ec..c4cfd98 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
@@ -51,7 +51,7 @@ public class DisplayDriver extends DisplayImpl {
static {
NEWTJNILibLoader.loadNEWT();
- sharedClassFactory = new RegisteredClassFactory(newtClassBaseName, WindowDriver.getNewtWndProc0());
+ sharedClassFactory = new RegisteredClassFactory(newtClassBaseName, WindowDriver.getNewtWndProc0(), false /* useDummyDispatchThread */);
if (!WindowDriver.initIDs0(RegisteredClassFactory.getHInstance())) {
throw new NativeWindowException("Failed to initialize WindowsWindow jmethodIDs");
diff --git a/src/newt/native/InputEvent.h b/src/newt/native/InputEvent.h
index 3fa7dbe..2de46f8 100644
--- a/src/newt/native/InputEvent.h
+++ b/src/newt/native/InputEvent.h
@@ -50,6 +50,12 @@
#define EVENT_BUTTON8_MASK (1 << 12)
#define EVENT_BUTTON9_MASK (1 << 13)
+/** 16 buttons */
+#define EVENT_BUTTONLAST_MASK (1 << 20)
+
+/** 16 buttons */
+#define EVENT_BUTTONALL_MASK ( 0xffff << 5 )
+
#define EVENT_AUTOREPEAT_MASK (1 << 29)
#define EVENT_CONFINED_MASK (1 << 30)
#define EVENT_INVISIBLE_MASK (1 << 31)
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index f0ed170..30d3458 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -693,11 +693,12 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_createWindow
*/
JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_initWindow0
(JNIEnv *env, jobject jthis, jlong parent, jlong window, jint x, jint y, jint w, jint h,
- jboolean opaque, jboolean fullscreen, jboolean visible, jlong jview)
+ jboolean opaque, jboolean visible, jlong jview)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NewtMacWindow* myWindow = (NewtMacWindow*) ((intptr_t) window);
NewtView* myView = (NewtView*) (intptr_t) jview ;
+ BOOL fullscreen = myWindow->isFullscreenWindow;
DBG_PRINT( "initWindow0 - %p (this), %p (parent), %p (window), %d/%d %dx%d, opaque %d, fs %d, visible %d, view %p (START)\n",
(void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, (int)x, (int)y, (int)w, (int)h,
@@ -824,16 +825,6 @@ NS_ENDHANDLER
// [myView lockFocus];
// [myView unlockFocus];
-NS_DURING
- // Available >= 10.5 - Makes the menubar disapear
- if( fullscreen ) {
- if ( [myView respondsToSelector:@selector(enterFullScreenMode:withOptions:)] ) {
- [myView enterFullScreenMode: myScreen withOptions:NULL];
- }
- }
-NS_HANDLER
-NS_ENDHANDLER
-
// Set the next responder to be the window so that we can forward
// right mouse button down events
[myView setNextResponder: myWindow];
@@ -847,6 +838,30 @@ NS_ENDHANDLER
DBG_PRINT( "initWindow0.%d - %p (this), %p (parent): new window: %p, view %p\n",
dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView);
+NS_DURING
+ if( fullscreen ) {
+ /**
+ * See Bug 914: We don't use exclusive fullscreen anymore (capturing display)
+ * allowing ALT-TAB to allow process/app switching!
+ * Shall have no penalty on modern GPU and is also recommended, see bottom box @
+ * <https://developer.apple.com/library/mac/documentation/graphicsimaging/Conceptual/QuartzDisplayServicesConceptual/Articles/DisplayCapture.html>
+ *
+ if ( [myView respondsToSelector:@selector(enterFullScreenMode:withOptions:)] ) {
+ // Available >= 10.5 - Makes the menubar disapear
+ [myView enterFullScreenMode: myScreen withOptions:NULL];
+ } */
+ if( myWindow->hasPresentationSwitch ) {
+ DBG_PRINT( "initWindow0.%d - %p view %p, setPresentationOptions 0x%X\n",
+ dbgIdx++, myWindow, myView, (int)myWindow->fullscreenPresentationOptions);
+ [NSApp setPresentationOptions: myWindow->fullscreenPresentationOptions];
+ }
+ }
+NS_HANDLER
+NS_ENDHANDLER
+
+ DBG_PRINT( "initWindow0.%d - %p (this), %p (parent): new window: %p, view %p\n",
+ dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView);
+
[pool release];
DBG_PRINT( "initWindow0.X - %p (this), %p (parent): new window: %p, view %p\n",
(void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView);
@@ -877,6 +892,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_close0
return;
}
NewtView* mView = (NewtView *)[mWin contentView];
+ BOOL fullscreen = mWin->isFullscreenWindow;
BOOL destroyNotifySent, isNSView, isNewtView;
if( NULL != mView ) {
isNSView = [mView isKindOfClass:[NSView class]];
@@ -888,8 +904,8 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_close0
destroyNotifySent = false;
}
- DBG_PRINT( "windowClose.0 - %p, destroyNotifySent %d, view %p [isNSView %d, isNewtView %d], parent %p\n",
- mWin, destroyNotifySent, mView, isNSView, isNewtView, pWin);
+ DBG_PRINT( "windowClose.0 - %p, destroyNotifySent %d, view %p [isNSView %d, isNewtView %d], fullscreen %d, parent %p\n",
+ mWin, destroyNotifySent, mView, isNSView, isNewtView, (int)fullscreen, pWin);
[mWin setRealized: NO];
@@ -900,8 +916,10 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_close0
}
NS_DURING
+ /**
+ * See Bug 914: We don't use exclusive fullscreen anymore (capturing display)
+ * See initWindow0(..) above ..
if(NULL!=mView) {
- // Available >= 10.5 - Makes the menubar disapear
BOOL iifs;
if ( [mView respondsToSelector:@selector(isInFullScreenMode)] ) {
iifs = [mView isInFullScreenMode];
@@ -911,7 +929,15 @@ NS_DURING
if(iifs && [mView respondsToSelector:@selector(exitFullScreenModeWithOptions:)] ) {
[mView exitFullScreenModeWithOptions: NULL];
}
- // Note: mWin's release will also release it's mView!
+ } */
+ // Note: mWin's release will also release it's mView!
+ DBG_PRINT( "windowClose.1a - %p view %p, fullscreen %d, hasPresSwitch %d, defaultPresentationOptions 0x%X\n",
+ mWin, mView, (int)fullscreen, (int)mWin->hasPresentationSwitch, (int)mWin->defaultPresentationOptions);
+
+ if( fullscreen && mWin->hasPresentationSwitch ) {
+ DBG_PRINT( "windowClose.1b - %p view %p, setPresentationOptions 0x%X\n",
+ mWin, mView, (int)mWin->defaultPresentationOptions);
+ [NSApp setPresentationOptions: mWin->defaultPresentationOptions];
}
NS_HANDLER
NS_ENDHANDLER
@@ -921,7 +947,7 @@ NS_ENDHANDLER
}
[mWin orderOut: mWin];
- DBG_PRINT( "windowClose.1 - %p view %p, parent %p\n", mWin, mView, pWin);
+ DBG_PRINT( "windowClose.2 - %p view %p, parent %p\n", mWin, mView, pWin);
[mWin release];
@@ -1195,7 +1221,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setAlwaysOnTo
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSWindow* win = (NSWindow*) ((intptr_t) window);
- DBG_PRINT( "setAlwaysOnTop0 - window: %p (START)\n", win);
+ DBG_PRINT( "setAlwaysOnTop0 - window: %p, atop %d (START)\n", win, (int)atop);
if(atop) {
[win setLevel:NSFloatingWindowLevel];
@@ -1203,7 +1229,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setAlwaysOnTo
[win setLevel:NSNormalWindowLevel];
}
- DBG_PRINT( "setAlwaysOnTop0 - window: %p (END)\n", win);
+ DBG_PRINT( "setAlwaysOnTop0 - window: %p, atop %d (END)\n", win, (int)atop);
[pool release];
}
diff --git a/src/newt/native/NewtMacWindow.h b/src/newt/native/NewtMacWindow.h
index c9d53f5..ba60b56 100644
--- a/src/newt/native/NewtMacWindow.h
+++ b/src/newt/native/NewtMacWindow.h
@@ -110,7 +110,6 @@
@interface NewtMacWindow : NSWindow
#endif
{
- BOOL isFullscreenWindow;
BOOL mouseConfined;
BOOL mouseVisible;
BOOL mouseInside;
@@ -119,6 +118,10 @@
BOOL modsDown[4]; // shift, ctrl, alt/option, win/command
NSPoint lastInsideMousePosition;
@public
+ BOOL hasPresentationSwitch;
+ NSUInteger defaultPresentationOptions;
+ NSUInteger fullscreenPresentationOptions;
+ BOOL isFullscreenWindow;
int cachedInsets[4]; // l, r, t, b
}
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index 686e5d2..4b0198c 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -445,6 +445,29 @@ static UniChar CKCH_CharForKeyCode(jshort keyCode) {
styleMask: windowStyle
backing: bufferingType
defer: deferCreation];
+ // OSX 10.6
+ if ( [NSApp respondsToSelector:@selector(currentSystemPresentationOptions)] &&
+ [NSApp respondsToSelector:@selector(setPresentationOptions:)] ) {
+ hasPresentationSwitch = YES;
+ defaultPresentationOptions = [NSApp currentSystemPresentationOptions];
+ fullscreenPresentationOptions =
+ // NSApplicationPresentationDefault|
+ // NSApplicationPresentationAutoHideDock|
+ NSApplicationPresentationHideDock|
+ // NSApplicationPresentationAutoHideMenuBar|
+ NSApplicationPresentationHideMenuBar|
+ NSApplicationPresentationDisableAppleMenu|
+ // NSApplicationPresentationDisableProcessSwitching|
+ // NSApplicationPresentationDisableSessionTermination|
+ NSApplicationPresentationDisableHideApplication|
+ // NSApplicationPresentationDisableMenuBarTransparency|
+ // NSApplicationPresentationFullScreen| // OSX 10.7
+ 0 ;
+ } else {
+ hasPresentationSwitch = NO;
+ defaultPresentationOptions = 0;
+ fullscreenPresentationOptions = 0;
+ }
isFullscreenWindow = isfs;
// Why is this necessary? Without it we don't get any of the
// delegate methods like resizing and window movement.
@@ -462,7 +485,8 @@ static UniChar CKCH_CharForKeyCode(jshort keyCode) {
mouseInside = NO;
cursorIsHidden = NO;
realized = YES;
- DBG_PRINT("NewtWindow::create: %p, realized %d (refcnt %d)\n", res, realized, (int)[res retainCount]);
+ DBG_PRINT("NewtWindow::create: %p, realized %d, hasPresentationSwitch %d[defaultOptions 0x%X, fullscreenOptions 0x%X], (refcnt %d)\n",
+ res, realized, (int)hasPresentationSwitch, (int)defaultPresentationOptions, (int)fullscreenPresentationOptions, (int)[res retainCount]);
return res;
}
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index a19efbc..dd0150e 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -59,6 +59,11 @@
#define strdup(s) _strdup(s)
#endif
+/* GetProcAddress doesn't exist in A/W variants under desktop Windows */
+#ifndef UNDER_CE
+#define GetProcAddressA GetProcAddress
+#endif
+
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif //WM_MOUSEWHEEL
@@ -157,6 +162,19 @@ static jmethodID sendTouchScreenEventID = NULL;
static jmethodID sendKeyEventID = NULL;
static jmethodID requestFocusID = NULL;
+typedef WINBOOL (WINAPI *CloseTouchInputHandlePROCADDR)(HANDLE hTouchInput);
+typedef WINBOOL (WINAPI *GetTouchInputInfoPROCADDR)(HANDLE hTouchInput, UINT cInputs, PTOUCHINPUT pInputs, int cbSize);
+typedef WINBOOL (WINAPI *IsTouchWindowPROCADDR)(HWND hWnd,PULONG pulFlags);
+typedef WINBOOL (WINAPI *RegisterTouchWindowPROCADDR)(HWND hWnd,ULONG ulFlags);
+typedef WINBOOL (WINAPI *UnregisterTouchWindowPROCADDR)(HWND hWnd);
+
+static int WinTouch_func_avail = 0;
+static CloseTouchInputHandlePROCADDR WinTouch_CloseTouchInputHandle = NULL;
+static GetTouchInputInfoPROCADDR WinTouch_GetTouchInputInfo = NULL;
+static IsTouchWindowPROCADDR WinTouch_IsTouchWindow = NULL;
+static RegisterTouchWindowPROCADDR WinTouch_RegisterTouchWindow = NULL;
+static UnregisterTouchWindowPROCADDR WinTouch_UnregisterTouchWindow = NULL;
+
static RECT* UpdateInsets(JNIEnv *env, jobject window, HWND hwnd);
typedef struct {
@@ -168,7 +186,10 @@ typedef struct {
int height;
/** Tristate: -1 HIDE, 0 NOP, 1 SHOW */
int setPointerVisible;
- int mouseInside;
+ /** Bool: 0 NOP, 1 FULLSCREEN */
+ int setFullscreen;
+ int pointerCaptured;
+ int pointerInside;
int touchDownCount;
int touchDownLastUp; // mitigate LBUTTONUP after last TOUCH lift
int supportsMTouch;
@@ -466,8 +487,8 @@ static void ParseWmVKeyAndScanCode(USHORT winVKey, BYTE winScanCode, BYTE flags,
*outJavaVKeyXX = javaVKeyXX;
#ifdef DEBUG_KEYS
- STD_PRINT("*** WindowsWindow: ParseWmVKeyAndScanCode winVKey 0x%X, winScanCode 0x%X, winScanCodeExt 0x%X, flags 0x%X -> UTF(0x%X, %c, res %d, sizeof %d), vKeys( US(win 0x%X, java 0x%X), XX(win 0x%X, java 0x%X))\n",
- (int)winVKey, (int)winScanCode, winScanCodeExt, (int)flags,
+ STD_PRINT("*** WindowsWindow: ParseWmVKeyAndScanCode winVKey 0x%X, winScanCode 0x%X, flags 0x%X -> UTF(0x%X, %c, res %d, sizeof %d), vKeys( US(win 0x%X, java 0x%X), XX(win 0x%X, java 0x%X))\n",
+ (int)winVKey, (int)winScanCode, (int)flags,
*outUTF16Char, *outUTF16Char, nUniChars, sizeof(uniChars[0]),
winVKeyUS, javaVKeyUS, winVKey, javaVKeyXX);
#endif
@@ -588,6 +609,24 @@ static void NewtWindows_trackPointerLeave(HWND hwnd) {
(void)ok;
}
+static jboolean NewtWindows_setFullScreen(jboolean fullscreen)
+{
+ int flags = 0;
+ DEVMODE dm;
+
+ // initialize the DEVMODE structure
+ ZeroMemory(&dm, sizeof(dm));
+ dm.dmSize = sizeof(dm);
+
+ if (0 == EnumDisplaySettings(NULL /*current display device*/, ENUM_CURRENT_SETTINGS, &dm))
+ {
+ return JNI_FALSE;
+ }
+ flags = ( JNI_TRUE == fullscreen ) ? CDS_FULLSCREEN : CDS_RESET ;
+
+ return ( DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettings(&dm, flags) ) ? JNI_TRUE : JNI_FALSE;
+}
+
#if 0
static RECT* UpdateInsets(JNIEnv *env, jobject window, HWND hwnd)
@@ -887,471 +926,541 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
}
switch (message) {
+ //
+ // The signal pipeline for destruction is:
+ // Java::DestroyWindow(wnd) _or_ window-close-button ->
+ // WM_CLOSE -> Java::windowDestroyNotify -> W_DESTROY
+ case WM_CLOSE:
+ (*env)->CallBooleanMethod(env, window, windowDestroyNotifyID, JNI_FALSE);
+ break;
- //
- // The signal pipeline for destruction is:
- // Java::DestroyWindow(wnd) _or_ window-close-button ->
- // WM_CLOSE -> Java::windowDestroyNotify -> W_DESTROY
- case WM_CLOSE:
- (*env)->CallBooleanMethod(env, window, windowDestroyNotifyID, JNI_FALSE);
- break;
+ case WM_DESTROY:
+ {
+ #if !defined(__MINGW64__) && ( defined(UNDER_CE) || _MSC_VER <= 1200 )
+ SetWindowLong(wnd, GWL_USERDATA, (intptr_t) NULL);
+ #else
+ SetWindowLongPtr(wnd, GWLP_USERDATA, (intptr_t) NULL);
+ #endif
+ free(wud); wud=NULL;
+ (*env)->DeleteGlobalRef(env, window);
+ }
+ break;
- case WM_DESTROY:
- {
-#if !defined(__MINGW64__) && ( defined(UNDER_CE) || _MSC_VER <= 1200 )
- SetWindowLong(wnd, GWL_USERDATA, (intptr_t) NULL);
-#else
- SetWindowLongPtr(wnd, GWLP_USERDATA, (intptr_t) NULL);
-#endif
- free(wud); wud=NULL;
- (*env)->DeleteGlobalRef(env, window);
+ case WM_ACTIVATE: {
+ HWND wndPrev = (HWND) lParam;
+ BOOL fMinimized = (BOOL) HIWORD(wParam);
+ int fActive = LOWORD(wParam);
+ BOOL inactive = WA_INACTIVE==fActive;
+ #ifdef VERBOSE_ON
+ BOOL anyActive = WA_ACTIVE==fActive, clickActive = WA_CLICKACTIVE==fActive;
+ DBG_PRINT("*** WindowsWindow: WM_ACTIVATE window %p, prev %p, minimized %d, active %d (any %d, click %d, inactive %d), FS %d\n",
+ wnd, wndPrev, fMinimized, fActive, anyActive, clickActive, inactive, wud->setFullscreen);
+ #endif
+ if( wud->setFullscreen ) {
+ // Bug 916 - NEWT Fullscreen Mode on Windows ALT-TAB doesn't allow Application Switching
+ // Remedy for 'some' display drivers, i.e. Intel HD:
+ // Explicitly push fullscreen window to BOTTOM when inactive (ALT-TAB)
+ UINT flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
+ if( inactive ) {
+ SetWindowPos(wnd, HWND_BOTTOM, 0, 0, 0, 0, flags);
+ } else {
+ SetWindowPos(wnd, HWND_TOP, 0, 0, 0, 0, flags);
+ SetForegroundWindow(wnd); // Slightly Higher Priority
+ }
+ }
+ useDefWindowProc = 1;
+ }
+ break;
+
+ case WM_SETTINGCHANGE:
+ if (wParam == SPI_SETNONCLIENTMETRICS) {
+ // make sure insets are updated, we don't need to resize the window
+ // because the size of the client area doesn't change
+ (void)UpdateInsets(env, window, wnd);
+ } else {
+ useDefWindowProc = 1;
+ }
+ break;
+
+ case WM_SIZE:
+ WmSize(env, wud, wnd, (UINT)wParam);
+ break;
+
+ case WM_SHOWWINDOW:
+ (*env)->CallVoidMethod(env, window, visibleChangedID, JNI_FALSE, wParam==TRUE?JNI_TRUE:JNI_FALSE);
+ break;
+
+ case WM_MOVE:
+ DBG_PRINT("*** WindowsWindow: WM_MOVE window %p, %d/%d\n", wnd, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+ (*env)->CallVoidMethod(env, window, positionChangedID, JNI_FALSE, (jint)GET_X_LPARAM(lParam), (jint)GET_Y_LPARAM(lParam));
+ useDefWindowProc = 1;
+ break;
+
+ case WM_PAINT: {
+ RECT r;
+ if (GetUpdateRect(wnd, &r, FALSE /* do not erase background */)) {
+ // clear the whole client area and issue repaint for it, w/o looping through erase background
+ ValidateRect(wnd, NULL); // clear all!
+ (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1);
+ } else {
+ // shall not happen ?
+ ValidateRect(wnd, NULL); // clear all!
+ }
+ // return 0 == done
+ break;
}
- break;
+ case WM_ERASEBKGND:
+ // ignore erase background
+ (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1);
+ res = 1; // return 1 == done, OpenGL, etc .. erases the background, hence we claim to have just done this
+ break;
- case WM_SYSCHAR:
- useDefWindowProc = 1;
- break;
+ case WM_SETCURSOR :
+ if (0 != wud->setPointerVisible) { // Tristate, -1, 0, 1
+ BOOL visibilityChangeSuccessful;
+ if (1 == wud->setPointerVisible) {
+ visibilityChangeSuccessful = SafeShowCursor(TRUE);
+ } else /* -1 == wud->setPointerVisible */ {
+ visibilityChangeSuccessful = SafeShowCursor(FALSE);
+ }
+ useDefWindowProc = visibilityChangeSuccessful ? 1 : 0;
+ DBG_PRINT("*** WindowsWindow: WM_SETCURSOR requested visibility: %d success: %d\n", wud->setPointerVisible, visibilityChangeSuccessful);
+ wud->setPointerVisible = 0;
+ // own signal, consumed
+ } else {
+ useDefWindowProc = 1; // NOP for us, allow parent to act
+ }
+ break;
- case WM_SYSKEYDOWN:
- repCnt = HIWORD(lParam); scanCode = LOBYTE(repCnt); flags = HIBYTE(repCnt);
- repCnt = LOWORD(lParam);
-#ifdef DEBUG_KEYS
- DBG_PRINT("*** WindowsWindow: windProc WM_SYSKEYDOWN sending window %p -> %p, code 0x%X, repCnt %d, scanCode 0x%X, flags 0x%X\n", wnd, window, (int)wParam, (int)repCnt, (int)scanCode, (int)flags);
-#endif
- useDefWindowProc = WmKeyDown(env, window, (USHORT)wParam, repCnt, scanCode, flags, TRUE);
- break;
+ case WM_SETFOCUS:
+ DBG_PRINT("*** WindowsWindow: WM_SETFOCUS window %p, lost %p\n", wnd, (HWND)wParam);
+ (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_TRUE);
+ useDefWindowProc = 1;
+ break;
- case WM_SYSKEYUP:
- repCnt = HIWORD(lParam); scanCode = LOBYTE(repCnt); flags = HIBYTE(repCnt);
- repCnt = LOWORD(lParam);
-#ifdef DEBUG_KEYS
- DBG_PRINT("*** WindowsWindow: windProc WM_SYSKEYUP sending window %p -> %p, code 0x%X, repCnt %d, scanCode 0x%X, flags 0x%X\n", wnd, window, (int)wParam, (int)repCnt, (int)scanCode, (int)flags);
-#endif
- useDefWindowProc = WmKeyUp(env, window, (USHORT)wParam, repCnt, scanCode, flags, TRUE);
- break;
+ case WM_KILLFOCUS:
+ DBG_PRINT("*** WindowsWindow: WM_KILLFOCUS window %p, received %p, inside %d, captured %d, tDown %d\n",
+ wnd, (HWND)wParam, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount);
+ if( wud->touchDownCount == 0 ) {
+ wud->pointerInside = 0;
+ if( wud->pointerCaptured ) {
+ wud->pointerCaptured = 0;
+ ReleaseCapture();
+ }
+ (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_FALSE);
+ useDefWindowProc = 1;
+ } else {
+ // quick focus .. we had it already, are enabled ..
+ SetFocus(wnd);// Sets Keyboard Focus To Window (activates parent window if exist, or this window)
+ }
+ break;
- case WM_CHAR:
- useDefWindowProc = 1;
- break;
-
- case WM_KEYDOWN:
- repCnt = HIWORD(lParam); scanCode = LOBYTE(repCnt); flags = HIBYTE(repCnt);
-#ifdef DEBUG_KEYS
- DBG_PRINT("*** WindowsWindow: windProc WM_KEYDOWN sending window %p -> %p, code 0x%X, repCnt %d, scanCode 0x%X, flags 0x%X\n", wnd, window, (int)wParam, (int)repCnt, (int)scanCode, (int)flags);
-#endif
- useDefWindowProc = WmKeyDown(env, window, wParam, repCnt, scanCode, flags, FALSE);
- break;
+ case WM_SYSCHAR:
+ useDefWindowProc = 1;
+ break;
- case WM_KEYUP:
- repCnt = HIWORD(lParam); scanCode = LOBYTE(repCnt); flags = HIBYTE(repCnt);
- repCnt = LOWORD(lParam);
-#ifdef DEBUG_KEYS
- DBG_PRINT("*** WindowsWindow: windProc WM_KEYUP sending window %p -> %p, code 0x%X, repCnt %d, scanCode 0x%X, flags 0x%X\n", wnd, window, (int)wParam, (int)repCnt, (int)scanCode, (int)flags);
-#endif
- useDefWindowProc = WmKeyUp(env, window, wParam, repCnt, scanCode, flags, FALSE);
- break;
+ case WM_SYSKEYDOWN:
+ repCnt = HIWORD(lParam); scanCode = LOBYTE(repCnt); flags = HIBYTE(repCnt);
+ repCnt = LOWORD(lParam);
+ #ifdef DEBUG_KEYS
+ DBG_PRINT("*** WindowsWindow: windProc WM_SYSKEYDOWN sending window %p -> %p, code 0x%X, repCnt %d, scanCode 0x%X, flags 0x%X\n", wnd, window, (int)wParam, (int)repCnt, (int)scanCode, (int)flags);
+ #endif
+ useDefWindowProc = WmKeyDown(env, window, (USHORT)wParam, repCnt, scanCode, flags, TRUE);
+ break;
- case WM_SIZE:
- WmSize(env, wud, wnd, (UINT)wParam);
- break;
+ case WM_SYSKEYUP:
+ repCnt = HIWORD(lParam); scanCode = LOBYTE(repCnt); flags = HIBYTE(repCnt);
+ repCnt = LOWORD(lParam);
+ #ifdef DEBUG_KEYS
+ DBG_PRINT("*** WindowsWindow: windProc WM_SYSKEYUP sending window %p -> %p, code 0x%X, repCnt %d, scanCode 0x%X, flags 0x%X\n", wnd, window, (int)wParam, (int)repCnt, (int)scanCode, (int)flags);
+ #endif
+ useDefWindowProc = WmKeyUp(env, window, (USHORT)wParam, repCnt, scanCode, flags, TRUE);
+ break;
- case WM_SETTINGCHANGE:
- if (wParam == SPI_SETNONCLIENTMETRICS) {
- // make sure insets are updated, we don't need to resize the window
- // because the size of the client area doesn't change
- (void)UpdateInsets(env, window, wnd);
- } else {
+ case WM_CHAR:
useDefWindowProc = 1;
- }
- break;
+ break;
+
+ case WM_KEYDOWN:
+ repCnt = HIWORD(lParam); scanCode = LOBYTE(repCnt); flags = HIBYTE(repCnt);
+ #ifdef DEBUG_KEYS
+ DBG_PRINT("*** WindowsWindow: windProc WM_KEYDOWN sending window %p -> %p, code 0x%X, repCnt %d, scanCode 0x%X, flags 0x%X\n", wnd, window, (int)wParam, (int)repCnt, (int)scanCode, (int)flags);
+ #endif
+ useDefWindowProc = WmKeyDown(env, window, wParam, repCnt, scanCode, flags, FALSE);
+ break;
+ case WM_KEYUP:
+ repCnt = HIWORD(lParam); scanCode = LOBYTE(repCnt); flags = HIBYTE(repCnt);
+ repCnt = LOWORD(lParam);
+ #ifdef DEBUG_KEYS
+ DBG_PRINT("*** WindowsWindow: windProc WM_KEYUP sending window %p -> %p, code 0x%X, repCnt %d, scanCode 0x%X, flags 0x%X\n", wnd, window, (int)wParam, (int)repCnt, (int)scanCode, (int)flags);
+ #endif
+ useDefWindowProc = WmKeyUp(env, window, wParam, repCnt, scanCode, flags, FALSE);
+ break;
- case WM_LBUTTONDOWN: {
- DBG_PRINT("*** WindowsWindow: WM_LBUTTONDOWN %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
- if( 0 == wud->touchDownLastUp && 0 == wud->touchDownCount ) {
- wud->mouseInside = 1;
- (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_PRESSED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 1, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_LBUTTONDOWN: {
+ DBG_PRINT("*** WindowsWindow: WM_LBUTTONDOWN %d/%d [%dx%d] inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownLastUp && 0 == wud->touchDownCount ) {
+ if( 0 == wud->pointerInside ) {
+ wud->pointerInside = 1;
+ NewtWindows_trackPointerLeave(wnd);
+ }
+ (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_PRESSED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 1, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
}
- }
- break;
+ break;
- case WM_LBUTTONUP: {
- DBG_PRINT("*** WindowsWindow: WM_LBUTTONUP %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
- if( 0 < wud->touchDownLastUp ) {
- // mitigate LBUTTONUP after last TOUCH lift
- wud->touchDownLastUp = 0;
- } else if( 0 == wud->touchDownCount ) {
- wud->mouseInside = 1;
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_RELEASED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 1, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_LBUTTONUP: {
+ DBG_PRINT("*** WindowsWindow: WM_LBUTTONUP %d/%d [%dx%d] inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 < wud->touchDownLastUp ) {
+ // mitigate LBUTTONUP after last TOUCH lift
+ wud->touchDownLastUp = 0;
+ } else if( 0 == wud->touchDownCount ) {
+ jint modifiers = GetModifiers(0);
+ if( wud->pointerCaptured && 0 == ( modifiers & EVENT_BUTTONALL_MASK ) ) {
+ wud->pointerCaptured = 0;
+ ReleaseCapture();
+ }
+ if( 0 == wud->pointerInside ) {
+ wud->pointerInside = 1;
+ NewtWindows_trackPointerLeave(wnd);
+ }
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_RELEASED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 1, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
}
- }
- break;
+ break;
- case WM_MBUTTONDOWN: {
- DBG_PRINT("*** WindowsWindow: WM_MBUTTONDOWN %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
- if( 0 == wud->touchDownCount ) {
- wud->mouseInside = 1;
- (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_PRESSED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 2, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_MBUTTONDOWN: {
+ DBG_PRINT("*** WindowsWindow: WM_MBUTTONDOWN %d/%d [%dx%d] inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ if( 0 == wud->pointerInside ) {
+ wud->pointerInside = 1;
+ NewtWindows_trackPointerLeave(wnd);
+ }
+ (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_PRESSED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 2, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
}
- }
- break;
+ break;
- case WM_MBUTTONUP: {
- DBG_PRINT("*** WindowsWindow: WM_MBUTTONUP %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
- if( 0 == wud->touchDownCount ) {
- wud->mouseInside = 1;
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_RELEASED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 2, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_MBUTTONUP: {
+ DBG_PRINT("*** WindowsWindow: WM_MBUTTONUP %d/%d [%dx%d] inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ jint modifiers = GetModifiers(0);
+ if( wud->pointerCaptured && 0 == ( modifiers & EVENT_BUTTONALL_MASK ) ) {
+ wud->pointerCaptured = 0;
+ ReleaseCapture();
+ }
+ if( 0 == wud->pointerInside ) {
+ wud->pointerInside = 1;
+ NewtWindows_trackPointerLeave(wnd);
+ }
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_RELEASED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 2, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
}
- }
- break;
+ break;
- case WM_RBUTTONDOWN: {
- DBG_PRINT("*** WindowsWindow: WM_RBUTTONDOWN %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
- if( 0 == wud->touchDownCount ) {
- wud->mouseInside = 1;
- (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_PRESSED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 3, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_RBUTTONDOWN: {
+ DBG_PRINT("*** WindowsWindow: WM_RBUTTONDOWN %d/%d [%dx%d] inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ if( 0 == wud->pointerInside ) {
+ wud->pointerInside = 1;
+ NewtWindows_trackPointerLeave(wnd);
+ }
+ (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_PRESSED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 3, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
}
- }
- break;
+ break;
- case WM_RBUTTONUP: {
- DBG_PRINT("*** WindowsWindow: WM_RBUTTONUP %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
- if( 0 == wud->touchDownCount ) {
- wud->mouseInside = 1;
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_RELEASED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 3, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_RBUTTONUP: {
+ DBG_PRINT("*** WindowsWindow: WM_RBUTTONUP %d/%d [%dx%d] inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ jint modifiers = GetModifiers(0);
+ if( wud->pointerCaptured && 0 == ( modifiers & EVENT_BUTTONALL_MASK ) ) {
+ wud->pointerCaptured = 0;
+ ReleaseCapture();
+ }
+ if( 0 == wud->pointerInside ) {
+ wud->pointerInside = 1;
+ NewtWindows_trackPointerLeave(wnd);
+ }
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_RELEASED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 3, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
}
- }
- break;
+ break;
- case WM_MOUSEMOVE: {
- DBG_PRINT("*** WindowsWindow: WM_MOUSEMOVE %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
- if( 0 == wud->touchDownLastUp && 0 == wud->touchDownCount ) {
- wud->mouseInside = 1;
- NewtWindows_trackPointerLeave(wnd);
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_MOVED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 0, (jfloat) 0.0f);
+ case WM_MOUSEMOVE: {
+ DBG_PRINT("*** WindowsWindow: WM_MOUSEMOVE %d/%d [%dx%d] inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownLastUp && 0 == wud->touchDownCount ) {
+ jint modifiers = GetModifiers(0);
+ if( 0 == wud->pointerCaptured && 0 != ( modifiers & EVENT_BUTTONALL_MASK ) ) {
+ wud->pointerCaptured = 1;
+ SetCapture(wnd);
+ }
+ if( 0 == wud->pointerInside ) {
+ wud->pointerInside = 1;
+ NewtWindows_trackPointerLeave(wnd);
+ }
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_MOVED,
+ modifiers,
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 0, (jfloat) 0.0f);
+ }
+ useDefWindowProc = 1;
}
- useDefWindowProc = 1;
- }
- break;
- case WM_MOUSELEAVE: {
- DBG_PRINT("*** WindowsWindow: WM_MOUSELEAVE %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
- if( 0 == wud->touchDownCount ) {
- wud->mouseInside = 0;
+ break;
+ case WM_MOUSELEAVE: {
+ DBG_PRINT("*** WindowsWindow: WM_MOUSELEAVE %d/%d [%dx%d] inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ wud->pointerInside = 0;
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_EXITED,
+ 0,
+ (jint) -1, (jint) -1, // fake
+ (jshort) 0, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
+ }
+ break;
+ // Java synthesizes EVENT_MOUSE_ENTERED
+
+ case WM_HSCROLL: { // Only delivered if windows has WS_HSCROLL, hence dead code!
+ int sb = LOWORD(wParam);
+ int modifiers = GetModifiers( 0 ) | EVENT_SHIFT_MASK;
+ float rotation;
+ switch(sb) {
+ case SB_LINELEFT:
+ rotation = 1.0f;
+ break;
+ case SB_PAGELEFT:
+ rotation = 2.0f;
+ break;
+ case SB_LINERIGHT:
+ rotation = -1.0f;
+ break;
+ case SB_PAGERIGHT:
+ rotation = -1.0f;
+ break;
+ }
+ DBG_PRINT("*** WindowsWindow: WM_HSCROLL 0x%X, rotation %f, mods 0x%X\n", sb, rotation, modifiers);
(*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_EXITED,
- 0,
- (jint) -1, (jint) -1, // fake
- (jshort) 0, (jfloat) 0.0f);
+ (jshort) EVENT_MOUSE_WHEEL_MOVED,
+ modifiers,
+ (jint) 0, (jint) 0,
+ (jshort) 1, (jfloat) rotation);
useDefWindowProc = 1;
+ break;
}
- }
- break;
- // Java synthesizes EVENT_MOUSE_ENTERED
-
- case WM_HSCROLL: { // Only delivered if windows has WS_HSCROLL, hence dead code!
- int sb = LOWORD(wParam);
- int modifiers = GetModifiers( 0 ) | EVENT_SHIFT_MASK;
- float rotation;
- switch(sb) {
- case SB_LINELEFT:
- rotation = 1.0f;
- break;
- case SB_PAGELEFT:
- rotation = 2.0f;
- break;
- case SB_LINERIGHT:
- rotation = -1.0f;
- break;
- case SB_PAGERIGHT:
- rotation = -1.0f;
- break;
+ case WM_MOUSEHWHEEL: /* tilt */
+ case WM_MOUSEWHEEL: /* rotation */ {
+ // need to convert the coordinates to component-relative
+ int x = GET_X_LPARAM(lParam);
+ int y = GET_Y_LPARAM(lParam);
+ int modifiers = GetModifiers( 0 );
+ float rotationOrTilt = (float)(GET_WHEEL_DELTA_WPARAM(wParam))/WHEEL_DELTAf;
+ int vKeys = GET_KEYSTATE_WPARAM(wParam);
+ POINT eventPt;
+ eventPt.x = x;
+ eventPt.y = y;
+ ScreenToClient(wnd, &eventPt);
+
+ if( WM_MOUSEHWHEEL == message ) {
+ modifiers |= EVENT_SHIFT_MASK;
+ DBG_PRINT("*** WindowsWindow: WM_MOUSEHWHEEL %d/%d, tilt %f, vKeys 0x%X, mods 0x%X\n",
+ (int)eventPt.x, (int)eventPt.y, rotationOrTilt, vKeys, modifiers);
+ } else {
+ DBG_PRINT("*** WindowsWindow: WM_MOUSEWHEEL %d/%d, rotation %f, vKeys 0x%X, mods 0x%X\n",
+ (int)eventPt.x, (int)eventPt.y, rotationOrTilt, vKeys, modifiers);
}
- DBG_PRINT("*** WindowsWindow: WM_HSCROLL 0x%X, rotation %f, mods 0x%X\n", sb, rotation, modifiers);
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jshort) EVENT_MOUSE_WHEEL_MOVED,
modifiers,
- (jint) 0, (jint) 0,
- (jshort) 1, (jfloat) rotation);
+ (jint) eventPt.x, (jint) eventPt.y,
+ (jshort) 1, (jfloat) rotationOrTilt);
useDefWindowProc = 1;
break;
}
- case WM_MOUSEHWHEEL: /* tilt */
- case WM_MOUSEWHEEL: /* rotation */ {
- // need to convert the coordinates to component-relative
- int x = GET_X_LPARAM(lParam);
- int y = GET_Y_LPARAM(lParam);
- int modifiers = GetModifiers( 0 );
- float rotationOrTilt = (float)(GET_WHEEL_DELTA_WPARAM(wParam))/WHEEL_DELTAf;
- int vKeys = GET_KEYSTATE_WPARAM(wParam);
- POINT eventPt;
- eventPt.x = x;
- eventPt.y = y;
- ScreenToClient(wnd, &eventPt);
-
- if( WM_MOUSEHWHEEL == message ) {
- modifiers |= EVENT_SHIFT_MASK;
- DBG_PRINT("*** WindowsWindow: WM_MOUSEHWHEEL %d/%d, tilt %f, vKeys 0x%X, mods 0x%X\n",
- (int)eventPt.x, (int)eventPt.y, rotationOrTilt, vKeys, modifiers);
- } else {
- DBG_PRINT("*** WindowsWindow: WM_MOUSEWHEEL %d/%d, rotation %f, vKeys 0x%X, mods 0x%X\n",
- (int)eventPt.x, (int)eventPt.y, rotationOrTilt, vKeys, modifiers);
- }
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_WHEEL_MOVED,
- modifiers,
- (jint) eventPt.x, (jint) eventPt.y,
- (jshort) 1, (jfloat) rotationOrTilt);
- useDefWindowProc = 1;
- break;
- }
- case WM_TOUCH: if( wud->supportsMTouch ) {
- UINT cInputs = LOWORD(wParam);
- // DBG_PRINT("*** WindowsWindow: WM_TOUCH window %p, cInputs %d\n", wnd, cInputs);
- HTOUCHINPUT hTouch = (HTOUCHINPUT)lParam;
- PTOUCHINPUT pInputs = (PTOUCHINPUT) calloc(cInputs, sizeof(TOUCHINPUT));
- if (NULL != pInputs) {
- if (GetTouchInputInfo(hTouch, cInputs, pInputs, sizeof(TOUCHINPUT))) {
- UINT i;
- short eventType[cInputs];
- jint modifiers = GetModifiers( 0 );
- jint actionIdx = -1;
- jint pointerNames[cInputs];
- jint x[cInputs], y[cInputs];
- jfloat pressure[cInputs];
- jfloat maxPressure = 1.0F; // FIXME: n/a on windows ?
- int allPInside = 0 < cInputs;
- int sendFocus = 0;
-
- for (i=0; i < cInputs; i++) {
- PTOUCHINPUT pTi = & pInputs[i];
- POINT eventPt;
- int isDown = pTi->dwFlags & TOUCHEVENTF_DOWN;
- int isUp = pTi->dwFlags & TOUCHEVENTF_UP;
- int isMove = pTi->dwFlags & TOUCHEVENTF_MOVE;
-
- int isPrim = pTi->dwFlags & TOUCHEVENTF_PRIMARY;
- int isNoCoalesc = pTi->dwFlags & TOUCHEVENTF_NOCOALESCE;
- int isPInside;
-
- #ifdef VERBOSE_ON
- const char * touchAction;
- if( isDown ) {
- touchAction = "down";
- } else if( isUp ) {
- touchAction = "_up_";
- } else if( isMove ) {
- touchAction = "move";
- } else {
- touchAction = "undf";
+ case WM_TOUCH: if( wud->supportsMTouch ) {
+ UINT cInputs = LOWORD(wParam);
+ // DBG_PRINT("*** WindowsWindow: WM_TOUCH window %p, cInputs %d\n", wnd, cInputs);
+ HTOUCHINPUT hTouch = (HTOUCHINPUT)lParam;
+ PTOUCHINPUT pInputs = (PTOUCHINPUT) calloc(cInputs, sizeof(TOUCHINPUT));
+ if (NULL != pInputs) {
+ if ( WinTouch_GetTouchInputInfo(hTouch, cInputs, pInputs, sizeof(TOUCHINPUT)) ) {
+ UINT i;
+ short eventType[cInputs];
+ jint modifiers = GetModifiers( 0 );
+ jint actionIdx = -1;
+ jint pointerNames[cInputs];
+ jint x[cInputs], y[cInputs];
+ jfloat pressure[cInputs];
+ jfloat maxPressure = 1.0F; // FIXME: n/a on windows ?
+ int allPInside = 0 < cInputs;
+ int sendFocus = 0;
+
+ for (i=0; i < cInputs; i++) {
+ PTOUCHINPUT pTi = & pInputs[i];
+ POINT eventPt;
+ int isDown = pTi->dwFlags & TOUCHEVENTF_DOWN;
+ int isUp = pTi->dwFlags & TOUCHEVENTF_UP;
+ int isMove = pTi->dwFlags & TOUCHEVENTF_MOVE;
+
+ int isPrim = pTi->dwFlags & TOUCHEVENTF_PRIMARY;
+ int isNoCoalesc = pTi->dwFlags & TOUCHEVENTF_NOCOALESCE;
+
+ #ifdef VERBOSE_ON
+ const char * touchAction;
+ if( isDown ) {
+ touchAction = "down";
+ } else if( isUp ) {
+ touchAction = "_up_";
+ } else if( isMove ) {
+ touchAction = "move";
+ } else {
+ touchAction = "undf";
+ }
+ #endif
+
+ pointerNames[i] = (jint)pTi->dwID;
+ eventPt.x = TOUCH_COORD_TO_PIXEL(pTi->x);
+ eventPt.y = TOUCH_COORD_TO_PIXEL(pTi->y);
+ ScreenToClient(wnd, &eventPt);
+
+ int pInside = 0 <= eventPt.x && 0 <= eventPt.y && eventPt.x < wud->width && eventPt.y < wud->height;
+ allPInside &= pInside;
+
+ x[i] = (jint)eventPt.x;
+ y[i] = (jint)eventPt.y;
+ pressure[i] = 1.0F; // FIXME: n/a on windows ?
+ if(isDown) {
+ sendFocus = 0 == wud->touchDownCount;
+ eventType[i] = (jshort) EVENT_MOUSE_PRESSED;
+ wud->touchDownCount++;
+ wud->touchDownLastUp = 0;
+ } else if(isUp) {
+ eventType[i] = (jshort) EVENT_MOUSE_RELEASED;
+ wud->touchDownCount--;
+ // mitigate LBUTTONUP after last TOUCH lift
+ wud->touchDownLastUp = 0 == wud->touchDownCount;
+ } else if(isMove) {
+ eventType[i] = (jshort) EVENT_MOUSE_MOVED;
+ wud->touchDownLastUp = 0;
+ } else {
+ eventType[i] = (jshort) 0;
+ }
+ if(isPrim) {
+ actionIdx = (jint)i;
+ }
+
+ #ifdef VERBOSE_ON
+ DBG_PRINT("*** WindowsWindow: WM_TOUCH[%d/%d].%s name 0x%x, prim %d, nocoalsc %d, %d/%d [%dx%d] inside [%d/%d], tDown [c %d, lastUp %d]\n",
+ (i+1), cInputs, touchAction, (int)(pTi->dwID), isPrim, isNoCoalesc, x[i], y[i], wud->width, wud->height,
+ pInside, allPInside, wud->touchDownCount, wud->touchDownLastUp);
+ #endif
}
- #endif
-
- pointerNames[i] = (jint)pTi->dwID;
- eventPt.x = TOUCH_COORD_TO_PIXEL(pTi->x);
- eventPt.y = TOUCH_COORD_TO_PIXEL(pTi->y);
- ScreenToClient(wnd, &eventPt);
-
- isPInside = 0 <= eventPt.x && 0 <= eventPt.y && eventPt.x < wud->width && eventPt.y < wud->height;
- allPInside &= isPInside;
-
- x[i] = (jint)eventPt.x;
- y[i] = (jint)eventPt.y;
- pressure[i] = 1.0F; // FIXME: n/a on windows ?
- if(isDown) {
- sendFocus = 0 == wud->touchDownCount;
- eventType[i] = (jshort) EVENT_MOUSE_PRESSED;
- wud->touchDownCount++;
- wud->touchDownLastUp = 0;
- } else if(isUp) {
- eventType[i] = (jshort) EVENT_MOUSE_RELEASED;
- wud->touchDownCount--;
- // mitigate LBUTTONUP after last TOUCH lift
- wud->touchDownLastUp = 0 == wud->touchDownCount;
- } else if(isMove) {
- eventType[i] = (jshort) EVENT_MOUSE_MOVED;
- wud->touchDownLastUp = 0;
- } else {
- eventType[i] = (jshort) 0;
+ wud->pointerInside = allPInside;
+ if( sendFocus ) {
+ (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
}
- if(isPrim) {
- actionIdx = (jint)i;
+ int sentCount = 0, updownCount=0, moveCount=0;
+ // Primary first, if available!
+ if( 0 <= actionIdx ) {
+ sendTouchScreenEvent(env, window, eventType[actionIdx], modifiers, actionIdx,
+ cInputs, pointerNames, x, y, pressure, maxPressure);
+ sentCount++;
}
-
- #ifdef VERBOSE_ON
- DBG_PRINT("*** WindowsWindow: WM_TOUCH[%d/%d].%s name 0x%x, prim %d, nocoalsc %d, %d/%d [%dx%d] inside [%d/%d], tDown [c %d, lastUp %d]\n",
- (i+1), cInputs, touchAction, (int)(pTi->dwID), isPrim, isNoCoalesc, x[i], y[i], wud->width, wud->height,
- isPInside, allPInside, wud->touchDownCount, wud->touchDownLastUp);
- #endif
- }
- wud->mouseInside = allPInside;
- if( sendFocus && allPInside ) {
- (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
- }
- int sentCount = 0, updownCount=0, moveCount=0;
- // Primary first, if available!
- if( 0 <= actionIdx && allPInside ) {
- sendTouchScreenEvent(env, window, eventType[actionIdx], modifiers, actionIdx,
- cInputs, pointerNames, x, y, pressure, maxPressure);
- sentCount++;
- }
- // 1 Move second ..
- for (i=0; i < cInputs; i++) {
- short et = eventType[i];
- if( (jshort) EVENT_MOUSE_MOVED == et ) {
- if( i != actionIdx && 0 == moveCount && allPInside ) {
- sendTouchScreenEvent(env, window, et, modifiers, i,
- cInputs, pointerNames, x, y, pressure, maxPressure);
- sentCount++;
+ // 1 Move second ..
+ for (i=0; i < cInputs; i++) {
+ short et = eventType[i];
+ if( (jshort) EVENT_MOUSE_MOVED == et ) {
+ if( i != actionIdx && 0 == moveCount ) {
+ sendTouchScreenEvent(env, window, et, modifiers, i,
+ cInputs, pointerNames, x, y, pressure, maxPressure);
+ sentCount++;
+ }
+ moveCount++;
}
- moveCount++;
}
- }
- // Up and downs last
- for (i=0; i < cInputs; i++) {
- short et = eventType[i];
- if( (jshort) EVENT_MOUSE_MOVED != et ) {
- if( i != actionIdx && allPInside ) {
- sendTouchScreenEvent(env, window, et, modifiers, i,
- cInputs, pointerNames, x, y, pressure, maxPressure);
- sentCount++;
+ // Up and downs last
+ for (i=0; i < cInputs; i++) {
+ short et = eventType[i];
+ if( (jshort) EVENT_MOUSE_MOVED != et ) {
+ if( i != actionIdx ) {
+ sendTouchScreenEvent(env, window, et, modifiers, i,
+ cInputs, pointerNames, x, y, pressure, maxPressure);
+ sentCount++;
+ }
+ updownCount++;
}
- updownCount++;
}
- }
- DBG_PRINT("*** WindowsWindow: WM_TOUCH.summary pCount %d, prim %d, updown %d, move %d, sent %d, inside %d, tDown [c %d, lastUp %d]\n",
- cInputs, actionIdx, updownCount, moveCount, sentCount, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ DBG_PRINT("*** WindowsWindow: WM_TOUCH.summary pCount %d, prim %d, updown %d, move %d, sent %d, inside %d, captured %d, tDown [c %d, lastUp %d]\n",
+ cInputs, actionIdx, updownCount, moveCount, sentCount, wud->pointerInside, wud->pointerCaptured, wud->touchDownCount, wud->touchDownLastUp);
- // Message processed - close it
- CloseTouchInputHandle(hTouch);
- } else {
- useDefWindowProc = 1;
+ // Message processed - close it
+ WinTouch_CloseTouchInputHandle(hTouch);
+ } else {
+ useDefWindowProc = 1;
+ }
+ free(pInputs);
}
- free(pInputs);
+ break;
}
- break;
- }
-
- case WM_SETFOCUS:
- DBG_PRINT("*** WindowsWindow: WM_SETFOCUS window %p, lost %p\n", wnd, (HWND)wParam);
- (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_TRUE);
- useDefWindowProc = 1;
- break;
- case WM_KILLFOCUS:
- DBG_PRINT("*** WindowsWindow: WM_KILLFOCUS window %p, received %p, inside %d, tDown %d\n",
- wnd, (HWND)wParam, wud->mouseInside, wud->touchDownCount);
- if( wud->touchDownCount == 0 ) {
- wud->mouseInside=0;
- (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_FALSE);
+ default:
useDefWindowProc = 1;
- } else {
- // quick focus .. we had it already, are enabled ..
- SetFocus(wnd);// Sets Keyboard Focus To Window (activates parent window if exist, or this window)
- }
- break;
-
- case WM_SHOWWINDOW:
- (*env)->CallVoidMethod(env, window, visibleChangedID, JNI_FALSE, wParam==TRUE?JNI_TRUE:JNI_FALSE);
- break;
-
- case WM_MOVE:
- DBG_PRINT("*** WindowsWindow: WM_MOVE window %p, %d/%d\n", wnd, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
- (*env)->CallVoidMethod(env, window, positionChangedID, JNI_FALSE, (jint)GET_X_LPARAM(lParam), (jint)GET_Y_LPARAM(lParam));
- useDefWindowProc = 1;
- break;
-
- case WM_PAINT: {
- RECT r;
- if (GetUpdateRect(wnd, &r, FALSE /* do not erase background */)) {
- // clear the whole client area and issue repaint for it, w/o looping through erase background
- ValidateRect(wnd, NULL); // clear all!
- (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1);
- } else {
- // shall not happen ?
- ValidateRect(wnd, NULL); // clear all!
- }
- // return 0 == done
- break;
- }
- case WM_ERASEBKGND:
- // ignore erase background
- (*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1);
- res = 1; // return 1 == done, OpenGL, etc .. erases the background, hence we claim to have just done this
- break;
- case WM_SETCURSOR :
- if (0 != wud->setPointerVisible) { // Tristate, -1, 0, 1
- BOOL visibilityChangeSuccessful;
- if (1 == wud->setPointerVisible) {
- visibilityChangeSuccessful = SafeShowCursor(TRUE);
- } else /* -1 == wud->setPointerVisible */ {
- visibilityChangeSuccessful = SafeShowCursor(FALSE);
- }
- useDefWindowProc = visibilityChangeSuccessful ? 1 : 0;
- DBG_PRINT("*** WindowsWindow: WM_SETCURSOR requested visibility: %d success: %d\n", wud->setPointerVisible, visibilityChangeSuccessful);
- wud->setPointerVisible = 0;
- // own signal, consumed
- } else {
- useDefWindowProc = 1; // NOP for us, allow parent to act
- }
- break;
- default:
- useDefWindowProc = 1;
}
+
if (useDefWindowProc) {
return DefWindowProc(wnd, message, wParam, lParam);
}
@@ -1818,6 +1927,22 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_windows_WindowDriver_initIDs0
}
InitKeyMapTableScanCode(env);
+ {
+ HANDLE shell = LoadLibrary(TEXT("user32.dll"));
+ if (shell) {
+ WinTouch_CloseTouchInputHandle = (CloseTouchInputHandlePROCADDR) GetProcAddressA(shell, "CloseTouchInputHandle");
+ WinTouch_GetTouchInputInfo = (GetTouchInputInfoPROCADDR) GetProcAddressA(shell, "GetTouchInputInfo");
+ WinTouch_IsTouchWindow = (IsTouchWindowPROCADDR) GetProcAddressA(shell, "IsTouchWindow");
+ WinTouch_RegisterTouchWindow = (RegisterTouchWindowPROCADDR) GetProcAddressA(shell, "RegisterTouchWindow");
+ WinTouch_UnregisterTouchWindow = (UnregisterTouchWindowPROCADDR) GetProcAddressA(shell, "UnregisterTouchWindow");
+ if(NULL != WinTouch_CloseTouchInputHandle && NULL != WinTouch_GetTouchInputInfo &&
+ NULL != WinTouch_IsTouchWindow && NULL != WinTouch_RegisterTouchWindow && NULL != WinTouch_UnregisterTouchWindow) {
+ WinTouch_func_avail = 1;
+ } else {
+ WinTouch_func_avail = 0;
+ }
+ }
+ }
return JNI_TRUE;
}
@@ -1929,11 +2054,13 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_CreateWindo
wud->width = width;
wud->height = height;
wud->setPointerVisible = 0;
- wud->mouseInside = 0;
+ wud->setFullscreen = 0;
+ wud->pointerCaptured = 0;
+ wud->pointerInside = 0;
wud->touchDownCount = 0;
wud->touchDownLastUp = 0;
wud->supportsMTouch = 0;
- if ( winMajor > 6 || ( winMajor == 6 && winMinor >= 1 ) ) {
+ if ( WinTouch_func_avail && winMajor > 6 || ( winMajor == 6 && winMinor >= 1 ) ) {
int value = GetSystemMetrics(SM_DIGITIZER);
if (value & NID_READY) { /* ready */
if (value & NID_MULTI_INPUT) { /* multitouch */
@@ -1943,7 +2070,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_CreateWindo
}
}
}
- DBG_PRINT("*** WindowsWindow: CreateWindow supportsMTouch %d\n", wud->supportsMTouch);
+ DBG_PRINT("*** WindowsWindow: CreateWindow winTouchFuncAvail %d, supportsMTouch %d\n", WinTouch_func_avail, wud->supportsMTouch);
#if !defined(__MINGW64__) && ( defined(UNDER_CE) || _MSC_VER <= 1200 )
SetWindowLong(window, GWL_USERDATA, (intptr_t) wud);
@@ -1978,7 +2105,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_CreateWindo
NewtWindow_setVisiblePosSize(window, TST_FLAG_IS_ALWAYSONTOP(flags), TRUE, x, y, width, height);
}
if( wud->supportsMTouch ) {
- RegisterTouchWindow(window, 0);
+ WinTouch_RegisterTouchWindow(window, 0);
}
}
@@ -2014,24 +2141,6 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_MonitorFrom
#endif
}
-static jboolean NewtWindows_setFullScreen(jboolean fullscreen)
-{
- int flags = 0;
- DEVMODE dm;
- // initialize the DEVMODE structure
- ZeroMemory(&dm, sizeof(dm));
- dm.dmSize = sizeof(dm);
-
- if (0 == EnumDisplaySettings(NULL /*current display device*/, ENUM_CURRENT_SETTINGS, &dm))
- {
- return JNI_FALSE;
- }
-
- flags = ( JNI_TRUE == fullscreen ) ? CDS_FULLSCREEN : CDS_RESET ;
-
- return ( DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettings(&dm, flags) ) ? JNI_TRUE : JNI_FALSE;
-}
-
/*
* Class: jogamp_newt_driver_windows_WindowDriver
* Method: reconfigureWindow0
@@ -2045,6 +2154,13 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
HWND hwnd = (HWND) (intptr_t) window;
DWORD windowStyle = WS_DEFAULT_STYLES;
BOOL styleChange = TST_FLAG_CHANGE_DECORATION(flags) || TST_FLAG_CHANGE_FULLSCREEN(flags) || TST_FLAG_CHANGE_PARENTING(flags) ;
+ WindowUserData * wud;
+#if !defined(__MINGW64__) && ( defined(UNDER_CE) || _MSC_VER <= 1200 )
+ wud = (WindowUserData *) GetWindowLong(hwnd, GWL_USERDATA);
+#else
+ wud = (WindowUserData *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+#endif
+
DBG_PRINT( "*** WindowsWindow: reconfigureWindow0 parent %p, window %p, %d/%d %dx%d, parentChange %d, hasParent %d, decorationChange %d, undecorated %d, fullscreenChange %d, fullscreen %d, alwaysOnTopChange %d, alwaysOnTop %d, visibleChange %d, visible %d -> styleChange %d\n",
parent, window, x, y, width, height,
@@ -2079,6 +2195,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
if( TST_FLAG_CHANGE_FULLSCREEN(flags) && TST_FLAG_IS_FULLSCREEN(flags) ) { // FS on
// TOP: in -> out
+ wud->setFullscreen = 1;
NewtWindows_setFullScreen(JNI_TRUE);
}
@@ -2096,6 +2213,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_reconfigureW
if( TST_FLAG_CHANGE_FULLSCREEN(flags) && !TST_FLAG_IS_FULLSCREEN(flags) ) { // FS off
// CHILD: out -> in
+ wud->setFullscreen = 0;
NewtWindows_setFullScreen(JNI_FALSE);
}
@@ -2180,12 +2298,9 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_windows_WindowDriver_confineP
jboolean res;
if(JNI_TRUE == confine) {
- // SetCapture(hwnd);
- // res = ( GetCapture() == hwnd ) ? JNI_TRUE : JNI_FALSE;
RECT rect = { l, t, r, b };
res = ClipCursor(&rect) ? JNI_TRUE : JNI_FALSE;
} else {
- // res = ReleaseCapture() ? JNI_TRUE : JNI_FALSE;
res = ClipCursor(NULL) ? JNI_TRUE : JNI_FALSE;
}
DBG_PRINT( "*** WindowsWindow: confinePointer0: %d, [ l %d t %d r %d b %d ], res %d\n",
diff --git a/src/newt/native/X11RandR11.c b/src/newt/native/X11RandR11.c
index 53d01a6..38d6128 100644
--- a/src/newt/native/X11RandR11.c
+++ b/src/newt/native/X11RandR11.c
@@ -335,7 +335,7 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_RandR11_setCurrentScreenM
int rot;
do {
if ( 0 >= XEventsQueued(dpy, QueuedAfterFlush) ) {
- return;
+ return JNI_FALSE; // not done
}
XNextEvent(dpy, &evt);
@@ -366,5 +366,6 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_RandR11_setCurrentScreenM
XSync(dpy, False);
+ return done ? JNI_TRUE : JNI_FALSE;
}
diff --git a/src/test-native/Bug907GetAllWindowNamesViaMessageDispatch.c b/src/test-native/Bug907GetAllWindowNamesViaMessageDispatch.c
new file mode 100644
index 0000000..9144e96
--- /dev/null
+++ b/src/test-native/Bug907GetAllWindowNamesViaMessageDispatch.c
@@ -0,0 +1,34 @@
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+
+#include <wingdi.h>
+#include <stddef.h>
+#include <stdio.h>
+
+BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
+{
+ static int i = 0;
+ char buffer[255];
+ BOOL bRet = SendMessageTimeout(hwnd, WM_GETTEXT, 255, (LPARAM)buffer,
+ SMTO_ABORTIFHUNG, 1000/*ms*/, NULL);
+ if(bRet == 0) {
+ fprintf(stderr,"#%4d: FAILURE!\n", i++); fflush(stderr);
+ return FALSE;
+ } else {
+ fprintf(stderr,"#%4d: GOT: %s\n", i++, buffer); fflush(stderr);
+ return TRUE;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ BOOL bRet = EnumWindows(EnumWindowsProc, 0);
+ if(bRet == 0)
+ {
+ fprintf(stderr,"ERROR!");
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stderr,"SUCCESS!");
+ exit(EXIT_SUCCESS);
+}
diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0.java
index 2ea162a..1e0d606 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
public class MovieCubeActivityLauncher0 extends LauncherUtil.BaseActivityLauncher {
static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0";
- static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
+
@Override
public void init() {
- final OrderedProperties props = getProperties();
+ final OrderedProperties props = getProperties();
// props.setProperty("jnlp.media0_url2", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v");
props.setProperty("jnlp.media0_url2", "");
props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
@@ -49,37 +49,38 @@ public class MovieCubeActivityLauncher0 extends LauncherUtil.BaseActivityLaunche
// props.setProperty("jogamp.debug.JNILibLoader", "true");
// props.setProperty("jogamp.debug.NativeLibrary", "true");
// props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
// props.setProperty("jogamp.debug.Lock", "true");
// props.setProperty("jogamp.debug.Lock.TraceLock", "true");
// props.setProperty("nativewindow.debug", "all");
- props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
// props.setProperty("jogl.debug", "all");
// props.setProperty("jogl.debug.GLProfile", "true");
- props.setProperty("jogl.debug.GLDrawable", "true");
- props.setProperty("jogl.debug.GLContext", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ // props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLMediaPlayer", "true");
props.setProperty("jogl.debug.GLSLCode", "true");
- // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
// props.setProperty("jogl.debug.GLSLState", "true");
// props.setProperty("jogl.debug.DebugGL", "true");
// props.setProperty("jogl.debug.TraceGL", "true");
// props.setProperty("newt.debug", "all");
// props.setProperty("newt.debug.Window", "true");
// props.setProperty("newt.debug.Window.MouseEvent", "true");
- // props.setProperty("newt.debug.Window.KeyEvent", "true");
+ // props.setProperty("newt.debug.Window.KeyEvent", "true");
props.setProperty("jogamp.debug.IOUtil", "true");
}
-
+
@Override
public String getActivityName() {
return demo;
}
-
+
@Override
public List<String> getSysPackages() {
return Arrays.asList(sys_pkgs);
}
-
+
@Override
public List<String> getUsrPackages() {
return Arrays.asList(usr_pkgs);
diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java
index cd71499..c4eea08 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
public class MovieCubeActivityLauncher1a extends LauncherUtil.BaseActivityLauncher {
static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0";
- static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
+
@Override
public void init() {
- final OrderedProperties props = getProperties();
+ final OrderedProperties props = getProperties();
props.setProperty("jnlp.media0_url2", "camera:/0");
props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4");
@@ -48,7 +48,7 @@ public class MovieCubeActivityLauncher1a extends LauncherUtil.BaseActivityLaunch
// props.setProperty("jogamp.debug.JNILibLoader", "true");
// props.setProperty("jogamp.debug.NativeLibrary", "true");
// props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
// props.setProperty("jogamp.debug.Lock", "true");
// props.setProperty("jogamp.debug.Lock.TraceLock", "true");
// props.setProperty("nativewindow.debug", "all");
@@ -57,8 +57,8 @@ public class MovieCubeActivityLauncher1a extends LauncherUtil.BaseActivityLaunch
// props.setProperty("jogl.debug.GLProfile", "true");
// props.setProperty("jogl.debug.GLDrawable", "true");
// props.setProperty("jogl.debug.GLContext", "true");
- props.setProperty("jogl.debug.GLSLCode", "true");
props.setProperty("jogl.debug.GLMediaPlayer", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
// props.setProperty("jogl.debug.CapabilitiesChooser", "true");
// props.setProperty("jogl.debug.GLSLState", "true");
// props.setProperty("jogl.debug.DebugGL", "true");
@@ -66,20 +66,20 @@ public class MovieCubeActivityLauncher1a extends LauncherUtil.BaseActivityLaunch
// props.setProperty("newt.debug", "all");
// props.setProperty("newt.debug.Window", "true");
// props.setProperty("newt.debug.Window.MouseEvent", "true");
- // props.setProperty("newt.debug.Window.KeyEvent", "true");
+ // props.setProperty("newt.debug.Window.KeyEvent", "true");
// props.setProperty("jogamp.debug.IOUtil", "true");
}
-
+
@Override
public String getActivityName() {
return demo;
}
-
+
@Override
public List<String> getSysPackages() {
return Arrays.asList(sys_pkgs);
}
-
+
@Override
public List<String> getUsrPackages() {
return Arrays.asList(usr_pkgs);
diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java
index d6261b1..26b61dd 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
public class MovieCubeActivityLauncher1b extends LauncherUtil.BaseActivityLauncher {
static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0";
- static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
+
@Override
public void init() {
- final OrderedProperties props = getProperties();
+ final OrderedProperties props = getProperties();
props.setProperty("jnlp.media0_url2", "camera:/1");
props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4");
@@ -48,7 +48,7 @@ public class MovieCubeActivityLauncher1b extends LauncherUtil.BaseActivityLaunch
// props.setProperty("jogamp.debug.JNILibLoader", "true");
// props.setProperty("jogamp.debug.NativeLibrary", "true");
// props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
// props.setProperty("jogamp.debug.Lock", "true");
// props.setProperty("jogamp.debug.Lock.TraceLock", "true");
// props.setProperty("nativewindow.debug", "all");
@@ -57,8 +57,8 @@ public class MovieCubeActivityLauncher1b extends LauncherUtil.BaseActivityLaunch
// props.setProperty("jogl.debug.GLProfile", "true");
// props.setProperty("jogl.debug.GLDrawable", "true");
// props.setProperty("jogl.debug.GLContext", "true");
+ // props.setProperty("jogl.debug.GLMediaPlayer", "true");
props.setProperty("jogl.debug.GLSLCode", "true");
- props.setProperty("jogl.debug.GLMediaPlayer", "true");
// props.setProperty("jogl.debug.CapabilitiesChooser", "true");
// props.setProperty("jogl.debug.GLSLState", "true");
// props.setProperty("jogl.debug.DebugGL", "true");
@@ -66,20 +66,20 @@ public class MovieCubeActivityLauncher1b extends LauncherUtil.BaseActivityLaunch
// props.setProperty("newt.debug", "all");
// props.setProperty("newt.debug.Window", "true");
// props.setProperty("newt.debug.Window.MouseEvent", "true");
- // props.setProperty("newt.debug.Window.KeyEvent", "true");
+ // props.setProperty("newt.debug.Window.KeyEvent", "true");
// props.setProperty("jogamp.debug.IOUtil", "true");
}
-
+
@Override
public String getActivityName() {
return demo;
}
-
+
@Override
public List<String> getSysPackages() {
return Arrays.asList(sys_pkgs);
}
-
+
@Override
public List<String> getUsrPackages() {
return Arrays.asList(usr_pkgs);
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java
index af53433..00c9fb9 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
public class MovieSimpleActivityLauncher00b extends LauncherUtil.BaseActivityLauncher {
static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity1";
- static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
+
@Override
public void init() {
- final OrderedProperties props = getProperties();
+ final OrderedProperties props = getProperties();
props.setProperty("jnlp.mplayer.nozoom", "false");
props.setProperty("jnlp.mplayer.hud", "false");
props.setProperty("jnlp.mplayer.hud.shared", "false");
@@ -52,15 +52,16 @@ public class MovieSimpleActivityLauncher00b extends LauncherUtil.BaseActivityLau
// props.setProperty("jogamp.debug.JNILibLoader", "true");
// props.setProperty("jogamp.debug.NativeLibrary", "true");
// props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
// props.setProperty("nativewindow.debug", "all");
- props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
// props.setProperty("jogl.debug", "all");
// props.setProperty("jogl.debug.GLProfile", "true");
- props.setProperty("jogl.debug.GLDrawable", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLMediaPlayer", "true");
props.setProperty("jogl.debug.GLSLCode", "true");
- // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
// props.setProperty("jogl.debug.GLSLState", "true");
// props.setProperty("jogl.debug.DebugGL", "true");
// props.setProperty("jogl.debug.TraceGL", "true");
@@ -70,7 +71,7 @@ public class MovieSimpleActivityLauncher00b extends LauncherUtil.BaseActivityLau
// props.setProperty("newt.debug.Window.KeyEvent", "true");
props.setProperty("jogamp.debug.IOUtil", "true");
}
-
+
@Override
public String getActivityName() {
return demo;
@@ -79,7 +80,7 @@ public class MovieSimpleActivityLauncher00b extends LauncherUtil.BaseActivityLau
public List<String> getSysPackages() {
return Arrays.asList(sys_pkgs);
}
-
+
@Override
public List<String> getUsrPackages() {
return Arrays.asList(usr_pkgs);
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java
index 0800baf..6e37cb8 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
public class MovieSimpleActivityLauncher00c extends LauncherUtil.BaseActivityLauncher {
static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity1";
- static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
+
@Override
public void init() {
- final OrderedProperties props = getProperties();
+ final OrderedProperties props = getProperties();
props.setProperty("jnlp.mplayer.nozoom", "false");
props.setProperty("jnlp.mplayer.hud", "false");
props.setProperty("jnlp.mplayer.hud.shared", "false");
@@ -50,16 +50,16 @@ public class MovieSimpleActivityLauncher00c extends LauncherUtil.BaseActivityLau
// props.setProperty("jogamp.debug.JNILibLoader", "true");
// props.setProperty("jogamp.debug.NativeLibrary", "true");
// props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
// props.setProperty("nativewindow.debug", "all");
// props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
// props.setProperty("jogl.debug", "all");
// props.setProperty("jogl.debug.GLProfile", "true");
// props.setProperty("jogl.debug.GLDrawable", "true");
- // props.setProperty("jogl.debug.GLContext", "true");
- props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
props.setProperty("jogl.debug.GLMediaPlayer", "true");
- // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
// props.setProperty("jogl.debug.GLSLState", "true");
// props.setProperty("jogl.debug.DebugGL", "true");
// props.setProperty("jogl.debug.TraceGL", "true");
@@ -69,7 +69,7 @@ public class MovieSimpleActivityLauncher00c extends LauncherUtil.BaseActivityLau
// props.setProperty("newt.debug.Window.KeyEvent", "true");
// props.setProperty("jogamp.debug.IOUtil", "true");
}
-
+
@Override
public String getActivityName() {
return demo;
@@ -78,7 +78,7 @@ public class MovieSimpleActivityLauncher00c extends LauncherUtil.BaseActivityLau
public List<String> getSysPackages() {
return Arrays.asList(sys_pkgs);
}
-
+
@Override
public List<String> getUsrPackages() {
return Arrays.asList(usr_pkgs);
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01a.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01a.java
index c9f6516..7f4b911 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01a.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01a.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
public class MovieSimpleActivityLauncher01a extends LauncherUtil.BaseActivityLauncher {
static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity1";
- static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
+
@Override
public void init() {
- final OrderedProperties props = getProperties();
+ final OrderedProperties props = getProperties();
props.setProperty("jnlp.mplayer.nozoom", "true");
props.setProperty("jnlp.mplayer.hud", "true");
props.setProperty("jnlp.mplayer.hud.shared", "true");
@@ -52,15 +52,16 @@ public class MovieSimpleActivityLauncher01a extends LauncherUtil.BaseActivityLau
// props.setProperty("jogamp.debug.JNILibLoader", "true");
// props.setProperty("jogamp.debug.NativeLibrary", "true");
// props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
// props.setProperty("nativewindow.debug", "all");
- props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
// props.setProperty("jogl.debug", "all");
// props.setProperty("jogl.debug.GLProfile", "true");
- props.setProperty("jogl.debug.GLDrawable", "true");
- props.setProperty("jogl.debug.GLContext", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ // props.setProperty("jogl.debug.GLContext", "true");
+ // props.setProperty("jogl.debug.GLMediaPlayer", "true");
props.setProperty("jogl.debug.GLSLCode", "true");
- // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
// props.setProperty("jogl.debug.GLSLState", "true");
// props.setProperty("jogl.debug.DebugGL", "true");
// props.setProperty("jogl.debug.TraceGL", "true");
@@ -70,7 +71,7 @@ public class MovieSimpleActivityLauncher01a extends LauncherUtil.BaseActivityLau
// props.setProperty("newt.debug.Window.KeyEvent", "true");
props.setProperty("jogamp.debug.IOUtil", "true");
}
-
+
@Override
public String getActivityName() {
return demo;
@@ -79,7 +80,7 @@ public class MovieSimpleActivityLauncher01a extends LauncherUtil.BaseActivityLau
public List<String> getSysPackages() {
return Arrays.asList(sys_pkgs);
}
-
+
@Override
public List<String> getUsrPackages() {
return Arrays.asList(usr_pkgs);
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01b.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01b.java
index db58f98..2a76d08 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01b.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher01b.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
public class MovieSimpleActivityLauncher01b extends LauncherUtil.BaseActivityLauncher {
static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity1";
- static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
+
@Override
public void init() {
- final OrderedProperties props = getProperties();
+ final OrderedProperties props = getProperties();
props.setProperty("jnlp.mplayer.nozoom", "false");
props.setProperty("jnlp.mplayer.hud", "true");
props.setProperty("jnlp.mplayer.hud.shared", "true");
@@ -52,15 +52,16 @@ public class MovieSimpleActivityLauncher01b extends LauncherUtil.BaseActivityLau
// props.setProperty("jogamp.debug.JNILibLoader", "true");
// props.setProperty("jogamp.debug.NativeLibrary", "true");
// props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
// props.setProperty("nativewindow.debug", "all");
- props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
// props.setProperty("jogl.debug", "all");
// props.setProperty("jogl.debug.GLProfile", "true");
- props.setProperty("jogl.debug.GLDrawable", "true");
- props.setProperty("jogl.debug.GLContext", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ // props.setProperty("jogl.debug.GLContext", "true");
+ // props.setProperty("jogl.debug.GLMediaPlayer", "true");
props.setProperty("jogl.debug.GLSLCode", "true");
- // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
// props.setProperty("jogl.debug.GLSLState", "true");
// props.setProperty("jogl.debug.DebugGL", "true");
// props.setProperty("jogl.debug.TraceGL", "true");
@@ -70,7 +71,7 @@ public class MovieSimpleActivityLauncher01b extends LauncherUtil.BaseActivityLau
// props.setProperty("newt.debug.Window.KeyEvent", "true");
props.setProperty("jogamp.debug.IOUtil", "true");
}
-
+
@Override
public String getActivityName() {
return demo;
@@ -79,7 +80,7 @@ public class MovieSimpleActivityLauncher01b extends LauncherUtil.BaseActivityLau
public List<String> getSysPackages() {
return Arrays.asList(sys_pkgs);
}
-
+
@Override
public List<String> getUsrPackages() {
return Arrays.asList(usr_pkgs);
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher02.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher02.java
index 0122fdf..b649de2 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher02.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher02.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
public class MovieSimpleActivityLauncher02 extends LauncherUtil.BaseActivityLauncher {
static String demo = "com.jogamp.opengl.test.android.MovieSimpleActivity1";
- static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
+
@Override
public void init() {
- final OrderedProperties props = getProperties();
+ final OrderedProperties props = getProperties();
props.setProperty("jnlp.mplayer.nozoom", "false");
props.setProperty("jnlp.mplayer.hud", "true");
props.setProperty("jnlp.mplayer.hud.shared", "false");
@@ -52,15 +52,16 @@ public class MovieSimpleActivityLauncher02 extends LauncherUtil.BaseActivityLaun
// props.setProperty("jogamp.debug.JNILibLoader", "true");
// props.setProperty("jogamp.debug.NativeLibrary", "true");
// props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
// props.setProperty("nativewindow.debug", "all");
- props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
// props.setProperty("jogl.debug", "all");
// props.setProperty("jogl.debug.GLProfile", "true");
- props.setProperty("jogl.debug.GLDrawable", "true");
- props.setProperty("jogl.debug.GLContext", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ // props.setProperty("jogl.debug.GLContext", "true");
+ // props.setProperty("jogl.debug.GLMediaPlayer", "true");
props.setProperty("jogl.debug.GLSLCode", "true");
- // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
// props.setProperty("jogl.debug.GLSLState", "true");
// props.setProperty("jogl.debug.DebugGL", "true");
// props.setProperty("jogl.debug.TraceGL", "true");
@@ -70,7 +71,7 @@ public class MovieSimpleActivityLauncher02 extends LauncherUtil.BaseActivityLaun
// props.setProperty("newt.debug.Window.KeyEvent", "true");
props.setProperty("jogamp.debug.IOUtil", "true");
}
-
+
@Override
public String getActivityName() {
return demo;
@@ -79,7 +80,7 @@ public class MovieSimpleActivityLauncher02 extends LauncherUtil.BaseActivityLaun
public List<String> getSysPackages() {
return Arrays.asList(sys_pkgs);
}
-
+
@Override
public List<String> getUsrPackages() {
return Arrays.asList(usr_pkgs);
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java
index 88cd9a7..596c2c8 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java
@@ -51,7 +51,7 @@ public class NEWTElektronActivity extends NewtBaseActivity {
super.onCreate(savedInstanceState);
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
glWindow.setFullscreen(true);
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
index 2e97745..9572ef6 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -50,28 +50,28 @@ import android.util.Log;
public class NEWTGearsES2Activity extends NewtBaseActivity {
static String TAG = "NEWTGearsES2Activity";
-
+
static final String forceRGBA5650 = "demo.force.rgba5650";
static final String forceECT = "demo.force.ect";
static final String forceKillProcessTest = "demo.force.killProcessTest";
-
+
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate - 0");
super.onCreate(savedInstanceState);
-
+
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
if( null != System.getProperty(forceRGBA5650) ) {
Log.d(TAG, "forceRGBA5650");
- caps.setRedBits(5); caps.setGreenBits(6); caps.setBlueBits(5);
+ caps.setRedBits(5); caps.setGreenBits(6); caps.setBlueBits(5);
}
-
+
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
glWindow.setFullscreen(true);
setContentView(getWindow(), glWindow);
-
+
GearsES2 demo = new GearsES2(-1);
// demo.enableAndroidTrace(true);
glWindow.addGLEventListener(demo);
@@ -94,7 +94,7 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
public void run() {
ArrayList<Buffer> buffers = new ArrayList<Buffer>();
while(true) {
- final int halfMB = 512 * 1024;
+ final int halfMB = 512 * 1024;
final float osizeMB = buffers.size() * 0.5f;
final float nsizeMB = osizeMB + 0.5f;
System.err.println("MemoryHog: ****** +4k: "+osizeMB+" MB +"+nsizeMB+" MB - Try");
@@ -102,27 +102,27 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
System.err.println("MemoryHog: ****** +4k: "+osizeMB+" MB +"+nsizeMB+" MB - Done");
try {
Thread.sleep(500);
- } catch (Exception e) {};
+ } catch (Exception e) {};
}
} }, "MemoryHog").start();
} else if( e.getPointerCount() == 4 ) {
Log.d(TAG, "ForceKill");
android.os.Process.killProcess( android.os.Process.myPid() );
- }
+ }
}
});
}
Animator animator = new Animator(glWindow);
// animator.setRunAsFastAsPossible(true);
// glWindow.setSkipContextReleaseThread(animator.getThread());
-
+
if( null != System.getProperty(forceECT) ) {
Log.d(TAG, "forceECT");
- animator.setExclusiveContext(true);
+ animator.setExclusiveContext(true);
}
-
+
glWindow.setVisible(true);
-
+
animator.setUpdateFPSFrames(60, System.err);
animator.resetFPSCounter();
glWindow.resetFPSCounter();
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java
index 98e6b7c..beaf604 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java
@@ -53,7 +53,7 @@ public class NEWTGearsES2TransActivity extends NewtBaseActivity {
super.onCreate(savedInstanceState);
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
caps.setBackgroundOpaque(false);
Log.d(TAG, "req caps: "+caps);
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java
index 42db9d8..26adf0c 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java
@@ -51,7 +51,7 @@ public class NEWTGraphUI1pActivity extends NewtBaseActivity {
super.onCreate(savedInstanceState);
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
caps.setAlphaBits(4);
caps.setNumSamples(4);
caps.setSampleBuffers(true);
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java
index c68de95..ebabfb0 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java
@@ -52,7 +52,7 @@ public class NEWTGraphUI2pActivity extends NewtBaseActivity {
super.onCreate(savedInstanceState);
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
caps.setAlphaBits(4);
caps.setNumSamples(4);
caps.setSampleBuffers(true);
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java
index cefdd84..75ae94e 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java
@@ -51,7 +51,7 @@ public class NEWTRedSquareES2Activity extends NewtBaseActivity {
super.onCreate(savedInstanceState);
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
// glWindow.setSize(200, 200);
diff --git a/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java b/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java
new file mode 100644
index 0000000..1d7f6e7
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java
@@ -0,0 +1,234 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.bugs;
+
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Graphics;
+import java.lang.reflect.InvocationTargetException;
+
+ at SuppressWarnings("serial")
+public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet {
+
+ private static String currentThreadName() { return "["+Thread.currentThread().getName()+", isAWT-EDT "+EventQueue.isDispatchThread()+"]"; }
+
+ private static void invoke(boolean wait, Runnable r) {
+ if(EventQueue.isDispatchThread()) {
+ r.run();
+ } else {
+ try {
+ if(wait) {
+ EventQueue.invokeAndWait(r);
+ } else {
+ EventQueue.invokeLater(r);
+ }
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e.getTargetException());
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private static final String comp2Str(Component c) {
+ return c.getClass().getSimpleName()+"[visible "+c.isVisible()+", showing "+c.isShowing()+", valid "+c.isValid()+
+ ", displayable "+c.isDisplayable()+", "+c.getX()+"/"+c.getY()+" "+c.getWidth()+"x"+c.getHeight()+"]";
+ }
+
+ private void println(String msg) {
+ System.err.println(msg);
+ }
+
+ private final void checkComponentState(String msg, boolean expIsContained, int expAddNotifyCount, int expRemoveNotifyCount) {
+ final int compCount = getComponentCount();
+ final Component c = 1 <= compCount ? getComponent(0) : null;
+ final String clazzName = null != c ? c.getName() : "n/a";
+ final boolean isContained = c == myCanvas;
+ final String okS = ( expIsContained == isContained &&
+ expAddNotifyCount == myCanvas.addNotifyCount &&
+ expRemoveNotifyCount == myCanvas.removeNotifyCount ) ? "OK" : "ERROR";
+ println("Component-State @ "+msg+": "+okS+
+ ", contained[exp "+expIsContained+", has "+isContained+"]"+(expIsContained!=isContained?"*":"")+
+ ", addNotify[exp "+expAddNotifyCount+", has "+myCanvas.addNotifyCount+"]"+(expAddNotifyCount!=myCanvas.addNotifyCount?"*":"")+
+ ", removeNotify[exp "+expRemoveNotifyCount+", has "+myCanvas.removeNotifyCount+"]"+(expRemoveNotifyCount!=myCanvas.removeNotifyCount?"*":"")+
+ ", compCount "+compCount+", compClazz "+clazzName);
+ }
+
+ volatile int initCount = 0;
+ volatile int startCount = 0;
+ volatile int stopCount = 0;
+ volatile int destroyCount = 0;
+
+ private final void checkAppletState(String msg, boolean expIsActive,
+ int expInitCount, int expStartCount, int expStopCount, boolean startStopCountEquals, int expDestroyCount) {
+ final boolean isActive = this.isActive();
+ final String okS = ( expInitCount == initCount &&
+ expIsActive == isActive &&
+ expStartCount == startCount &&
+ expStopCount == stopCount &&
+ expDestroyCount == destroyCount &&
+ ( !startStopCountEquals || startCount == stopCount ) ) ? "OK" : "ERROR";
+ println("Applet-State @ "+msg+": "+okS+
+ ", active[exp "+expIsActive+", has "+isActive+"]"+(expIsActive!=isActive?"*":"")+
+ ", init[exp "+expInitCount+", has "+initCount+"]"+(expInitCount!=initCount?"*":"")+
+ ", start[exp "+expStartCount+", has "+startCount+"]"+(expStartCount!=startCount?"*":"")+
+ ", stop[exp "+expStopCount+", has "+stopCount+"]"+(expStopCount!=stopCount?"*":"")+
+ ", start==stop[exp "+startStopCountEquals+", start "+startCount+", stop "+stopCount+"]"+(( startStopCountEquals && startCount != stopCount )?"*":"")+
+ ", destroy[exp "+expDestroyCount+", has "+destroyCount+"]"+(expDestroyCount!=destroyCount?"*":""));
+ }
+
+ private class MyCanvas extends Canvas {
+ int addNotifyCount = 0;
+ int removeNotifyCount = 0;
+ int paintCount = 0;
+
+ MyCanvas() {
+ setBackground( new Color( 200, 200, 255 ) );
+ }
+
+ public String toString() {
+ return comp2Str(this)+", add/remove[addNotify "+addNotifyCount+", removeCount "+removeNotifyCount+"]";
+ }
+
+ @Override
+ public void addNotify() {
+ addNotifyCount++;
+ println("Applet.Canvas.addNotify() - "+currentThreadName());
+ if( !EventQueue.isDispatchThread() ) {
+ println("Applet.Canvas.addNotify() ERROR: Not on AWT-EDT");
+ }
+ // Thread.dumpStack();
+ super.addNotify();
+ println("Applet.Canvas.addNotify(): "+this);
+ }
+
+ @Override
+ public void removeNotify() {
+ removeNotifyCount++;
+ println("Applet.Canvas.removeNotify() - "+currentThreadName());
+ println("Applet.Canvas.removeNotify(): "+this);
+ if( !EventQueue.isDispatchThread() ) {
+ println("Applet.Canvas.removeNotify() ERROR: Not on AWT-EDT");
+ }
+ // Thread.dumpStack();
+ super.removeNotify();
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ super.paint(g);
+ paintCount++;
+ final int width = getWidth();
+ final int height = getHeight();
+ final String msg = "The payload Canvas. Paint "+width+"x"+height+" #"+paintCount;
+ g.setColor(Color.black);
+ g.drawString(msg, 64, 64);
+ }
+ }
+ MyCanvas myCanvas = null;
+
+ @Override
+ public void init() {
+ final java.awt.Dimension aSize = getSize();
+ println("Applet.init() START - applet.size "+aSize+" - "+currentThreadName());
+ initCount++;
+ checkAppletState("init", false /* expIsActive */, 1 /* expInitCount */,
+ 0 /* expStartCount */, 0 /* expStopCount */, true /* startStopCountEquals */,
+ 0 /* expDestroyCount */);
+ invoke(true, new Runnable() {
+ public void run() {
+ setLayout(new BorderLayout());
+ myCanvas = new MyCanvas();
+ println("Applet.init(): self "+comp2Str(DemoBug910ExtendedAWTAppletLifecycleCheck.this));
+ println("Applet.init(): canvas "+comp2Str(myCanvas));
+ checkComponentState("init-add.pre", false, 0, 0);
+ add(myCanvas, BorderLayout.CENTER);
+ validate();
+ checkComponentState("init-add.post", true, 1, 0);
+ println("Applet.init(): canvas "+comp2Str(myCanvas));
+ } } );
+ println("Applet.init() END - "+currentThreadName());
+ }
+
+ @Override
+ public void start() {
+ println("Applet.start() START (isVisible "+isVisible()+", isDisplayable "+isDisplayable()+") - "+currentThreadName());
+ startCount++;
+ checkAppletState("start", true /* expIsActive */, 1 /* expInitCount */,
+ startCount /* expStartCount */, startCount-1 /* expStopCount */, false /* startStopCountEquals */,
+ 0 /* expDestroyCount */);
+ invoke(true, new Runnable() {
+ public void run() {
+ checkComponentState("start-visible.pre", true, 1, 0);
+ if( null != myCanvas ) {
+ myCanvas.setFocusable(true);
+ myCanvas.requestFocus();
+ }
+ checkComponentState("start-visible.post", true, 1, 0);
+ println("Applet.start(): self "+comp2Str(DemoBug910ExtendedAWTAppletLifecycleCheck.this));
+ println("Applet.start(): canvas "+comp2Str(myCanvas));
+ }
+ });
+ println("Applet.start() END - "+currentThreadName());
+ }
+
+ @Override
+ public void stop() {
+ println("Applet.stop() START - "+currentThreadName());
+ stopCount++;
+ checkAppletState("stop", false /* expIsActive */, 1 /* expInitCount */,
+ stopCount /* expStartCount */, stopCount /* expStopCount */, true /* startStopCountEquals */,
+ 0 /* expDestroyCount */);
+ invoke(true, new Runnable() {
+ public void run() {
+ checkComponentState("stop", true, 1, 0);
+ } } );
+ println("Applet.stop() END - "+currentThreadName());
+ }
+
+ @Override
+ public void destroy() {
+ println("Applet.destroy() START - "+currentThreadName());
+ destroyCount++;
+ checkAppletState("destroy", false /* expIsActive */, 1 /* expInitCount */,
+ startCount /* expStartCount */, stopCount /* expStopCount */, true /* startStopCountEquals */,
+ 1 /* expDestroyCount */);
+ invoke(true, new Runnable() {
+ public void run() {
+ checkComponentState("destroy-remove.pre", true, 1, 0);
+ remove(myCanvas);
+ checkComponentState("destroy-remove.post", false, 1, 1);
+ } } );
+ println("Applet.destroy() END - "+currentThreadName());
+ }
+}
+
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
index 4e2e913..9f367ef 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.acore;
import java.awt.Frame;
@@ -36,11 +36,14 @@ import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -49,7 +52,7 @@ import com.jogamp.opengl.util.Animator;
public class TestShutdownCompleteAWT extends UITestCase {
static long duration = 300; // ms
-
+
protected void runTestGL() throws InterruptedException, InvocationTargetException {
final Frame frame = new Frame("Gears AWT Test");
Assert.assertNotNull(frame);
@@ -67,8 +70,8 @@ public class TestShutdownCompleteAWT extends UITestCase {
frame.setSize(256, 256);
frame.setVisible(true);
}});
-
- animator.setUpdateFPSFrames(60, System.err);
+
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
Assert.assertEquals(true, animator.isAnimating());
Assert.assertEquals(true, glCanvas.isVisible());
@@ -93,37 +96,70 @@ public class TestShutdownCompleteAWT extends UITestCase {
}});
}
- protected void oneLife() throws InterruptedException, InvocationTargetException {
- long t0 = System.nanoTime();
+ @AfterClass
+ public static void afterAll() {
+ if(waitForKey) {
+ UITestCase.waitForKey("Exit");
+ }
+ }
+
+ protected void oneLife(boolean glInfo) throws InterruptedException, InvocationTargetException {
+ final long t0 = Platform.currentTimeMicros();
GLProfile.initSingleton();
- long t1 = System.nanoTime();
- runTestGL();
- long t2 = System.nanoTime();
- GLProfile.shutdown();
- long t3 = System.nanoTime();
- System.err.println("Total: "+ (t3-t0)/1e6 +"ms");
- System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/1e6 +"ms");
- System.err.println(" Demo Code: "+ (t2-t1)/1e6 +"ms");
- System.err.println(" GLProfile.shutdown(): "+ (t3-t2)/1e6 +"ms");
+ final long t1 = Platform.currentTimeMicros();
+ if(!initOnly) {
+ runTestGL();
+ }
+ final long t2 = Platform.currentTimeMicros();
+ if(glInfo) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, false).toString());
+ }
+ final long t3 = Platform.currentTimeMicros();
+ GLProfile.shutdown();
+ final long t4 = Platform.currentTimeMicros();
+ System.err.println("Total: "+ (t4-t0)/1e3 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/1e3 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/1e3 +"ms");
+ System.err.println(" GLInfo: "+ (t3-t2)/1e3 +"ms");
+ System.err.println(" GLProfile.shutdown(): "+ (t4-t3)/1e3 +"ms");
}
-
+
@Test
public void test01OneLife() throws InterruptedException, InvocationTargetException {
- oneLife();
+ oneLife(false);
+ }
+
+ @Test
+ public void test02AnotherLifeWithGLInfo() throws InterruptedException, InvocationTargetException {
+ oneLife(true);
}
@Test
- public void test01AnotherLife() throws InterruptedException, InvocationTargetException {
- oneLife();
+ public void test03AnotherLife() throws InterruptedException, InvocationTargetException {
+ oneLife(true);
}
-
+
@Test
- public void test01TwoLifes() throws InterruptedException, InvocationTargetException {
- oneLife();
- oneLife();
+ public void test03TwoLifes() throws InterruptedException, InvocationTargetException {
+ oneLife(false);
+ oneLife(false);
}
-
+
+ static boolean initOnly = false;
+ static boolean waitForKey = false;
+
public static void main(String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-wait")) {
+ waitForKey = true;
+ } else if(args[i].equals("-initOnly")) {
+ initOnly = true;
+ }
+ }
+
+ if(waitForKey) {
+ UITestCase.waitForKey("Start");
+ }
String tstname = TestShutdownCompleteAWT.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
index 881d6c8..e7d1cb8 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,26 +20,26 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.acore;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStreamReader;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+import com.jogamp.common.os.Platform;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -50,12 +50,12 @@ import com.jogamp.opengl.util.Animator;
public class TestShutdownCompleteNEWT extends UITestCase {
static long duration = 300; // ms
-
+
protected void runTestGL(boolean onscreen) throws InterruptedException {
GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
caps.setOnscreen(onscreen);
caps.setPBuffer(!onscreen);
-
+
GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Gears NEWT Test");
@@ -81,59 +81,63 @@ public class TestShutdownCompleteNEWT extends UITestCase {
glWindow.destroy();
}
+ @AfterClass
+ public static void afterAll() {
+ if(waitForKey) {
+ UITestCase.waitForKey("Exit");
+ }
+ }
+
protected void oneLife(boolean glInfo) throws InterruptedException {
if(waitForEach) {
- waitForEnter();
+ UITestCase.waitForKey("Start One Life");
}
- long t0 = System.nanoTime();
+ final long t0 = Platform.currentTimeMicros();
GLProfile.initSingleton();
- long t1 = System.nanoTime();
+ final long t1 = Platform.currentTimeMicros();
if(!initOnly) {
runTestGL(true);
}
- long t2 = System.nanoTime();
+ final long t2 = Platform.currentTimeMicros();
if(glInfo) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, false).toString());
}
- long t3 = System.nanoTime();
- GLProfile.shutdown();
- long t4 = System.nanoTime();
- System.err.println("Total: "+ (t3-t0)/1e6 +"ms");
- System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/1e6 +"ms");
- System.err.println(" Demo Code: "+ (t2-t1)/1e6 +"ms");
- System.err.println(" GLProfile.shutdown(): "+ (t4-t3)/1e6 +"ms");
+ final long t3 = Platform.currentTimeMicros();
+ GLProfile.shutdown();
+ final long t4 = Platform.currentTimeMicros();
+ System.err.println("Total: "+ (t4-t0)/1e3 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/1e3 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/1e3 +"ms");
+ System.err.println(" GLInfo: "+ (t3-t2)/1e3 +"ms");
+ System.err.println(" GLProfile.shutdown(): "+ (t4-t3)/1e3 +"ms");
}
-
+
@Test
public void test01OneLife() throws InterruptedException {
+ oneLife(false);
+ }
+
+ @Test
+ public void test02AnotherLifeWithGLInfo() throws InterruptedException {
oneLife(true);
}
@Test
- public void test01AnotherLife() throws InterruptedException {
- oneLife(false);
+ public void test03AnotherLife() throws InterruptedException {
+ oneLife(true);
}
-
+
@Test
- public void test01TwoLifes() throws InterruptedException {
+ public void test03TwoLifes() throws InterruptedException {
oneLife(false);
oneLife(false);
}
-
+
static boolean initOnly = false;
static boolean waitForEach = false;
-
- static void waitForEnter() {
- BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
- System.err.println("Press enter to continue");
- try {
- System.err.println(stdin.readLine());
- } catch (IOException e) { }
- }
-
+ static boolean waitForKey = false;
+
public static void main(String args[]) throws IOException {
- boolean waitForKey = false;
-
for(int i=0; i<args.length; i++) {
if(args[i].equals("-wait")) {
waitForKey = true;
@@ -144,11 +148,11 @@ public class TestShutdownCompleteNEWT extends UITestCase {
initOnly = true;
}
}
-
+
if(waitForKey) {
- waitForEnter();
+ UITestCase.waitForKey("Start");
}
-
+
String tstname = TestShutdownCompleteNEWT.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java
new file mode 100644
index 0000000..55e045d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java
@@ -0,0 +1,129 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.junit.jogl.acore.anim;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.awt.GLCanvas;
+import javax.swing.SwingUtilities;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Manual test case to validate Animator pause/resume on AWT-EDT.
+ * <p>
+ * Even though (AWT) Animator is not able to block until pause/resume is finished
+ * when issued on AWT-EDT, best effort shall be made to preserve functionality.
+ * </p>
+ * Original Author: <i>kosukek</i> from JogAmp forum; Modifier a bit.
+ */
+ at SuppressWarnings("serial")
+public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame {
+
+ public Bug898AnimatorFromEDTAWT() {
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ //Layout
+ setMinimumSize(new Dimension(640, 480));
+ getContentPane().setLayout(new BorderLayout());
+ GLCanvas panel = new GLCanvas(new GLCapabilities(GLProfile.getMaxProgrammable(true)));
+ getContentPane().add(panel, BorderLayout.CENTER);
+ pack();
+ //Animator
+ final Animator animator = new Animator();
+ animator.add(panel);
+ //GLEventListener
+ panel.addGLEventListener(new GearsES2(1));
+ panel.addGLEventListener(new GLEventListener() {
+ long startTime = 0, lastTime = 0;
+ long step = 1;
+
+ @Override
+ public void init(GLAutoDrawable glad) {
+ startTime = System.currentTimeMillis();
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable glad) {
+ }
+
+ @Override
+ public void display(GLAutoDrawable glad) {
+ long time = System.currentTimeMillis();
+ if (animator.isAnimating() && step * 2000 < time - startTime) {
+ long td = time - lastTime;
+ lastTime = time;
+ animator.pause();
+ System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.pause(): paused "+animator);
+ new Thread() {
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ long td = System.currentTimeMillis() - lastTime;
+ if (animator.isPaused()) {
+ animator.resume(); //Doesn't work on v2.0.2 or higher
+ System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): animating "+animator);
+ } else {
+ System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): Ooops - not paused! - animating "+animator);
+ }
+ } } );
+ }
+ }.start();
+ step++;
+ }
+ }
+
+ @Override
+ public void reshape(GLAutoDrawable glad, int i, int i1, int i2, int i3) {
+ }
+ });
+ //Start animation
+ animator.start();
+ System.out.println("animator.start()");
+ }
+
+ public static void main(String args[]) {
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ new Bug898AnimatorFromEDTAWT().setVisible(true);
+ }
+ });
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java
similarity index 99%
rename from src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java
rename to src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java
index d757d95..7f861d8 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java
@@ -1,4 +1,4 @@
-package com.jogamp.opengl.test.junit.jogl.awt;
+package com.jogamp.opengl.test.junit.jogl.acore.anim;
import java.awt.BorderLayout;
import java.awt.CardLayout;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java
new file mode 100644
index 0000000..42f170a
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java
@@ -0,0 +1,301 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.acore.anim;
+
+import java.awt.Frame;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.awt.GLJPanel;
+
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestAnimatorGLJPanel01AWT extends UITestCase {
+ static final int width = 640;
+ static final int height = 480;
+
+ protected GLJPanel createGLJPanel(final GLCapabilities caps, final Frame frame, int x, int y, GearsES2 gears) throws InterruptedException {
+ final GLJPanel glCanvas = new GLJPanel(caps);
+ Assert.assertNotNull(glCanvas);
+ glCanvas.addGLEventListener(gears);
+ frame.add(glCanvas);
+ frame.setLocation(x, y);
+ frame.setSize(width, height);
+ frame.setTitle("GLJPanel: "+x+"/"+y);
+ return glCanvas;
+ }
+
+ static void pauseAnimator(Animator animator, boolean pause) {
+ if(pause) {
+ animator.pause();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating());
+ } else {
+ animator.resume();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(true, animator.isAnimating());
+ }
+ }
+ static void stopAnimator(Animator animator) {
+ animator.stop();
+ Assert.assertEquals(false, animator.isStarted());
+ Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating());
+ }
+
+ @Test
+ public void test01SyncedOneAnimator() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(null);
+ final Frame f1 = new Frame();
+ final Animator animator = new Animator();
+ animator.start();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating());
+
+ final GearsES2 g1 = new GearsES2(0);
+ final GLJPanel c1 = createGLJPanel(caps, f1, 0, 0, g1);
+ animator.add(c1);
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(true, animator.isAnimating());
+
+ final Frame f2 = new Frame();
+ final GearsES2 g2 = new GearsES2(0);
+ final GLJPanel c2 = createGLJPanel(caps, f2, f1.getX()+width,
+ f1.getY()+0, g2);
+ animator.add(c2);
+
+ final Frame f3 = new Frame();
+ final GearsES2 g3 = new GearsES2(0);
+ final GLJPanel c3 = createGLJPanel(caps, f3, f1.getX()+0,
+ f1.getY()+height, g3);
+ animator.add(c3);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f1.setVisible(true);
+ f2.setVisible(true);
+ f3.setVisible(true);
+ } } );
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ pauseAnimator(animator, true);
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ pauseAnimator(animator, false);
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ stopAnimator(animator);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ f1.dispose();
+ f2.dispose();
+ f3.dispose();
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ @Test
+ public void test02AsyncEachAnimator() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(null);
+ final Frame f1 = new Frame();
+ final Animator a1 = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLJPanel c1 = createGLJPanel(caps, f1, 0, 0, g1);
+ a1.add(c1);
+ a1.start();
+ Assert.assertEquals(true, a1.isStarted());
+ Assert.assertEquals(false, a1.isPaused());
+ Assert.assertEquals(true, a1.isAnimating());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f1.setVisible(true);
+ } } );
+
+ final Frame f2 = new Frame();
+ final Animator a2 = new Animator();
+ final GearsES2 g2 = new GearsES2(0);
+ final GLJPanel c2 = createGLJPanel(caps, f2, f1.getX()+width, f1.getY()+0, g2);
+ a2.add(c2);
+ a2.start();
+ Assert.assertEquals(true, a2.isStarted());
+ Assert.assertEquals(false, a2.isPaused());
+ Assert.assertEquals(true, a2.isAnimating());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f2.setVisible(true);
+ } } );
+
+ final Frame f3 = new Frame();
+ final Animator a3 = new Animator();
+ final GearsES2 g3 = new GearsES2(0);
+ final GLJPanel c3 = createGLJPanel(caps, f3, f1.getX()+0, f1.getY()+height, g3);
+ a3.add(c3);
+ a3.start();
+ Assert.assertEquals(true, a3.isStarted());
+ Assert.assertEquals(false, a3.isPaused());
+ Assert.assertEquals(true, a3.isAnimating());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f3.setVisible(true);
+ } } );
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ pauseAnimator(a1, true);
+ pauseAnimator(a2, true);
+ pauseAnimator(a3, true);
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ pauseAnimator(a1, false);
+ pauseAnimator(a2, false);
+ pauseAnimator(a3, false);
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ stopAnimator(a1);
+ stopAnimator(a2);
+ stopAnimator(a3);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ f1.dispose();
+ f2.dispose();
+ f3.dispose();
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ static long duration = 3*500; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestAnimatorGLJPanel01AWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..7b0fbe9
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java
@@ -0,0 +1,267 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.acore.anim;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.opengl.GLCapabilities;
+
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestAnimatorGLWindow01NEWT extends UITestCase {
+ static final int width = 640;
+ static final int height = 480;
+
+ protected GLWindow createGLWindow(final GLCapabilities caps, int x, int y, GearsES2 gears) throws InterruptedException {
+ final GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.addGLEventListener(gears);
+ glWindow.setPosition(x, y);
+ glWindow.setSize(width, height);
+ glWindow.setTitle("GLWindow: "+x+"/"+y);
+ return glWindow;
+ }
+
+ static void pauseAnimator(Animator animator, boolean pause) {
+ if(pause) {
+ animator.pause();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating());
+ } else {
+ animator.resume();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(true, animator.isAnimating());
+ }
+ }
+ static void stopAnimator(Animator animator) {
+ animator.stop();
+ Assert.assertEquals(false, animator.isStarted());
+ Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating());
+ }
+
+ @Test
+ public void test01SyncedOneAnimator() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(null);
+ final Animator animator = new Animator();
+ animator.start();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating());
+
+ final GearsES2 g1 = new GearsES2(0);
+ final GLWindow c1 = createGLWindow(caps, 0, 0, g1);
+ animator.add(c1);
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(true, animator.isAnimating());
+
+ final GearsES2 g2 = new GearsES2(0);
+ final GLWindow c2 = createGLWindow(caps, c1.getX()+width,
+ c1.getY()+0, g2);
+ animator.add(c2);
+
+ final GearsES2 g3 = new GearsES2(0);
+ final GLWindow c3 = createGLWindow(caps, c1.getX()+0,
+ c1.getY()+height, g3);
+ animator.add(c3);
+
+ c1.setVisible(true);
+ c2.setVisible(true);
+ c3.setVisible(true);
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ pauseAnimator(animator, true);
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ pauseAnimator(animator, false);
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ stopAnimator(animator);
+
+ c1.destroy();
+ c2.destroy();
+ c3.destroy();
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ @Test
+ public void test02AsyncEachAnimator() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(null);
+ final Animator a1 = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLWindow c1 = createGLWindow(caps, 0, 0, g1);
+ a1.add(c1);
+ a1.start();
+ Assert.assertEquals(true, a1.isStarted());
+ Assert.assertEquals(false, a1.isPaused());
+ Assert.assertEquals(true, a1.isAnimating());
+ c1.setVisible(true);
+
+ final Animator a2 = new Animator();
+ final GearsES2 g2 = new GearsES2(0);
+ final GLWindow c2 = createGLWindow(caps, c1.getX()+width, c1.getY()+0, g2);
+ a2.add(c2);
+ a2.start();
+ Assert.assertEquals(true, a2.isStarted());
+ Assert.assertEquals(false, a2.isPaused());
+ Assert.assertEquals(true, a2.isAnimating());
+ c2.setVisible(true);
+
+ final Animator a3 = new Animator();
+ final GearsES2 g3 = new GearsES2(0);
+ final GLWindow c3 = createGLWindow(caps, c1.getX()+0, c1.getY()+height, g3);
+ a3.add(c3);
+ a3.start();
+ Assert.assertEquals(true, a3.isStarted());
+ Assert.assertEquals(false, a3.isPaused());
+ Assert.assertEquals(true, a3.isAnimating());
+ c3.setVisible(true);
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ pauseAnimator(a1, true);
+ pauseAnimator(a2, true);
+ pauseAnimator(a3, true);
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ pauseAnimator(a1, false);
+ pauseAnimator(a2, false);
+ pauseAnimator(a3, false);
+
+ try {
+ Thread.sleep(duration/3);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ stopAnimator(a1);
+ stopAnimator(a2);
+ stopAnimator(a3);
+
+ c1.destroy();
+ c2.destroy();
+ c3.destroy();
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ static long duration = 3*500; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestAnimatorGLWindow01NEWT.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java
new file mode 100644
index 0000000..51d00a5
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java
@@ -0,0 +1,262 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.awt.GLCanvas;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Moving GLCanvas between 2 AWT JFrame
+ * <p>
+ * Validates bugs:
+ * <ul>
+ * <li>Bug 816: OSX CALayer Positioning Bug</li>
+ * <li>Bug 729: OSX CALayer shall honor the Component's visibility state</li>
+ * <li>Bug 849: AWT GLAutoDrawables (JAWTWindow) shall honor it's parent visibility state</li>
+ * <li>Bug 878: JAWTWindow's HierarchyListener doesn't set component visible (again) on 'addNotify(..)' - GLCanvas in JtabbedPane disappear</li>
+ * <li>Bug 889: GLCanvas disappear when moves between two JFrame</li>
+ * </ul>
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816GLCanvasFrameHoppingB849B889AWT extends UITestCase {
+ static long durationPerTest = 500*4; // ms
+ static boolean manual = false;
+
+ @Test
+ public void test01AllVisible() throws InterruptedException, InvocationTargetException {
+ test(false);
+ }
+
+ @Test
+ public void test02VisibleWithCanvas() throws InterruptedException, InvocationTargetException {
+ test(true);
+ }
+
+ private void test(final boolean onlyVisibleWithCanvas) throws InterruptedException, InvocationTargetException {
+ final JFrame frame1 = new JFrame("Bug889 #1");
+ final JPanel panel1 = new javax.swing.JPanel();
+ panel1.setLayout(new BorderLayout());
+ panel1.setSize(new java.awt.Dimension(640, 480));
+ frame1.setContentPane(panel1);
+ frame1.setSize(640, 480);
+ frame1.setLocation(64, 64);
+
+ final JFrame frame2 = new JFrame("Bug889 #2");
+ final JPanel panel2 = new javax.swing.JPanel();
+ panel2.setLayout(new BorderLayout());
+ panel2.setSize(new java.awt.Dimension(640, 480));
+ frame2.setContentPane(panel2);
+ frame2.setSize(640, 480);
+ frame2.setLocation(800, 64);
+
+ GLProfile profile = GLProfile.get(GLProfile.GL2ES2);
+ GLCapabilities glCapabilities = new GLCapabilities(profile);
+ final GLCanvas glCanvas = new GLCanvas(glCapabilities);
+ glCanvas.setSize(new java.awt.Dimension(640, 480));
+ glCanvas.addGLEventListener(new GearsES2(1));
+ panel1.add(glCanvas, BorderLayout.CENTER);
+
+ JButton bMoveP1toP2 = new JButton("Move to Panel2");
+ bMoveP1toP2.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ System.err.println("XXXX Move P1 -> P2 - START");
+ dumpGLCanvasStats(glCanvas);
+ panel2.add(glCanvas, BorderLayout.CENTER);
+ if( onlyVisibleWithCanvas ) {
+ frame1.setVisible(false);
+ frame2.setVisible(true);
+ frame2.toFront();
+ } else {
+ frame1.validate();
+ frame2.validate();
+ }
+ dumpGLCanvasStats(glCanvas);
+ System.err.println("XXXX Move P1 -> P2 - END");
+ }
+ });
+ panel1.add(bMoveP1toP2, BorderLayout.NORTH);
+
+ JButton bMoveP2toP1 = new JButton("Move to Panel1");
+ bMoveP2toP1.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ System.err.println("XXXX Move P2 -> P1 - START");
+ dumpGLCanvasStats(glCanvas);
+ panel1.add(glCanvas, BorderLayout.CENTER);
+ if( onlyVisibleWithCanvas ) {
+ frame2.setVisible(false);
+ frame1.setVisible(true);
+ frame1.toFront();
+ } else {
+ frame2.validate();
+ frame1.validate();
+ }
+ dumpGLCanvasStats(glCanvas);
+ System.err.println("XXXX Move P2 -> P1 - END");
+ }
+ });
+ panel2.add(bMoveP2toP1, BorderLayout.NORTH);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ // frame1.pack();
+ System.err.println("XXX SetVisible ON XXX GLCanvas on Panel1("+id(panel1)+")");
+ if( onlyVisibleWithCanvas ) {
+ frame1.setVisible(true);
+ } else {
+ frame1.setVisible(true);
+ frame2.setVisible(true);
+ }
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ dumpGLCanvasStats(glCanvas);
+
+ if(manual) {
+ for(long w=durationPerTest; w>0; w-=100) {
+ Thread.sleep(100);
+ }
+ } else {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Add GLCanvas Panel1("+id(panel1)+" -> Panel2("+id(panel2)+") START");
+ dumpGLCanvasStats(glCanvas);
+ panel2.add(glCanvas, BorderLayout.CENTER);
+ if( onlyVisibleWithCanvas ) {
+ frame1.setVisible(false);
+ frame2.setVisible(true);
+ frame2.toFront();
+ } else {
+ frame1.validate();
+ frame2.validate();
+ }
+ dumpGLCanvasStats(glCanvas);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Add GLCanvas Panel2("+id(panel2)+") -> Panel1("+id(panel1)+" START");
+ dumpGLCanvasStats(glCanvas);
+ panel1.add(glCanvas, BorderLayout.CENTER);
+ if( onlyVisibleWithCanvas ) {
+ frame2.setVisible(false);
+ frame1.setVisible(true);
+ frame1.toFront();
+ } else {
+ frame2.validate();
+ frame1.validate();
+ }
+ dumpGLCanvasStats(glCanvas);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Add GLCanvas Panel1("+id(panel1)+" -> Panel2("+id(panel2)+") START");
+ dumpGLCanvasStats(glCanvas);
+ panel2.add(glCanvas, BorderLayout.CENTER);
+ if( onlyVisibleWithCanvas ) {
+ frame1.setVisible(false);
+ frame2.setVisible(true);
+ frame2.toFront();
+ } else {
+ frame1.validate();
+ frame2.validate();
+ }
+ dumpGLCanvasStats(glCanvas);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Add GLCanvas Panel2("+id(panel2)+") -> Panel1("+id(panel1)+" START");
+ dumpGLCanvasStats(glCanvas);
+ panel1.add(glCanvas, BorderLayout.CENTER);
+ if( onlyVisibleWithCanvas ) {
+ frame2.setVisible(false);
+ frame1.setVisible(true);
+ frame1.toFront();
+ } else {
+ frame2.validate();
+ frame1.validate();
+ }
+ dumpGLCanvasStats(glCanvas);
+ }});
+ Thread.sleep(durationPerTest/4);
+ }
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ System.err.println("XXX SetVisible OFF XXX");
+ frame1.dispose();
+ frame2.dispose();
+ } });
+ }
+
+ private static String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); }
+
+ static void dumpGLCanvasStats(GLCanvas glCanvas) {
+ System.err.println("XXXX GLCanvas: comp "+glCanvas+", visible "+glCanvas.isVisible()+", showing "+glCanvas.isShowing()+
+ ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getWidth()+"x"+glCanvas.getHeight());
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest);
+ } else if(args[i].equals("-manual")) {
+ manual = true;
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestBug816GLCanvasFrameHoppingB849B889AWT.class.getName());
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
index fade6c3..5a7c5c9 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.awt;
import javax.media.opengl.*;
@@ -78,10 +78,10 @@ import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug816OSXCALayerPos01AWT extends UITestCase {
public enum FrameLayout { None, Flow, DoubleBorderCenterSurrounded, Box, Split };
-
- static long duration = 1600; // ms
+
+ static long duration = 1600; // ms
static int width, height;
-
+
static boolean forceES2 = false;
static boolean forceGL3 = false;
static int swapInterval = 1;
@@ -110,14 +110,14 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
comp2.setPreferredSize(new_sz2);
comp2.setSize(new_sz2);
}
- if( null != frame ) {
+ if( null != frame ) {
frame.pack();
}
} } );
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
}
static void setFrameSize(final Frame frame, final boolean frameLayout, final java.awt.Dimension new_sz) {
try {
@@ -131,9 +131,9 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
}
-
+
protected void runTestGL(GLCapabilities caps, FrameLayout frameLayout, final boolean twoCanvas, final boolean resizeByComp) throws InterruptedException, InvocationTargetException {
final JFrame frame = new JFrame("Bug816: "+this.getTestMethodName());
Assert.assertNotNull(frame);
@@ -148,12 +148,12 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
} else {
glCanvas2 = null;
}
-
+
final Dimension glcDim = new Dimension(width/2, height);
final Dimension frameDim = new Dimension(twoCanvas ? width + 64: width/2 + 64, height + 64);
-
+
setComponentSize(null, glCanvas1, glcDim, glCanvas2, glcDim);
-
+
switch( frameLayout) {
case None: {
framePane.add(glCanvas1);
@@ -227,11 +227,11 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
model.setExtent(1);
hsb.setEnabled(true);
}
- JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
+ JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
twoCanvas ? glCanvas2 : vsp, glCanvas1 );
horizontalSplitPane.setResizeWeight(0.5);
- JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
- true, horizontalSplitPane, hsp);
+ JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+ true, horizontalSplitPane, hsp);
verticalSplitPane.setResizeWeight(0.5);
framePane.add(verticalSplitPane);
}
@@ -243,7 +243,7 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
final RedSquareES2 demo2 = new RedSquareES2(swapInterval);
glCanvas2.addGLEventListener(demo2);
}
-
+
final Animator animator = new Animator();
animator.add(glCanvas1);
if( twoCanvas ) {
@@ -261,18 +261,17 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
setFrameSize(frame, true, frameDim);
}
frame.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
if( twoCanvas ) {
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true));
}
-
+
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
- animator.setUpdateFPSFrames(60, System.err);
-
+
System.err.println("canvas1 pos/siz: "+glCanvas1.getX()+"/"+glCanvas1.getY()+" "+glCanvas1.getWidth()+"x"+glCanvas1.getHeight());
if( twoCanvas ) {
System.err.println("canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getWidth()+"x"+glCanvas2.getHeight());
@@ -290,7 +289,7 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
if( twoCanvas ) {
System.err.println("resize canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getWidth()+"x"+glCanvas2.getHeight());
}
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
@@ -305,7 +304,7 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
} else {
Assert.assertNull(glCanvas2);
}
-
+
Assert.assertNotNull(animator);
animator.stop();
Assert.assertFalse(animator.isAnimating());
@@ -329,14 +328,14 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
static GLProfile getGLP() {
return GLProfile.getMaxProgrammableCore(true);
}
-
+
@Test
public void test00_Compo_None_One() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 0 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.None, false /* twoCanvas */, true /* resizeByComp */);
}
-
+
@Test
public void test01_Compo_Flow_One() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 1 ) { return ; }
@@ -350,21 +349,21 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, false /* twoCanvas */, true /* resizeByComp */);
}
-
+
@Test
public void test03_Compo_Box_One() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 3 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.Box, false /* twoCanvas */, true /* resizeByComp */);
}
-
+
@Test
public void test04_Compo_Split_One() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 4 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.Split, false /* twoCanvas */, true /* resizeByComp */);
}
-
+
@Test
public void test05_Compo_Flow_Two() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 5 ) { return ; }
@@ -378,28 +377,28 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, true/* twoCanvas */, true /* resizeByComp */);
}
-
+
@Test
public void test07_Compo_Box_Two() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 7 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.Box, true/* twoCanvas */, true /* resizeByComp */);
}
-
+
@Test
public void test08_Compo_Split_Two() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 8 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.Split, true/* twoCanvas */, true /* resizeByComp */);
}
-
+
@Test
public void test10_Frame_None_One() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 10 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.None, false /* twoCanvas */, false /* resizeByComp */);
}
-
+
@Test
public void test11_Frame_Flow_One() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 11 ) { return ; }
@@ -413,21 +412,21 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, false /* twoCanvas */, false /* resizeByComp */);
}
-
+
@Test
public void test13_Frame_Box_One() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 13 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.Box, false /* twoCanvas */, false /* resizeByComp */);
}
-
+
@Test
public void test14_Frame_Split_One() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 14) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.Split, false /* twoCanvas */, false /* resizeByComp */);
}
-
+
@Test
public void test15_Frame_Flow_Two() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 15 ) { return ; }
@@ -441,23 +440,23 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, true/* twoCanvas */, false /* resizeByComp */);
}
-
+
@Test
public void test17_Frame_Box_Two() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 17 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.Box, true/* twoCanvas */, false /* resizeByComp */);
}
-
+
@Test
public void test18_Frame_Split_Two() throws InterruptedException, InvocationTargetException {
if( testNum != -1 && testNum != 18 ) { return ; }
final GLCapabilities caps = new GLCapabilities(getGLP());
runTestGL(caps, FrameLayout.Split, true/* twoCanvas */, false /* resizeByComp */);
}
-
+
static int testNum = -1;
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -475,12 +474,12 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
swapInterval = MiscUtils.atoi(args[i], swapInterval);
}
}
-
+
System.err.println("resize "+rwsize);
System.err.println("forceES2 "+forceES2);
System.err.println("forceGL3 "+forceGL3);
System.err.println("swapInterval "+swapInterval);
-
+
org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos01AWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
index 0739564..df24fc6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.awt;
import javax.media.opengl.*;
@@ -64,32 +64,32 @@ import org.junit.runners.MethodSorters;
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug816OSXCALayerPos02AWT extends UITestCase {
- static long duration = 1600; // ms
+ static long duration = 1600; // ms
static int width=640, height=480;
-
+
@Test
public void test() throws InterruptedException, InvocationTargetException {
final GLCapabilities caps = new GLCapabilities(getGLP());
-
+
final JFrame frame = new JFrame("TestBug816OSXCALayerPos02AWT");
Assert.assertNotNull(frame);
final GLCanvas glCanvas1 = new GLCanvas(caps);
Assert.assertNotNull(glCanvas1);
glCanvas1.addGLEventListener(new GearsES2(1));
-
+
final Animator animator = new Animator();
animator.add(glCanvas1);
QuitAdapter quitAdapter = new QuitAdapter();
-
+
new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
- // Build a GUI where the canvas 3D is located at top right of the frame
+ // Build a GUI where the canvas 3D is located at top right of the frame
// and can be resized with split panes dividers
- JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
- true, new JScrollPane(), glCanvas1);
+ JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+ true, new JScrollPane(), glCanvas1);
verticalSplitPane.setResizeWeight(0.5);
- JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
+ JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
true, new JScrollPane(), verticalSplitPane);
horizontalSplitPane.setResizeWeight(0.5);
JRootPane intermediateRootPane = new JRootPane();
@@ -100,15 +100,14 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase {
public void run() {
frame.setSize(width, height);
frame.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
-
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
- animator.setUpdateFPSFrames(60, System.err);
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
@@ -118,7 +117,7 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase {
Assert.assertNotNull(frame);
Assert.assertNotNull(glCanvas1);
-
+
Assert.assertNotNull(animator);
animator.stop();
Assert.assertFalse(animator.isAnimating());
@@ -139,7 +138,7 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase {
static GLProfile getGLP() {
return GLProfile.getMaxProgrammableCore(true);
}
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -147,7 +146,7 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase {
duration = MiscUtils.atol(args[i], duration);
}
}
-
+
org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos02AWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
index 7df6d04..e1a0944 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.awt;
import java.awt.BorderLayout;
@@ -71,24 +71,24 @@ import com.jogamp.opengl.util.Animator;
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase {
- static long duration = 1600; // ms
+ static long duration = 1600; // ms
static int width=640, height=480;
-
+
@Test
public void test() throws InterruptedException, InvocationTargetException {
final GLCapabilities caps = new GLCapabilities(getGLP());
-
+
final Frame frame = new Frame("TestBug816OSXCALayerPos03aAWT");
Assert.assertNotNull(frame);
final GLCanvas glCanvas1 = new GLCanvas(caps);
Assert.assertNotNull(glCanvas1);
glCanvas1.addGLEventListener(new GearsES2(1));
-
+
final Animator animator = new Animator();
animator.add(glCanvas1);
QuitAdapter quitAdapter = new QuitAdapter();
-
+
new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
// Create a check box that hides / shows canvas
@@ -112,15 +112,14 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase {
public void run() {
frame.setSize(width, height);
frame.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
-
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
- animator.setUpdateFPSFrames(60, System.err);
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
@@ -130,7 +129,7 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase {
Assert.assertNotNull(frame);
Assert.assertNotNull(glCanvas1);
-
+
Assert.assertNotNull(animator);
animator.stop();
Assert.assertFalse(animator.isAnimating());
@@ -151,7 +150,7 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase {
static GLProfile getGLP() {
return GLProfile.getMaxProgrammableCore(true);
}
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -159,7 +158,7 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase {
duration = MiscUtils.atol(args[i], duration);
}
}
-
+
org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03aB729AWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
index 210113d..b9ee6a4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.awt;
import java.awt.BorderLayout;
@@ -74,13 +74,13 @@ import com.jogamp.opengl.util.Animator;
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
- static long duration = 1600; // ms
+ static long duration = 1600; // ms
static int width=640, height=480;
-
+
@Test
public void test() throws InterruptedException, InvocationTargetException {
final GLCapabilities caps = new GLCapabilities(getGLP());
-
+
final Frame frame = new Frame("TestBug816OSXCALayerPos03bAWT");
Assert.assertNotNull(frame);
@@ -90,11 +90,11 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
// Put it in a panel
final Panel panel = new Panel(new GridLayout(1, 1));
panel.add(glCanvas1);
-
+
final Animator animator = new Animator();
animator.add(glCanvas1);
QuitAdapter quitAdapter = new QuitAdapter();
-
+
new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
// Create a check box that hides / shows canvas
@@ -118,15 +118,14 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
public void run() {
frame.setSize(width, height);
frame.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
-
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
- animator.setUpdateFPSFrames(60, System.err);
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
@@ -136,7 +135,7 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
Assert.assertNotNull(frame);
Assert.assertNotNull(glCanvas1);
-
+
Assert.assertNotNull(animator);
animator.stop();
Assert.assertFalse(animator.isAnimating());
@@ -157,7 +156,7 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
static GLProfile getGLP() {
return GLProfile.getMaxProgrammableCore(true);
}
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -165,7 +164,7 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
duration = MiscUtils.atol(args[i], duration);
}
}
-
+
org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03bB849AWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
index 54d20b7..9a536d5 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.awt;
import java.awt.BorderLayout;
@@ -75,28 +75,28 @@ import com.jogamp.opengl.util.Animator;
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase {
- static long duration = 1600; // ms
+ static long duration = 1600; // ms
static int width=640, height=480;
-
+
@Test
public void test() throws InterruptedException, InvocationTargetException {
final GLCapabilities caps = new GLCapabilities(getGLP());
-
+
final JFrame frame = new JFrame("TestBug816OSXCALayerPos03cAWT");
Assert.assertNotNull(frame);
final Container framePane = frame.getContentPane();
-
+
final GLCanvas glCanvas1 = new GLCanvas(caps);
Assert.assertNotNull(glCanvas1);
glCanvas1.addGLEventListener(new GearsES2(1));
// Put it in a panel
final JPanel panel = new JPanel(new GridLayout(1, 1));
panel.add(glCanvas1);
-
+
final Animator animator = new Animator();
animator.add(glCanvas1);
QuitAdapter quitAdapter = new QuitAdapter();
-
+
new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
// Create a check box that hides / shows canvas
@@ -120,15 +120,14 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase {
public void run() {
frame.setSize(width, height);
frame.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
-
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
- animator.setUpdateFPSFrames(60, System.err);
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
@@ -138,7 +137,7 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase {
Assert.assertNotNull(frame);
Assert.assertNotNull(glCanvas1);
-
+
Assert.assertNotNull(animator);
animator.stop();
Assert.assertFalse(animator.isAnimating());
@@ -159,7 +158,7 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase {
static GLProfile getGLP() {
return GLProfile.getMaxProgrammableCore(true);
}
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -167,7 +166,7 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase {
duration = MiscUtils.atol(args[i], duration);
}
}
-
+
org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03cB849AWT.class.getName());
}
}
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 2587f8d..605f97f 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
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -63,12 +63,12 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
- * Sample program that relies on JOGL's mechanism to handle the OpenGL context
+ * Sample program that relies on JOGL's mechanism to handle the OpenGL context
* and rendering loop when using an AWT canvas attached to an Applet.
* <p>
- * BUG on OSX/CALayer w/ Java6:
+ * BUG on OSX/CALayer w/ Java6:
* If frame.setTitle() is issued right after initialization the call hangs in
- * <pre>
+ * <pre>
* at apple.awt.CWindow._setTitle(Native Method)
* at apple.awt.CWindow.setTitle(CWindow.java:765) [1.6.0_37, build 1.6.0_37-b06-434-11M3909]
* </pre>
@@ -81,7 +81,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* e.g. setResizable*().
* </p>
* <p>
- * Users shall make sure all mutable AWT calls are performed on the EDT, even before 1st setVisible(true) !
+ * Users shall make sure all mutable AWT calls are performed on the EDT, even before 1st setVisible(true) !
* </p>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -90,89 +90,89 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
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 boolean fullScreen = false;
+
+ 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 printThreadInfo = false;
public boolean printEventInfo = false;
-
+
/////////////////////////////////////////////////////////////
//
// Internal variables
-
+
int width;
int height;
-
- String OPENGL_VENDOR;
+
+ String OPENGL_VENDOR;
String OPENGL_RENDERER;
- String OPENGL_VERSION;
- String OPENGL_EXTENSIONS;
-
+ String OPENGL_VERSION;
+ String OPENGL_EXTENSIONS;
+
int currentSamples = -1;
-
+
private Frame frame;
private GLProfile profile;
private GLCapabilities capabilities;
private GLCanvas canvas;
-
+
private SimpleListener listener;
private CustomAnimator animator;
-
+
private long beforeTime;
private long overSleepTime;
- private long frameRatePeriod = 1000000000L / frameRate;
-
- private boolean initialized = false;
+ private final long frameRatePeriod = 1000000000L / frameRate;
+
+ 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 c = 0;
+
private long millisOffset;
private int fcount, lastm;
private float frate;
- private int fint = 3;
-
+ private final int fint = 3;
+
private boolean setFramerate = false;
private boolean restarted = false;
-
+
private int frameCount = 0;
-
+
void run() throws InterruptedException, InvocationTargetException {
// Thread loop = new Thread("Animation Thread") {
- // public void run() {
+ // public void run() {
frameCount = 0;
while ( frameCount < framesPerTest ) {
if (!initialized) {
- setup();
+ setup();
}
-
+
if (restartCanvas && restartTimeout == frameCount) {
restart();
}
-
+
if (useAnimator) {
animator.requestRender();
} else {
- canvas.display();
+ canvas.display();
}
-
+
clock();
-
+
frameCount++;
if( null == frame ) {
break;
@@ -181,32 +181,32 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
dispose();
// }
// };
- // loop.start();
+ // loop.start();
}
-
+
void setup() throws InterruptedException, InvocationTargetException {
if (printThreadInfo) System.out.println("Current thread at setup(): " + Thread.currentThread());
-
- millisOffset = System.currentTimeMillis();
-
+
+ millisOffset = System.currentTimeMillis();
+
final VersionNumber version170 = new VersionNumber(1, 7, 0);
- osxCALayerAWTModBug = Platform.OSType.MACOS == Platform.getOSType() &&
+ 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;
+ height = 300;
final MiniPApplet applet = this;
-
+
GraphicsEnvironment environment =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
frame = new Frame(displayDevice.getDefaultConfiguration());
-
+
final Rectangle fullScreenRect;
if (fullScreen) {
DisplayMode mode = displayDevice.getDisplayMode();
@@ -231,7 +231,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
} catch (Throwable t) {
t.printStackTrace();
Assume.assumeNoException(t);
- }
+ }
}
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
@@ -252,25 +252,25 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
applet.width, applet.height);
} else {
Insets insets = frame.getInsets();
-
+
int windowW = applet.width + insets.left + insets.right;
int windowH = applet.height + insets.top + insets.bottom;
- int locationX = 100;
+ int locationX = 100;
int locationY = 100;
-
+
frame.setSize(windowW, windowH);
frame.setLocation(locationX, locationY);
-
+
int usableWindowH = windowH - insets.top - insets.bottom;
- applet.setBounds((windowW - width)/2, insets.top + (usableWindowH - height)/2, width, height);
+ applet.setBounds((windowW - width)/2, insets.top + (usableWindowH - height)/2, width, height);
}
}});
} catch (Throwable t) {
t.printStackTrace();
Assume.assumeNoException(t);
}
-
-
+
+
frame.add(this);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
@@ -280,63 +280,63 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
Assume.assumeNoException(ex);
}
}
- });
-
+ });
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
} } );
-
+
// Canvas setup ----------------------------------------------------------
-
+
profile = GLProfile.getDefault();
- capabilities = new GLCapabilities(profile);
+ 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() {
public void run() {
MiniPApplet.this.setLayout(new BorderLayout());
MiniPApplet.this.add(canvas, BorderLayout.CENTER);
MiniPApplet.this.validate();
} } );
- canvas.addMouseMotionListener(this);
+ canvas.addMouseMotionListener(this);
canvas.addKeyListener(this);
-
+
// Setting up animation
listener = new SimpleListener();
canvas.addGLEventListener(listener);
if (useAnimator) {
animator = new CustomAnimator(canvas);
animator.start();
- }
- initialized = true;
+ }
+ initialized = true;
}
-
+
void restart() throws InterruptedException, InvocationTargetException {
System.out.println("Restarting surface...");
-
+
// Stopping animation, removing current canvas.
if (useAnimator) {
animator.stop();
animator.remove(canvas);
}
canvas.disposeGLEventListener(listener, true);
- this.remove(canvas);
-
- capabilities = new GLCapabilities(profile);
+ this.remove(canvas);
+
+ capabilities = new GLCapabilities(profile);
capabilities.setSampleBuffers(true);
capabilities.setNumSamples(numSamples);
-
+
canvas = new GLCanvas(capabilities);
canvas.setBounds(0, 0, width, height);
-
+
// Setting up animation again
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -346,24 +346,24 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
} } );
canvas.addMouseMotionListener(this);
canvas.addKeyListener(this);
-
+
canvas.addGLEventListener(listener);
if (useAnimator) {
animator.add(canvas);
animator.start();
- }
-
+ }
+
setFramerate = false;
restarted = true;
-
+
System.out.println("Done");
}
-
+
void dispose() throws InterruptedException, InvocationTargetException {
if( null == frame ) {
return;
}
-
+
// Stopping animation, removing current canvas.
if (useAnimator) {
animator.stop();
@@ -387,7 +387,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
}});
}
}
-
+
void draw(GL2 gl) {
if( !osxCALayerAWTModBug || !justInitialized ) {
AWTEDTExecutor.singleton.invoke(true, new Runnable() {
@@ -395,19 +395,19 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
frame.setTitle("frame " + frameCount);
} } );
}
-
- if (printThreadInfo) System.out.println("Current thread at draw(): " + Thread.currentThread());
-
+
+ if (printThreadInfo) System.out.println("Current thread at draw(): " + Thread.currentThread());
+
if (OPENGL_VENDOR == null) {
- OPENGL_VENDOR = gl.glGetString(GL.GL_VENDOR);
+ OPENGL_VENDOR = gl.glGetString(GL.GL_VENDOR);
OPENGL_RENDERER = gl.glGetString(GL.GL_RENDERER);
- OPENGL_VERSION = gl.glGetString(GL.GL_VERSION);
+ 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);
-
+
int[] temp = { 0 };
gl.glGetIntegerv(GL2.GL_MAX_SAMPLES, temp, 0);
System.out.println("Maximum number of samples supported by the hardware: " + temp[0]);
@@ -416,43 +416,43 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
System.out.println("GLCanvas: "+canvas);
System.out.println("GLDrawable: "+canvas.getDelegatedDrawable());
}
-
+
if (currentSamples == -1) {
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.");
- }
+ }
}
-
- if (!setFramerate) {
+
+ if (!setFramerate) {
if (60 < frameRate) {
// Disables vsync
- gl.setSwapInterval(0);
- } else if (30 < frameRate) {
- gl.setSwapInterval(1);
+ gl.setSwapInterval(0);
+ } else if (30 < frameRate) {
+ gl.setSwapInterval(1);
} else {
gl.setSwapInterval(2);
- }
- setFramerate = true;
+ }
+ setFramerate = true;
}
-
+
if (restarted) {
int[] temp = { 0 };
- gl.glGetIntegerv(GL.GL_SAMPLES, 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.");
- }
+ }
}
-
+
gl.glClearColor(0, 0, 0, 1);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
-
+
theta += 0.01;
s = Math.sin(theta);
- c = Math.cos(theta);
-
+ c = Math.cos(theta);
+
gl.glBegin(GL.GL_TRIANGLES);
gl.glColor3f(1, 0, 0);
gl.glVertex2d(-c, -c);
@@ -460,135 +460,125 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
gl.glVertex2d(0, c);
gl.glColor3f(0, 0, 1);
gl.glVertex2d(s, -s);
- gl.glEnd();
-
+ gl.glEnd();
+
gl.glFlush();
-
+
fcount += 1;
int m = (int) (System.currentTimeMillis() - millisOffset);
if (m - lastm > 1000 * fint) {
frate = (float)(fcount) / fint;
fcount = 0;
lastm = m;
- System.err.println("fps: " + frate);
- }
+ System.err.println("fps: " + frate);
+ }
}
-
+
void clock() {
long afterTime = System.nanoTime();
long timeDiff = afterTime - beforeTime;
long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
-
+
if (sleepTime > 0) { // some time left in this cycle
try {
Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
} catch (InterruptedException ex) { }
-
+
overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
-
+
} else { // sleepTime <= 0; the frame took longer than the period
overSleepTime = 0L;
}
-
- beforeTime = System.nanoTime();
- }
-
+
+ beforeTime = System.nanoTime();
+ }
+
class SimpleListener implements GLEventListener {
@Override
public void display(GLAutoDrawable drawable) {
draw(drawable.getGL().getGL2());
justInitialized = false;
}
-
+
@Override
public void dispose(GLAutoDrawable drawable) { }
-
+
@Override
public void init(GLAutoDrawable drawable) {
justInitialized = true;
}
-
+
@Override
- public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { }
+ public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { }
}
-
+
public void mouseDragged(MouseEvent ev) {
if (printEventInfo) {
System.err.println("Mouse dragged event: " + ev);
}
}
-
+
public void mouseMoved(MouseEvent ev) {
if (printEventInfo) {
System.err.println("Mouse moved event: " + ev);
}
- }
-
- public void keyPressed(KeyEvent ev) {
+ }
+
+ public void keyPressed(KeyEvent ev) {
if (printEventInfo) {
System.err.println("Key pressed event: " + ev);
}
}
-
- public void keyReleased(KeyEvent ev) {
+
+ public void keyReleased(KeyEvent ev) {
if (printEventInfo) {
System.err.println("Key released event: " + ev);
- }
+ }
}
-
- public void keyTyped(KeyEvent ev) {
+
+ public void keyTyped(KeyEvent ev) {
if (printEventInfo) {
System.err.println("Key typed event: " + ev);
- }
+ }
}
-
+
/** An Animator subclass which renders one frame at the time
- * upon calls to the requestRender() method.
+ * upon calls to the requestRender() method.
**/
- public class CustomAnimator extends AnimatorBase {
+ public class CustomAnimator extends AnimatorBase {
private Timer timer = null;
private TimerTask task = null;
private volatile boolean shouldRun;
-
+
protected String getBaseName(String prefix) {
return "Custom" + prefix + "Animator" ;
}
-
- /** Creates an CustomAnimator with an initial drawable to
+
+ /** Creates an CustomAnimator with an initial drawable to
* animate. */
public CustomAnimator(GLAutoDrawable drawable) {
if (drawable != null) {
add(drawable);
}
}
-
+
public synchronized void requestRender() {
shouldRun = true;
}
-
- public final boolean isStarted() {
- stateSync.lock();
- try {
- return (timer != null);
- } finally {
- stateSync.unlock();
- }
+
+ public final synchronized boolean isStarted() {
+ return (timer != null);
}
-
- public final boolean isAnimating() {
- stateSync.lock();
- try {
- return (timer != null) && (task != null);
- } finally {
- stateSync.unlock();
- }
+
+ public final synchronized boolean isAnimating() {
+ return (timer != null) && (task != null);
}
-
+
private void startTask() {
if(null != task) {
return;
}
-
+
task = new TimerTask() {
private boolean firstRun = true;
public void run() {
@@ -599,67 +589,57 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
if(CustomAnimator.this.shouldRun) {
CustomAnimator.this.animThread = Thread.currentThread();
// display impl. uses synchronized block on the animator instance
- display();
+ display();
synchronized (this) {
// done with current frame.
shouldRun = false;
- }
+ }
}
}
};
-
+
fpsCounter.resetFPSCounter();
shouldRun = false;
-
+
timer.schedule(task, 0, 1);
}
-
+
public synchronized boolean start() {
if (timer != null) {
return false;
}
- stateSync.lock();
- try {
- timer = new Timer();
- startTask();
- } finally {
- stateSync.unlock();
- }
+ timer = new Timer();
+ startTask();
return true;
}
-
+
/** Stops this CustomAnimator. */
public synchronized boolean stop() {
if (timer == null) {
return false;
}
- stateSync.lock();
- try {
- 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
- } catch (InterruptedException e) { }
- } finally {
- stateSync.unlock();
+ 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
+ } catch (InterruptedException e) { }
return true;
}
-
- public final boolean isPaused() { return false; }
+
+ public final synchronized boolean isPaused() { return false; }
public synchronized boolean resume() { return false; }
- public synchronized boolean pause() { return false; }
+ public synchronized boolean pause() { return false; }
}
}
-
+
@Test
public void test00() {
TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet mini;
@@ -668,7 +648,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
mini = (TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet) c.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
if (mini != null) {
try {
mini.run();
@@ -677,7 +657,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
}
}
}
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-frames")) {
@@ -686,5 +666,5 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
}
org.junit.runner.JUnitCore.main(TestGLCanvasAWTActionDeadlock02AWT.class.getName());
}
-
+
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java
new file mode 100644
index 0000000..2133d62
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java
@@ -0,0 +1,209 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+import java.awt.Dimension;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.awt.GLJPanel;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Multiple GLJPanels in a JFrame
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestGLJPanelResize01AWT extends UITestCase {
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton();
+ }
+
+ static Dimension[] esize00 = {
+ new Dimension(281, 151),
+ new Dimension(282, 151),
+ new Dimension(283, 151),
+ new Dimension(284, 151),
+
+ new Dimension(284, 152),
+ new Dimension(283, 152),
+ new Dimension(282, 152),
+ new Dimension(281, 152),
+
+ new Dimension(291, 153),
+ new Dimension(292, 153),
+ new Dimension(293, 153),
+ new Dimension(294, 153),
+
+ new Dimension(281, 154),
+ new Dimension(282, 154),
+ new Dimension(283, 154),
+ new Dimension(284, 154)
+ };
+ static Dimension[] esize01 = {
+ new Dimension(283, 154), // #3: new sub-aligned image in pixelBuffer-1
+ new Dimension(291, 154), // #2: new pixelBuffer-1
+ new Dimension(282, 154), // #1: new pixelBuffer-0
+ };
+ static Dimension[] esize02 = {
+ new Dimension(291, 154), // #2: new pixelBuffer-1
+ new Dimension(282, 154), // #1: new pixelBuffer-0
+ };
+
+ public void test(final GLCapabilitiesImmutable caps, final Dimension[] dims, final boolean useSwingDoubleBuffer) {
+ final int cols = 4;
+ final int rows = dims.length / cols + ( dims.length % cols > 0 ? 1 : 0 );
+ final JFrame[] frame = new JFrame[] { null };
+
+ System.err.println("Frame size: cols x rows "+cols+"x"+rows);
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame[0] = new JFrame();
+ frame[0].setLocation(64, 64);
+ final JPanel panel = new JPanel();
+ panel.setLayout(null); // new BorderLayout());
+ panel.setDoubleBuffered(useSwingDoubleBuffer);
+ frame[0].getContentPane().add(panel);
+
+ final int x0 = 4;
+ int x = x0, y = 4;
+ int maxRowWidth = 0;
+ for(int i=0; i<rows; i++) {
+ int maxColHeight = 0;
+ for(int j=0; j<cols; j++) {
+ final int idx = i*cols+j;
+ if( idx >= dims.length ) { break; }
+ final Dimension d = dims[idx];
+ if( d.height > maxColHeight ) {
+ maxColHeight = d.height;
+ }
+ final GLJPanel glad = createGLJPanel(useSwingDoubleBuffer, caps, d, "[r "+i+", c "+j+"]");
+ panel.add(glad);
+ glad.setLocation(x, y);
+ x+=d.width+4;
+ }
+ if( x > maxRowWidth ) {
+ maxRowWidth = x;
+ }
+ x = x0;
+ y += maxColHeight+4;
+ }
+ frame[0].setSize(maxRowWidth+4+64, y+4+64);
+ // frame[0].pack();
+ frame[0].setVisible(true);
+ } } );
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ try {
+ Thread.sleep(duration);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame[0].dispose();
+ } } );
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ private GLJPanel createGLJPanel(final boolean useSwingDoubleBuffer, final GLCapabilitiesImmutable caps, final Dimension size, final String name) {
+ final GLJPanel canvas = new GLJPanel(caps);
+ canvas.setName(name);
+ canvas.setSize(size);
+ canvas.setPreferredSize(size);
+ canvas.setMinimumSize(size);
+ canvas.setDoubleBuffered(useSwingDoubleBuffer);
+ final GearsES2 g = new GearsES2(0);
+ g.setVerbose(false);
+ canvas.addGLEventListener(g);
+ return canvas;
+ }
+
+ static GLCapabilitiesImmutable caps = null;
+
+ // @Test
+ public void test00() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), esize00, false /*useSwingDoubleBuffer*/);
+ }
+
+ @Test
+ public void test01() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), esize01, false /*useSwingDoubleBuffer*/);
+ }
+
+ @Test
+ public void test02() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), esize02, false /*useSwingDoubleBuffer*/);
+ }
+
+ static long duration = 600; // ms
+
+ public static void main(String[] args) {
+ boolean useSwingDoubleBuffer=false, manual=false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-swingDoubleBuffer")) {
+ useSwingDoubleBuffer = true;
+ } else if(args[i].equals("-manual")) {
+ manual = true;
+ }
+ }
+ if( manual ) {
+ GLProfile.initSingleton();
+ TestGLJPanelResize01AWT demo = new TestGLJPanelResize01AWT();
+ demo.test(new GLCapabilities(null), esize01, useSwingDoubleBuffer);
+ } else {
+ org.junit.runner.JUnitCore.main(TestGLJPanelResize01AWT.class.getName());
+ }
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
index ab3899a..38d4d8b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
@@ -13,16 +13,16 @@ import com.jogamp.opengl.util.texture.TextureIO;
import com.jogamp.opengl.util.texture.TextureSequence;
public class TextureSequenceDemo01 implements TextureSequence {
- TextureSequence.TextureFrame frame = null;
+ TextureSequence.TextureFrame frame = null;
int textureUnit = 0;
protected int[] texMinMagFilter = { GL.GL_NEAREST, GL.GL_NEAREST };
protected int[] texWrapST = { GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE };
final boolean useBuildInTexLookup;
-
+
public TextureSequenceDemo01(boolean useBuildInTexLookup) {
this.useBuildInTexLookup = useBuildInTexLookup;
}
-
+
public void initGLResources(GL gl) throws GLException {
if(null == frame) {
TextureData texData = null;
@@ -38,24 +38,29 @@ public class TextureSequenceDemo01 implements TextureSequence {
frame = new TextureSequence.TextureFrame(tex);
tex.bind(gl);
gl.glTexParameteri(tex.getTarget(), GL.GL_TEXTURE_MIN_FILTER, texMinMagFilter[0]);
- gl.glTexParameteri(tex.getTarget(), GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]);
+ gl.glTexParameteri(tex.getTarget(), GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]);
gl.glTexParameteri(tex.getTarget(), GL.GL_TEXTURE_WRAP_S, texWrapST[0]);
gl.glTexParameteri(tex.getTarget(), GL.GL_TEXTURE_WRAP_T, texWrapST[1]);
}
}
-
+
public void destroyGLResources(GL gl) {
if(null != frame) {
frame.getTexture().destroy(gl);
frame = null;
}
}
-
+
public void destroy(GL gl) throws GLException {
frame.getTexture().destroy(gl);
- frame = null;
+ frame = null;
+ }
+
+ @Override
+ public int getTextureTarget() {
+ return GL.GL_TEXTURE_2D;
}
-
+
@Override
public int getTextureUnit() {
return textureUnit;
@@ -80,19 +85,19 @@ public class TextureSequenceDemo01 implements TextureSequence {
public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException {
return frame;
}
-
+
@Override
public String getRequiredExtensionsShaderStub() throws IllegalStateException {
return "// TextTextureSequence: No extensions required\n";
}
-
+
@Override
public String getTextureSampler2DType() throws IllegalStateException {
return "sampler2D" ;
- }
-
+ }
+
private String textureLookupFunctionName = "myTexture2D";
-
+
@Override
public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException {
if(useBuildInTexLookup) {
@@ -103,7 +108,7 @@ public class TextureSequenceDemo01 implements TextureSequence {
}
return textureLookupFunctionName;
}
-
+
@Override
public String getTextureLookupFragmentShaderImpl() throws IllegalStateException {
if(useBuildInTexLookup) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
index 811e918..5891bce 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
@@ -23,10 +23,11 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
private boolean debug = false ;
private boolean trace = false ;
private int swapInterval = 0;
- private float aspect = 1.0f;
+ private final float aspect = 1.0f;
private boolean doRotate = true;
private TileRendererBase tileRendererInUse = null;
private boolean doRotateBeforePrinting;
+ private boolean flipVerticalInGLOrientation = false;
long startTime = 0;
long curTime = 0;
@@ -38,17 +39,17 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
public RedSquareES1() {
this.swapInterval = 1;
}
-
+
@Override
public void addTileRendererNotify(TileRendererBase tr) {
tileRendererInUse = tr;
doRotateBeforePrinting = doRotate;
- setDoRotation(false);
+ setDoRotation(false);
}
@Override
public void removeTileRendererNotify(TileRendererBase tr) {
tileRendererInUse = null;
- setDoRotation(doRotateBeforePrinting);
+ setDoRotation(doRotateBeforePrinting);
}
@Override
public void startTileRendering(TileRendererBase tr) {
@@ -58,7 +59,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
public void endTileRendering(TileRendererBase tr) {
System.err.println("RedSquareES1.endTileRendering: "+tr);
}
-
+
public void setDoRotation(boolean rotate) { this.doRotate = rotate; }
public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) {
this.forceFFPEmu = forceFFPEmu;
@@ -66,7 +67,8 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
this.debugFFPEmu = debugFFPEmu;
this.traceFFPEmu = traceFFPEmu;
}
-
+ public void setFlipVerticalInGLOrientation(boolean v) { flipVerticalInGLOrientation=v; }
+
// FIXME: we must add storage of the pointers in the GL state to
// the GLImpl classes. The need for this can be seen by making
// these variables method local instead of instance members. The
@@ -93,12 +95,12 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
trace = false;
}
GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu);
-
+
if(debug) {
try {
// Debug ..
gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) );
- } catch (Exception e) {e.printStackTrace();}
+ } catch (Exception e) {e.printStackTrace();}
}
if(trace) {
try {
@@ -139,34 +141,37 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
@Override
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
final GL2ES1 gl = glad.getGL().getGL2ES1();
- if(-1 != swapInterval) {
+ if(-1 != swapInterval) {
gl.setSwapInterval(swapInterval);
}
reshapeImpl(gl, x, y, width, height, width, height);
}
-
+
@Override
public void reshapeTile(TileRendererBase tr,
- int tileX, int tileY, int tileWidth, int tileHeight,
+ int tileX, int tileY, int tileWidth, int tileHeight,
int imageWidth, int imageHeight) {
final GL2ES1 gl = tr.getAttachedDrawable().getGL().getGL2ES1();
gl.setSwapInterval(0);
reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight);
}
-
+
void reshapeImpl(GL2ES1 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) {
System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse);
-
+
// Set location in front of camera
gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
-
+ if( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() ) {
+ gl.glScalef(1f, -1f, 1f);
+ }
+
// compute projection parameters 'normal' perspective
final float fovy=45f;
final float aspect2 = ( (float) imageWidth / (float) imageHeight ) / aspect;
final float zNear=1f;
final float zFar=100f;
-
+
// compute projection parameters 'normal' frustum
final float top=(float)Math.tan(fovy*((float)Math.PI)/360.0f)*zNear;
final float bottom=-1.0f*top;
@@ -174,18 +179,22 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
final float right=aspect2*top;
final float w = right - left;
final float h = top - bottom;
-
+
// compute projection parameters 'tiled'
final float l = left + tileX * w / imageWidth;
final float r = l + tileWidth * w / imageWidth;
final float b = bottom + tileY * h / imageHeight;
final float t = b + tileHeight * h / imageHeight;
-
+
gl.glFrustumf(l, r, b, t, zNear, zFar);
// gl.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
+
+ gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ gl.glLoadIdentity();
+
System.err.println(Thread.currentThread()+" RedSquareES1.reshape FIN");
}
-
+
@Override
public void display(GLAutoDrawable drawable) {
curTime = System.currentTimeMillis();
@@ -201,11 +210,9 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0, 0, -10);
- if(doRotate) {
- float ang = ((float) (curTime - startTime) * 360.0f) / 4000.0f;
- gl.glRotatef(ang, 0, 0, 1);
- gl.glRotatef(ang, 0, 1, 0);
- }
+ float ang = doRotate ? ((curTime - startTime) * 360.0f) / 4000.0f : 1f;
+ gl.glRotatef(ang, 0, 0, 1);
+ gl.glRotatef(ang, 0, 1, 0);
// Draw a square
gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index 3d7db04..d85d386 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -61,6 +61,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
private GLUniformData pmvMatrixUniform = null;
private GLUniformData colorU = null;
private float view_rotx = 20.0f, view_roty = 30.0f;
+ private boolean flipVerticalInGLOrientation = false;
private final float view_rotz = 0.0f;
private float panX = 0.0f, panY = 0.0f, panZ=0.0f;
@@ -119,6 +120,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
public void setDoRotation(boolean rotate) { this.doRotate = rotate; }
public void setClearBuffers(boolean v) { clearBuffers = v; }
public void setVerbose(boolean v) { verbose = v; }
+ public void setFlipVerticalInGLOrientation(boolean v) { flipVerticalInGLOrientation=v; }
public void setPMVUseBackingArray(boolean pmvUseBackingArray) {
this.pmvUseBackingArray = pmvUseBackingArray;
@@ -186,10 +188,10 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
drawable.setGLEventListenerInitState(this, false);
return;
}
- System.err.println(Thread.currentThread()+" GearsES2.init "+sid()+": tileRendererInUse "+tileRendererInUse);
final GL2ES2 gl = drawable.getGL().getGL2ES2();
if(verbose) {
+ System.err.println(Thread.currentThread()+" GearsES2.init "+sid()+": tileRendererInUse "+tileRendererInUse);
System.err.println("GearsES2 init "+sid()+" on "+Thread.currentThread());
System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
System.err.println("INIT GL IS: " + gl.getClass().getName());
@@ -307,7 +309,9 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
gl.glFinish(); // make sure .. for shared context (impacts OSX 10.9)
isInit = true;
- System.err.println(Thread.currentThread()+" GearsES2.init "+sid()+" FIN "+this);
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" GearsES2.init "+sid()+" FIN "+this);
+ }
}
public final boolean isInit() { return isInit; }
@@ -343,15 +347,15 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) {
final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers();
- System.err.println(Thread.currentThread()+" GearsES2.reshape "+sid()+" "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse);
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" GearsES2.reshape "+sid()+" "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse);
+ }
if( !gl.hasGLSL() ) {
return;
}
st.useProgram(gl, true);
- pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
// compute projection parameters 'normal'
float left, right, bottom, top;
@@ -380,9 +384,14 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
final float _w = r - l;
final float _h = t - b;
if(verbose) {
- System.err.println(">> angle "+sid()+" "+angle+", [l "+left+", r "+right+", b "+bottom+", t "+top+"] "+w+"x"+h+" -> [l "+l+", r "+r+", b "+b+", t "+t+"] "+_w+"x"+_h);
+ System.err.println(">> GearsES2 "+sid()+", angle "+angle+", [l "+left+", r "+right+", b "+bottom+", t "+top+"] "+w+"x"+h+" -> [l "+l+", r "+r+", b "+b+", t "+t+"] "+_w+"x"+_h+", v-flip "+flipVerticalInGLOrientation);
}
+ pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ if( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() ) {
+ pmvMatrix.glScalef(1f, -1f, 1f);
+ }
pmvMatrix.glFrustumf(l, r, b, t, 5.0f, 200.0f);
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
@@ -399,7 +408,9 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
public void dispose(GLAutoDrawable drawable) {
if( !isInit ) { return; }
isInit = false;
- System.err.println(Thread.currentThread()+" GearsES2.dispose "+sid()+": tileRendererInUse "+tileRendererInUse);
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" GearsES2.dispose "+sid()+": tileRendererInUse "+tileRendererInUse);
+ }
final Object upstreamWidget = drawable.getUpstreamWidget();
if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
@@ -425,7 +436,9 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
st.destroy(gl);
st = null;
- System.err.println(Thread.currentThread()+" GearsES2.dispose "+sid()+" FIN");
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" GearsES2.dispose "+sid()+" FIN");
+ }
}
@Override
@@ -477,7 +490,11 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
return;
}
- gl.glEnable(GL.GL_CULL_FACE);
+ // Only possible if we do not flip the projection matrix
+ final boolean enableCullFace = ! ( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() );
+ if( enableCullFace ) {
+ gl.glEnable(GL.GL_CULL_FACE);
+ }
st.useProgram(gl, true);
pmvMatrix.glPushMatrix();
@@ -492,7 +509,9 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
pmvMatrix.glPopMatrix();
st.useProgram(gl, false);
- gl.glDisable(GL.GL_CULL_FACE);
+ if( enableCullFace ) {
+ gl.glDisable(GL.GL_CULL_FACE);
+ }
}
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
index e38b9c6..616aa52 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -39,10 +39,12 @@ import javax.media.opengl.GLProfile;
import javax.media.opengl.GLUniformData;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.common.os.Platform;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.MouseAdapter;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.MouseListener;
+import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
@@ -72,19 +74,20 @@ public class TextureSequenceCubeES2 implements GLEventListener {
// private float zoom0=-5.0f, zoom=zoom0;
// private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f;
private float zoom=-2.3f;
- private float view_rotx = 0.0f, view_roty = 0.0f, view_rotz = 0.0f;
+ private float view_rotx = 0.0f, view_roty = 0.0f;
+ private final float view_rotz = 0.0f;
int[] vboNames = new int[4];
boolean innerCube;
-
+
private final MouseListener mouseAction = new MouseAdapter() {
int lx = 0;
int ly = 0;
boolean first = false;
public void mousePressed(MouseEvent e) {
- first = true;
+ first = true;
}
- public void mouseMoved(MouseEvent e) {
+ public void mouseMoved(MouseEvent e) {
first = false;
}
public void mouseDragged(MouseEvent e) {
@@ -101,7 +104,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
height=comp.getHeight();
} else {
throw new RuntimeException("Event source neither Window nor Component: "+source);
- }
+ }
if(e.getPointerCount()==2) {
// 2 pointers zoom ..
if(first) {
@@ -111,14 +114,14 @@ public class TextureSequenceCubeES2 implements GLEventListener {
}
int nv = Math.abs(e.getY(0)-e.getY(1));
int dy = nv - lx;
-
+
{
final float o = zoom;
- final float d = 40f*Math.signum(dy)/(float)height;
+ final float d = 40f*Math.signum(dy)/height;
zoom += d;
System.err.println("zoom.d: "+o+" + "+d+" -> "+zoom);
}
-
+
lx = nv;
} else {
// 1 pointer rotate
@@ -135,7 +138,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
lx = nx;
ly = ny;
}
- }
+ }
public void mouseWheelMoved(MouseEvent e) {
// System.err.println("XXX "+e);
if( !e.isShiftDown() ) {
@@ -146,31 +149,44 @@ public class TextureSequenceCubeES2 implements GLEventListener {
}
}
};
-
+
static final String shaderBasename = "texsequence_xxx";
static final String myTextureLookupName = "myTexture2D";
-
+
private void initShader(GL2ES2 gl) {
// Create & Compile the shader objects
- ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
+ ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
"shader", "shader/bin", shaderBasename, true);
- ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
+ ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
"shader", "shader/bin", shaderBasename, true);
- rsVp.defaultShaderCustomization(gl, true, true);
- int rsFpPos = rsFp.addGLSLVersion(gl);
+ boolean preludeGLSLVersion = true;
+ if( GLES2.GL_TEXTURE_EXTERNAL_OES == texSeq.getTextureTarget() ) {
+ if( !gl.isExtensionAvailable(GLExtensions.OES_EGL_image_external) ) {
+ throw new GLException(GLExtensions.OES_EGL_image_external+" requested but not available");
+ }
+ if( Platform.OSType.ANDROID == Platform.getOSType() && gl.isGLES3() ) {
+ // Bug on Nexus 10, ES3 - Android 4.3, where
+ // GL_OES_EGL_image_external extension directive leads to a failure _with_ '#version 300 es' !
+ // P0003: Extension 'GL_OES_EGL_image_external' not supported
+ preludeGLSLVersion = false;
+ }
+ }
+ rsVp.defaultShaderCustomization(gl, preludeGLSLVersion, true);
+
+ int rsFpPos = preludeGLSLVersion ? rsFp.addGLSLVersion(gl) : 0;
rsFpPos = rsFp.insertShaderSource(0, rsFpPos, texSeq.getRequiredExtensionsShaderStub());
rsFpPos = rsFp.addDefaultShaderPrecision(gl, rsFpPos);
-
- final String texLookupFuncName = texSeq.getTextureLookupFunctionName(myTextureLookupName);
+
+ final String texLookupFuncName = texSeq.getTextureLookupFunctionName(myTextureLookupName);
rsFp.replaceInShaderSource(myTextureLookupName, texLookupFuncName);
-
+
// Inject TextureSequence shader details
final StringBuilder sFpIns = new StringBuilder();
sFpIns.append("uniform ").append(texSeq.getTextureSampler2DType()).append(" mgl_ActiveTexture;\n");
sFpIns.append(texSeq.getTextureLookupFragmentShaderImpl());
rsFp.insertShaderSource(0, "TEXTURE-SEQUENCE-CODE-BEGIN", 0, sFpIns);
-
+
// Create & Link the shader program
ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
@@ -183,9 +199,9 @@ public class TextureSequenceCubeES2 implements GLEventListener {
st = new ShaderState();
st.attachShaderProgram(gl, sp, false);
}
-
+
GLArrayDataServer interleavedVBO, cubeIndicesVBO;
-
+
public void init(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
System.err.println(JoglVersion.getGLInfo(gl, null));
@@ -194,15 +210,10 @@ public class TextureSequenceCubeES2 implements GLEventListener {
return;
}
final Texture tex= frame.getTexture();
-
- final boolean useExternalTexture = GLES2.GL_TEXTURE_EXTERNAL_OES == tex.getTarget();
- if(useExternalTexture && !gl.isExtensionAvailable("GL_OES_EGL_image_external")) {
- throw new GLException("GL_OES_EGL_image_external requested but not available");
- }
-
+
initShader(gl);
- // Push the 1st uniform down the path
+ // Push the 1st uniform down the path
st.useProgram(gl, true);
pmvMatrix = new PMVMatrix();
@@ -214,10 +225,10 @@ public class TextureSequenceCubeES2 implements GLEventListener {
if(!st.uniform(gl, new GLUniformData("mgl_ActiveTexture", texSeq.getTextureUnit()))) {
throw new GLException("Error setting mgl_ActiveTexture in shader: "+st);
}
-
-
+
+
// calculate centered tex coords w/ aspect ratio
- float[] fixedCubeTexCoords = new float[s_cubeTexCoords.length];
+ float[] fixedCubeTexCoords = new float[s_cubeTexCoords.length];
{
final float aspect = tex.getAspectRatio();
final TextureCoords tc = tex.getImageTexCoords();
@@ -241,27 +252,27 @@ public class TextureSequenceCubeES2 implements GLEventListener {
}
}
}
-
+
interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+4+2, GL.GL_FLOAT, false, 3*6*4, GL.GL_STATIC_DRAW);
- {
- interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
- interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
+ {
+ interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
+ interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
//interleavedVBO.addGLSLSubArray("mgl_Normal", 3, GL.GL_ARRAY_BUFFER);
interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
-
+
for(int i=0; i<6*4; i++) {
ib.put(s_cubeVertices, i*3, 3);
- ib.put(s_cubeColors, i*4, 4);
+ ib.put(s_cubeColors, i*4, 4);
//ib.put(s_cubeNormals, i*3, 3);
ib.put(fixedCubeTexCoords, i*2, 2);
- }
+ }
}
interleavedVBO.seal(gl, true);
interleavedVBO.enableBuffer(gl, false);
st.ownAttribute(interleavedVBO, true);
-
+
cubeIndicesVBO = GLArrayDataServer.createData(6, GL.GL_UNSIGNED_SHORT, 6, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
for(int i=0; i<6*6; i++) {
cubeIndicesVBO.puts(s_cubeIndices[i]);
@@ -269,26 +280,26 @@ public class TextureSequenceCubeES2 implements GLEventListener {
cubeIndicesVBO.seal(gl, true);
cubeIndicesVBO.enableBuffer(gl, false);
st.ownAttribute(cubeIndicesVBO, true);
-
-
+
+
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
st.useProgram(gl, false);
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.addMouseListener(mouseAction);
} else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
final java.awt.Component comp = (java.awt.Component) upstreamWidget;
new com.jogamp.newt.event.awt.AWTMouseAdapter(mouseAction).addTo(comp);
}
-
+
// Let's show the completed shader state ..
System.out.println("iVBO: "+interleavedVBO);
System.out.println(st);
}
-
+
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
@@ -317,8 +328,8 @@ public class TextureSequenceCubeES2 implements GLEventListener {
st.useProgram(gl, false);
}
}
-
-
+
+
private void reshapePMV(int width, int height) {
if(null != pmvMatrix) {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
@@ -331,7 +342,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
nearPlaneNormalized = 0f;
}
System.err.println("XXX0: Perspective nearPlaneNormalized: "+nearPlaneNormalized);
-
+
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, zoom);
@@ -343,7 +354,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
public void dispose(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
- texSeq = null;
+ texSeq = null;
pmvMatrixUniform = null;
if( null != pmvMatrix ) {
pmvMatrix.destroy();
@@ -360,13 +371,13 @@ public class TextureSequenceCubeES2 implements GLEventListener {
GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
-
+
if( null == st ) {
return;
}
-
+
st.useProgram(gl, true);
-
+
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, zoom);
@@ -382,18 +393,18 @@ public class TextureSequenceCubeES2 implements GLEventListener {
tex = texFrame.getTexture();
gl.glActiveTexture(GL.GL_TEXTURE0+texSeq.getTextureUnit());
tex.enable(gl);
- tex.bind(gl);
+ tex.bind(gl);
}
}
cubeIndicesVBO.bindBuffer(gl, true); // keeps VBO binding
gl.glDrawElements(GL2ES2.GL_TRIANGLES, cubeIndicesVBO.getElementCount() * cubeIndicesVBO.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
cubeIndicesVBO.bindBuffer(gl, false);
-
+
if(null != tex) {
- tex.disable(gl);
+ tex.disable(gl);
}
interleavedVBO.enableBuffer(gl, false);
- st.useProgram(gl, false);
+ st.useProgram(gl, false);
}
static final float[] light_position = { -50.f, 50.f, 50.f, 0.f };
@@ -405,18 +416,18 @@ public class TextureSequenceCubeES2 implements GLEventListener {
private static final float[] s_cubeVertices = /* f b t b r l */
{
-1f, 1f, 1f, 1f, -1f, 1f, 1f, 1f, 1f, -1f, -1f, 1f,
-
+
-1f, 1f, -1f, 1f, -1f, -1f, 1f, 1f, -1f, -1f, -1f, -1f,
-
+
-1f, -1f, 1f, 1f, -1f, -1f, 1f, -1f, 1f, -1f, -1f, -1f,
-
+
-1f, 1f, 1f, 1f, 1f, -1f, 1f, 1f, 1f, -1f, 1f, -1f,
-
+
1f, -1f, 1f, 1f, 1f, -1f, 1f, 1f, 1f, 1f, -1f, -1f,
-
+
-1f, -1f, 1f, -1f, 1f, -1f, -1f, 1f, 1f, -1f, -1f, -1f
};
-
+
private static final float[] s_cubeTexCoords =
{ // LT RB RT LB
0f, 1f, 1f, 0f, 1f, 1f, 0f, 0f,
@@ -435,39 +446,39 @@ public class TextureSequenceCubeES2 implements GLEventListener {
private static final float[] s_cubeColors =
{
1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f,
-
+
40f/255f, 80f/255f, 160f/255f, 255f/255f, 40f/255f, 80f/255f, 160f/255f, 255f/255f,
40f/255f, 80f/255f, 160f/255f, 255f/255f, 40f/255f, 80f/255f, 160f/255f, 255f/255f,
-
+
40f/255f, 80f/255f, 160f/255f, 255f/255f, 40f/255f, 80f/255f, 160f/255f, 255f/255f,
- 40f/255f, 80f/255f, 160f/255f, 255f/255f, 40f/255f, 80f/255f, 160f/255f, 255f/255f,
-
+ 40f/255f, 80f/255f, 160f/255f, 255f/255f, 40f/255f, 80f/255f, 160f/255f, 255f/255f,
+
128f/255f, 128f/255f, 128f/255f, 255f/255f, 128f/255f, 128f/255f, 128f/255f, 255f/255f,
128f/255f, 128f/255f, 128f/255f, 255f/255f, 128f/255f, 128f/255f, 128f/255f, 255f/255f,
-
+
255f/255f, 110f/255f, 10f/255f, 255f/255f, 255f/255f, 110f/255f, 10f/255f, 255f/255f,
255f/255f, 110f/255f, 10f/255f, 255f/255f, 255f/255f, 110f/255f, 10f/255f, 255f/255f,
-
+
255f/255f, 70f/255f, 60f/255f, 255f/255f, 255f/255f, 70f/255f, 60f/255f, 255f/255f,
255f/255f, 70f/255f, 60f/255f, 255f/255f, 255f/255f, 70f/255f, 60f/255f, 255f/255f
};
-
+
/*
private static final float[] s_cubeNormals =
{
0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f, 1f,
-
+
0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f, -1f,
-
+
0f, -1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f,
-
+
0f, 1f, 0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f, 1f, 0f,
-
+
1f, 0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f,
-
+
-1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f
};*/
- private static final short[] s_cubeIndices =
+ private static final short[] s_cubeIndices =
{
0, 3, 1, 2, 0, 1, /* front */
6, 5, 4, 5, 7, 4, /* back */
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
index a7636fc..c1ccf7c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2.av;
+import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -39,6 +40,7 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
+import com.jogamp.common.util.IOUtil;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -151,7 +153,7 @@ public class MovieCube implements GLEventListener {
return;
}
System.err.println("MC "+e);
- int pts0 = mPlayer.getVideoPTS();
+ final int pts0 = GLMediaPlayer.STREAM_ID_NONE != mPlayer.getVID() ? mPlayer.getVideoPTS() : mPlayer.getAudioPTS();
int pts1 = 0;
switch(e.getKeyCode()) {
case KeyEvent.VK_RIGHT: pts1 = pts0 + 1000; break;
@@ -327,7 +329,7 @@ public class MovieCube implements GLEventListener {
int aid = GLMediaPlayer.STREAM_ID_AUTO;
final boolean origSize;
- String url_s=null;
+ String url_s=null, file_s=null;
{
boolean _origSize = false;
for(int i=0; i<args.length; i++) {
@@ -351,6 +353,9 @@ public class MovieCube implements GLEventListener {
} else if(args[i].equals("-url")) {
i++;
url_s = args[i];
+ } else if(args[i].equals("-file")) {
+ i++;
+ file_s = args[i];
} else if(args[i].equals("-es2")) {
forceES2 = true;
} else if(args[i].equals("-es3")) {
@@ -369,11 +374,15 @@ public class MovieCube implements GLEventListener {
origSize = _origSize;
}
final URI streamLoc;
- if( null == url_s ) {
- streamLoc = defURI;
- } else {
+ if( null != url_s ) {
streamLoc = new URI(url_s);
+ } else if( null != file_s ) {
+ streamLoc = IOUtil.toURISimple(new File(file_s));
+ } else {
+ streamLoc = defURI;
}
+ System.err.println("url_s "+url_s);
+ System.err.println("file_s "+file_s);
System.err.println("stream "+streamLoc);
System.err.println("vid "+vid+", aid "+aid);
System.err.println("textureCount "+textureCount);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
index d29381f..ddf5c70 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2.av;
+import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -44,6 +45,8 @@ import javax.media.opengl.GLProfile;
import javax.media.opengl.GLUniformData;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.IOUtil;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -54,6 +57,7 @@ import com.jogamp.newt.event.MouseListener;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -73,12 +77,12 @@ import com.jogamp.opengl.util.texture.TextureSequence;
import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
/**
- * Simple planar movie player w/ orthogonal 1:1 projection.
+ * Simple planar movie player w/ orthogonal 1:1 projection.
*/
public class MovieSimple implements GLEventListener {
public static final int EFFECT_NORMAL = 0;
public static final int EFFECT_GRADIENT_BOTTOM2TOP = 1<<1;
- public static final int EFFECT_TRANSPARENT = 1<<3;
+ public static final int EFFECT_TRANSPARENT = 1<<3;
private static boolean waitForKey = false;
private int winWidth, winHeight;
@@ -95,9 +99,9 @@ public class MovieSimple implements GLEventListener {
private int swapInterval = 1;
private GLMediaPlayer mPlayer;
- private boolean mPlayerShared;
+ private final boolean mPlayerShared;
private boolean mPlayerScaleOrig;
- private float[] verts = null;
+ private float[] verts = null;
private GLArrayDataServer interleavedVBO;
private volatile boolean resetGLState = false;
@@ -106,7 +110,7 @@ public class MovieSimple implements GLEventListener {
private GLUniformData pmvMatrixUniform;
private static final String shaderBasename = "texsequence_xxx";
private static final String myTextureLookupName = "myTexture2D";
-
+
/** Blender's Big Buck Bunny Trailer: 24f 640p VP8, Vorbis 44100Hz mono, WebM/Matroska Stream. */
public static final URI defURI;
static {
@@ -118,7 +122,7 @@ public class MovieSimple implements GLEventListener {
}
defURI = _defURI;
}
-
+
private final MouseListener mouseAction = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if(e.getY()<=winHeight/2 && null!=mPlayer && 1 == e.getClickCount()) {
@@ -143,16 +147,17 @@ public class MovieSimple implements GLEventListener {
public void mouseDragged(MouseEvent e) {
int x = e.getX();
int y = e.getY();
-
+
if(y>winHeight/2) {
final float dp = (float)(x-prevMouseX)/(float)winWidth;
- mPlayer.seek(mPlayer.getVideoPTS() + (int) (mPlayer.getDuration() * dp));
+ final int pts0 = GLMediaPlayer.STREAM_ID_NONE != mPlayer.getVID() ? mPlayer.getVideoPTS() : mPlayer.getAudioPTS();
+ mPlayer.seek(pts0 + (int) (mPlayer.getDuration() * dp));
} else {
mPlayer.play();
- rotate = 1;
+ rotate = 1;
zoom = zoom1;
}
-
+
prevMouseX = x;
// prevMouseY = y;
}
@@ -163,14 +168,14 @@ public class MovieSimple implements GLEventListener {
}
}
};
-
+
private final KeyListener keyAction = new KeyAdapter() {
public void keyReleased(KeyEvent e) {
if( e.isAutoRepeat() ) {
return;
- }
+ }
System.err.println("MC "+e);
- int pts0 = mPlayer.getVideoPTS();
+ final int pts0 = GLMediaPlayer.STREAM_ID_NONE != mPlayer.getVID() ? mPlayer.getVideoPTS() : mPlayer.getAudioPTS();
int pts1 = 0;
switch(e.getKeyCode()) {
case KeyEvent.VK_RIGHT: pts1 = pts0 + 1000; break;
@@ -194,7 +199,7 @@ public class MovieSimple implements GLEventListener {
break;
}
case KeyEvent.VK_MULTIPLY:
- mPlayer.setPlaySpeed(1.0f);
+ mPlayer.setPlaySpeed(1.0f);
break;
case KeyEvent.VK_SUBTRACT: {
float playSpeed = mPlayer.getPlaySpeed();
@@ -203,7 +208,7 @@ public class MovieSimple implements GLEventListener {
} else {
playSpeed -= 0.1f;
}
- mPlayer.setPlaySpeed(playSpeed);
+ mPlayer.setPlaySpeed(playSpeed);
} break;
case KeyEvent.VK_ADD: {
float playSpeed = mPlayer.getPlaySpeed();
@@ -212,7 +217,7 @@ public class MovieSimple implements GLEventListener {
} else {
playSpeed += 0.1f;
}
- mPlayer.setPlaySpeed(playSpeed);
+ mPlayer.setPlaySpeed(playSpeed);
} break;
case KeyEvent.VK_M: {
float audioVolume = mPlayer.getAudioVolume();
@@ -221,27 +226,27 @@ public class MovieSimple implements GLEventListener {
} else {
audioVolume = 1f;
}
- mPlayer.setAudioVolume(audioVolume);
+ mPlayer.setAudioVolume(audioVolume);
} break;
}
-
+
if( 0 != pts1 ) {
mPlayer.seek(pts1);
}
- }
+ }
};
-
- /**
- * Default constructor which also issues {@link #initStream(URI, int, int, int)} w/ default values
+
+ /**
+ * Default constructor which also issues {@link #initStream(URI, int, int, int)} w/ default values
* and polls until the {@link GLMediaPlayer} is {@link GLMediaPlayer.State#Initialized}.
* If {@link GLMediaEventListener#EVENT_CHANGE_EOS} is reached, the stream is started over again.
* <p>
* This default constructor is merely useful for some <i>drop-in</i> test, e.g. using an applet.
- * </p>
+ * </p>
*/
public MovieSimple() {
this(null);
-
+
mPlayer.addEventListener(new GLMediaEventListener() {
@Override
public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { }
@@ -258,7 +263,7 @@ public class MovieSimple implements GLEventListener {
mPlayer.seek(0);
mPlayer.play();
}
- }
+ }
});
initStream(defURI, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 3 /* textureCount */);
StreamException se = null;
@@ -284,50 +289,63 @@ public class MovieSimple implements GLEventListener {
}
System.out.println("pC.1a shared "+mPlayerShared+", "+mPlayer);
}
-
+
public void initStream(URI streamLoc, int vid, int aid, int textureCount) {
mPlayer.initStream(streamLoc, vid, aid, textureCount);
System.out.println("pC.1b "+mPlayer);
}
-
+
public void setSwapInterval(int v) { this.swapInterval = v; }
-
+
public GLMediaPlayer getGLMediaPlayer() { return mPlayer; }
-
+
public void setScaleOrig(boolean v) {
mPlayerScaleOrig = v;
}
-
+
/** defaults to true */
public void setOrthoProjection(boolean v) { orthoProjection=v; }
public boolean getOrthoProjection() { return orthoProjection; }
-
+
public boolean hasEffect(int e) { return 0 != ( effects & e ) ; }
public void setEffects(int e) { effects = e; };
public void setTransparency(float alpha) {
this.effects |= EFFECT_TRANSPARENT;
this.alpha = alpha;
- }
+ }
public void resetGLState() {
resetGLState = true;
}
-
+
private void initShader(GL2ES2 gl) {
// Create & Compile the shader objects
- ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MovieSimple.class,
+ ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MovieSimple.class,
"../shader", "../shader/bin", shaderBasename, true);
- ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MovieSimple.class,
+ ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MovieSimple.class,
"../shader", "../shader/bin", shaderBasename, true);
- rsVp.defaultShaderCustomization(gl, true, true);
- int rsFpPos = rsFp.addGLSLVersion(gl);
+ boolean preludeGLSLVersion = true;
+ if( GLES2.GL_TEXTURE_EXTERNAL_OES == mPlayer.getTextureTarget() ) {
+ if( !gl.isExtensionAvailable(GLExtensions.OES_EGL_image_external) ) {
+ throw new GLException(GLExtensions.OES_EGL_image_external+" requested but not available");
+ }
+ if( Platform.OSType.ANDROID == Platform.getOSType() && gl.isGLES3() ) {
+ // Bug on Nexus 10, ES3 - Android 4.3, where
+ // GL_OES_EGL_image_external extension directive leads to a failure _with_ '#version 300 es' !
+ // P0003: Extension 'GL_OES_EGL_image_external' not supported
+ preludeGLSLVersion = false;
+ }
+ }
+ rsVp.defaultShaderCustomization(gl, preludeGLSLVersion, true);
+
+ int rsFpPos = preludeGLSLVersion ? rsFp.addGLSLVersion(gl) : 0;
rsFpPos = rsFp.insertShaderSource(0, rsFpPos, mPlayer.getRequiredExtensionsShaderStub());
rsFpPos = rsFp.addDefaultShaderPrecision(gl, rsFpPos);
-
- final String texLookupFuncName = mPlayer.getTextureLookupFunctionName(myTextureLookupName);
+
+ final String texLookupFuncName = mPlayer.getTextureLookupFunctionName(myTextureLookupName);
rsFp.replaceInShaderSource(myTextureLookupName, texLookupFuncName);
-
+
// Inject TextureSequence shader details
final StringBuilder sFpIns = new StringBuilder();
sFpIns.append("uniform ").append(mPlayer.getTextureSampler2DType()).append(" mgl_ActiveTexture;\n");
@@ -349,31 +367,28 @@ public class MovieSimple implements GLEventListener {
@Override
public void init(GLAutoDrawable drawable) {
- if(null == mPlayer) {
+ if(null == mPlayer) {
throw new InternalError("mPlayer null");
}
if( GLMediaPlayer.State.Uninitialized == mPlayer.getState() ) {
throw new IllegalStateException("mPlayer in uninitialized state: "+mPlayer);
}
- if( GLMediaPlayer.STREAM_ID_NONE == mPlayer.getVID() ) {
- throw new IllegalStateException("mPlayer has no VID/stream selected: "+mPlayer);
- }
+ final boolean hasVideo = GLMediaPlayer.STREAM_ID_NONE != mPlayer.getVID();
resetGLState = false;
-
+
zoom0 = orthoProjection ? 0f : -2.5f;
zoom1 = orthoProjection ? 0f : -5f;
- zoom = zoom0;
+ zoom = zoom0;
GL2ES2 gl = drawable.getGL().getGL2ES2();
System.err.println(JoglVersion.getGLInfo(gl, null));
System.err.println("Alpha: "+alpha+", opaque "+drawable.getChosenGLCapabilities().isBackgroundOpaque()+
", "+drawable.getClass().getName()+", "+drawable);
-
+
if(waitForKey) {
UITestCase.waitForKey("Init>");
- }
+ }
final Texture tex;
- boolean useExternalTexture = false;
try {
System.out.println("p0 "+mPlayer+", shared "+mPlayerShared);
if(!mPlayerShared && GLMediaPlayer.State.Initialized == mPlayer.getState() ) {
@@ -381,13 +396,19 @@ public class MovieSimple implements GLEventListener {
}
System.out.println("p1 "+mPlayer+", shared "+mPlayerShared);
final TextureFrame frame = mPlayer.getLastTexture();
- if( null == frame ) {
- throw new InternalError("XXX: "+mPlayer);
- }
- tex = mPlayer.getLastTexture().getTexture();
- useExternalTexture = GLES2.GL_TEXTURE_EXTERNAL_OES == tex.getTarget();
- if(useExternalTexture && !gl.isExtensionAvailable("GL_OES_EGL_image_external")) {
- throw new GLException("GL_OES_EGL_image_external requested but not available");
+ if( null != frame ) {
+ if( !hasVideo ) {
+ throw new InternalError("XXX: "+mPlayer);
+ }
+ tex = frame.getTexture();
+ if( null == tex ) {
+ throw new InternalError("XXX: "+mPlayer);
+ }
+ } else {
+ tex = null;
+ if( hasVideo ) {
+ throw new InternalError("XXX: "+mPlayer);
+ }
}
if(!mPlayerShared) {
mPlayer.setTextureMinMagFilter( new int[] { GL.GL_NEAREST, GL.GL_LINEAR } );
@@ -400,84 +421,86 @@ public class MovieSimple implements GLEventListener {
}
throw new GLException(glex);
}
-
- initShader(gl);
- // Push the 1st uniform down the path
- st.useProgram(gl, true);
+ if( hasVideo ) {
+ initShader(gl);
- int[] viewPort = new int[] { 0, 0, drawable.getWidth(), drawable.getHeight()};
- pmvMatrix = new PMVMatrix();
- reshapePMV(viewPort[2], viewPort[3]);
- pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
- if(!st.uniform(gl, pmvMatrixUniform)) {
- throw new GLException("Error setting PMVMatrix in shader: "+st);
- }
- if(!st.uniform(gl, new GLUniformData("mgl_ActiveTexture", mPlayer.getTextureUnit()))) {
- throw new GLException("Error setting mgl_ActiveTexture in shader: "+st);
- }
-
- float dWidth = drawable.getWidth();
- float dHeight = drawable.getHeight();
- float mWidth = mPlayer.getWidth();
- float mHeight = mPlayer.getHeight();
- float mAspect = mWidth/mHeight;
- System.err.println("XXX0: mov aspect: "+mAspect);
- float xs, ys;
- if(orthoProjection) {
- if(mPlayerScaleOrig && mWidth < dWidth && mHeight < dHeight) {
- xs = mWidth/2f; ys = xs / mAspect;
- } else {
- xs = dWidth/2f; ys = xs / mAspect; // w>h
+ // Push the 1st uniform down the path
+ st.useProgram(gl, true);
+
+ int[] viewPort = new int[] { 0, 0, drawable.getWidth(), drawable.getHeight()};
+ pmvMatrix = new PMVMatrix();
+ reshapePMV(viewPort[2], viewPort[3]);
+ pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
+ if(!st.uniform(gl, pmvMatrixUniform)) {
+ throw new GLException("Error setting PMVMatrix in shader: "+st);
}
- } else {
- if(mPlayerScaleOrig && mWidth < dWidth && mHeight < dHeight) {
- xs = mAspect * ( mWidth / dWidth ) ; ys = xs / mAspect ;
+ if(!st.uniform(gl, new GLUniformData("mgl_ActiveTexture", mPlayer.getTextureUnit()))) {
+ throw new GLException("Error setting mgl_ActiveTexture in shader: "+st);
+ }
+
+ float dWidth = drawable.getWidth();
+ float dHeight = drawable.getHeight();
+ float mWidth = mPlayer.getWidth();
+ float mHeight = mPlayer.getHeight();
+ float mAspect = mWidth/mHeight;
+ System.err.println("XXX0: mov aspect: "+mAspect);
+ float xs, ys;
+ if(orthoProjection) {
+ if(mPlayerScaleOrig && mWidth < dWidth && mHeight < dHeight) {
+ xs = mWidth/2f; ys = xs / mAspect;
+ } else {
+ xs = dWidth/2f; ys = xs / mAspect; // w>h
+ }
} else {
- xs = mAspect; ys = 1f; // b>h
+ if(mPlayerScaleOrig && mWidth < dWidth && mHeight < dHeight) {
+ xs = mAspect * ( mWidth / dWidth ) ; ys = xs / mAspect ;
+ } else {
+ xs = mAspect; ys = 1f; // b>h
+ }
+ }
+ verts = new float[] { -1f*xs, -1f*ys, 0f, // LB
+ 1f*xs, 1f*ys, 0f // RT
+ };
+ {
+ System.err.println("XXX0: pixel LB: "+verts[0]+", "+verts[1]+", "+verts[2]);
+ System.err.println("XXX0: pixel RT: "+verts[3]+", "+verts[4]+", "+verts[5]);
+ float[] winLB = new float[3];
+ float[] winRT = new float[3];
+ pmvMatrix.gluProject(verts[0], verts[1], verts[2], viewPort, 0, winLB, 0);
+ pmvMatrix.gluProject(verts[3], verts[4], verts[5], viewPort, 0, winRT, 0);
+ System.err.println("XXX0: win LB: "+winLB[0]+", "+winLB[1]+", "+winLB[2]);
+ System.err.println("XXX0: win RT: "+winRT[0]+", "+winRT[1]+", "+winRT[2]);
}
- }
- verts = new float[] { -1f*xs, -1f*ys, 0f, // LB
- 1f*xs, 1f*ys, 0f // RT
- };
- {
- System.err.println("XXX0: pixel LB: "+verts[0]+", "+verts[1]+", "+verts[2]);
- System.err.println("XXX0: pixel RT: "+verts[3]+", "+verts[4]+", "+verts[5]);
- float[] winLB = new float[3];
- float[] winRT = new float[3];
- pmvMatrix.gluProject(verts[0], verts[1], verts[2], viewPort, 0, winLB, 0);
- pmvMatrix.gluProject(verts[3], verts[4], verts[5], viewPort, 0, winRT, 0);
- System.err.println("XXX0: win LB: "+winLB[0]+", "+winLB[1]+", "+winLB[2]);
- System.err.println("XXX0: win RT: "+winRT[0]+", "+winRT[1]+", "+winRT[2]);
- }
-
- interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+4+2, GL.GL_FLOAT, false, 3*4, GL.GL_STATIC_DRAW);
- {
- interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
- interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
- interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
- }
- updateInterleavedVBO(gl, tex);
-
- st.ownAttribute(interleavedVBO, true);
- gl.glClearColor(0.3f, 0.3f, 0.3f, 0.3f);
-
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- st.useProgram(gl, false);
+ interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+4+2, GL.GL_FLOAT, false, 3*4, GL.GL_STATIC_DRAW);
+ {
+ interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
+ interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
+ interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
+ }
+ updateInterleavedVBO(gl, tex);
+
+ st.ownAttribute(interleavedVBO, true);
+ gl.glClearColor(0.3f, 0.3f, 0.3f, 0.3f);
+
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- // Let's show the completed shader state ..
- System.out.println("iVBO: "+interleavedVBO);
- System.out.println(st);
+ st.useProgram(gl, false);
+
+ // Let's show the completed shader state ..
+ System.out.println("iVBO: "+interleavedVBO);
+ System.out.println(st);
+ }
if(!mPlayerShared) {
mPlayer.play();
System.out.println("play.0 "+mPlayer);
- }
+ }
startTime = System.currentTimeMillis();
-
+
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.addMouseListener(mouseAction);
window.addKeyListener(keyAction);
@@ -485,7 +508,7 @@ public class MovieSimple implements GLEventListener {
winHeight = window.getHeight();
}
}
-
+
protected void updateInterleavedVBO(GL gl, Texture tex) {
final float ss = 1f, ts = 1f; // scale tex-coord
final boolean wasEnabled = interleavedVBO.enabled();
@@ -497,7 +520,7 @@ public class MovieSimple implements GLEventListener {
System.err.println("XXX0: "+tc);
System.err.println("XXX0: tex aspect: "+tex.getAspectRatio());
System.err.println("XXX0: tex y-flip: "+tex.getMustFlipVertically());
-
+
// left-bottom
ib.put(verts[0]); ib.put(verts[1]); ib.put(verts[2]);
if( hasEffect(EFFECT_GRADIENT_BOTTOM2TOP) ) {
@@ -506,11 +529,11 @@ public class MovieSimple implements GLEventListener {
ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
}
ib.put( tc.left() *ss); ib.put( tc.bottom() *ts);
-
+
// right-bottom
ib.put(verts[3]); ib.put(verts[1]); ib.put(verts[2]);
if( hasEffect(EFFECT_GRADIENT_BOTTOM2TOP) ) {
- ib.put( 0); ib.put( 0); ib.put( 0); ib.put(alpha);
+ ib.put( 0); ib.put( 0); ib.put( 0); ib.put(alpha);
} else {
ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
}
@@ -524,22 +547,22 @@ public class MovieSimple implements GLEventListener {
ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
}
ib.put( tc.left() *ss); ib.put( tc.top() *ts);
-
+
// right-top
ib.put(verts[3]); ib.put(verts[4]); ib.put(verts[2]);
if( hasEffect(EFFECT_GRADIENT_BOTTOM2TOP) ) {
ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
} else {
ib.put( 1); ib.put( 1); ib.put( 1); ib.put(alpha);
- }
- ib.put( tc.right() *ss); ib.put( tc.top() *ts);
+ }
+ ib.put( tc.right() *ss); ib.put( tc.top() *ts);
}
interleavedVBO.seal(gl, true);
if( !wasEnabled ) {
interleavedVBO.enableBuffer(gl, false);
}
}
-
+
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
@@ -549,23 +572,23 @@ public class MovieSimple implements GLEventListener {
if(null == mPlayer) { return; }
winWidth = width;
winHeight = height;
-
+
if(null != st) {
reshapePMV(width, height);
st.useProgram(gl, true);
st.uniform(gl, pmvMatrixUniform);
st.useProgram(gl, false);
}
-
+
System.out.println("pR "+mPlayer);
}
-
+
private void reshapePMV(int width, int height) {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
if(orthoProjection) {
- final float fw = (float) width / 2f;
- final float fh = (float) height/ 2f;
+ final float fw = width / 2f;
+ final float fh = height/ 2f;
pmvMatrix.glOrthof(-fw, fw, -fh, fh, -1.0f, 1.0f);
nearPlaneNormalized = 0f;
} else {
@@ -576,26 +599,26 @@ public class MovieSimple implements GLEventListener {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
- pmvMatrix.glTranslatef(0, 0, zoom0);
+ pmvMatrix.glTranslatef(0, 0, zoom0);
}
@Override
public void dispose(GLAutoDrawable drawable) {
disposeImpl(drawable, true);
}
-
+
private void disposeImpl(GLAutoDrawable drawable, boolean disposePlayer) {
if(null == mPlayer) { return; }
-
+
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.removeMouseListener(mouseAction);
window.removeKeyListener(keyAction);
}
-
- System.out.println("pD.1 "+mPlayer+", disposePlayer "+disposePlayer);
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ System.out.println("pD.1 "+mPlayer+", disposePlayer "+disposePlayer);
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
if( disposePlayer ) {
if(!mPlayerShared) {
mPlayer.destroy(gl);
@@ -615,11 +638,11 @@ public class MovieSimple implements GLEventListener {
}
long lastPerfPos = 0;
-
+
@Override
public void display(GLAutoDrawable drawable) {
if(null == mPlayer) { return; }
-
+
if( resetGLState ) {
resetGLState = false;
System.err.println("XXX resetGLState");
@@ -627,35 +650,35 @@ public class MovieSimple implements GLEventListener {
init(drawable);
reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
}
-
+
final long currentPos = System.currentTimeMillis();
if( currentPos - lastPerfPos > 2000 ) {
System.err.println( mPlayer.getPerfString() );
- lastPerfPos = currentPos;
- }
-
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ lastPerfPos = currentPos;
+ }
+
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
if(null == st) {
return;
}
-
+
st.useProgram(gl, true);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, zoom);
if(rotate > 0) {
- final float ang = ((float) (System.currentTimeMillis() - startTime) * 360.0f) / 8000.0f;
+ final float ang = ((System.currentTimeMillis() - startTime) * 360.0f) / 8000.0f;
pmvMatrix.glRotatef(ang, 0, 0, 1);
} else {
rotate = 0;
}
st.uniform(gl, pmvMatrixUniform);
interleavedVBO.enableBuffer(gl, true);
- Texture tex = null;
+ Texture tex = null;
if(null!=mPlayer) {
final TextureSequence.TextureFrame texFrame;
if(mPlayerShared) {
@@ -685,7 +708,8 @@ public class MovieSimple implements GLEventListener {
int textureCount = 3; // default - threaded
boolean ortho = true;
boolean zoom = false;
-
+ boolean _loopEOS = false;
+
boolean forceES2 = false;
boolean forceES3 = false;
boolean forceGL3 = false;
@@ -693,10 +717,10 @@ public class MovieSimple implements GLEventListener {
int vid = GLMediaPlayer.STREAM_ID_AUTO;
int aid = GLMediaPlayer.STREAM_ID_AUTO;
final boolean origSize;
-
- String url_s=null;
+
+ String url_s=null, file_s1=null, file_s2=null;
{
- boolean _origSize = false;
+ boolean _origSize = false;
for(int i=0; i<args.length; i++) {
if(args[i].equals("-vid")) {
i++;
@@ -730,21 +754,37 @@ public class MovieSimple implements GLEventListener {
ortho=false;
} else if(args[i].equals("-zoom")) {
zoom=true;
+ } else if(args[i].equals("-loop")) {
+ _loopEOS=true;
} else if(args[i].equals("-url")) {
i++;
url_s = args[i];
+ } else if(args[i].equals("-file1")) {
+ i++;
+ file_s1 = args[i];
+ } else if(args[i].equals("-file2")) {
+ i++;
+ file_s2 = args[i];
} else if(args[i].equals("-wait")) {
waitForKey = true;
}
}
origSize = _origSize;
}
+ final boolean loopEOS = _loopEOS;
final URI streamLoc;
- if( null == url_s ) {
- streamLoc = defURI;
- } else {
+ if( null != url_s ) {
streamLoc = new URI(url_s);
+ } else if( null != file_s1 ) {
+ File movieFile = new File(file_s1);
+ streamLoc = movieFile.toURI();
+ } else if( null != file_s2 ) {
+ streamLoc = IOUtil.toURISimple(new File(file_s2));
+ } else {
+ streamLoc = defURI;
}
+ System.err.println("url_s "+url_s);
+ System.err.println("file_s 1: "+file_s1+", 2: "+file_s2);
System.err.println("stream "+streamLoc);
System.err.println("vid "+vid+", aid "+aid);
System.err.println("textureCount "+textureCount);
@@ -753,12 +793,12 @@ public class MovieSimple implements GLEventListener {
System.err.println("forceGL3 "+forceGL3);
System.err.println("forceGLDef "+forceGLDef);
System.err.println("swapInterval "+swapInterval);
-
+
final MovieSimple ms = new MovieSimple(null);
ms.setSwapInterval(swapInterval);
ms.setScaleOrig(!zoom);
ms.setOrthoProjection(ortho);
-
+
try {
final GLProfile glp;
if(forceGLDef) {
@@ -771,15 +811,15 @@ public class MovieSimple implements GLEventListener {
glp = GLProfile.get(GLProfile.GLES2);
} else {
glp = GLProfile.getGL2ES2();
- }
+ }
System.err.println("GLProfile: "+glp);
GLCapabilities caps = new GLCapabilities(glp);
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(caps);
final Animator anim = new Animator(window);
window.addWindowListener(new WindowAdapter() {
public void windowDestroyed(WindowEvent e) {
anim.stop();
- }
+ }
});
window.setSize(width, height);
window.setVisible(true);
@@ -790,18 +830,19 @@ public class MovieSimple implements GLEventListener {
new Thread() {
public void run() {
window.destroy();
- } }.start();
+ } }.start();
}
-
+
@Override
public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) {
}
-
+
@Override
public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) {
System.err.println("MovieSimple AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when);
System.err.println("MovieSimple State: "+mp);
if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) {
+ System.err.println("MovieSimple State: CHANGE_SIZE");
if( origSize ) {
window.setSize(mp.getWidth(), mp.getHeight());
}
@@ -809,11 +850,14 @@ public class MovieSimple implements GLEventListener {
ms.resetGLState();
}
if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) {
- if( GLMediaPlayer.STREAM_ID_NONE != ms.mPlayer.getVID() ) {
- window.addGLEventListener(ms);
- anim.setUpdateFPSFrames(60, System.err);
- anim.resetFPSCounter();
- } else {
+ System.err.println("MovieSimple State: INIT");
+ // Use GLEventListener in all cases [A+V, V, A]
+ window.addGLEventListener(ms);
+ anim.setUpdateFPSFrames(60, System.err);
+ anim.resetFPSCounter();
+ /**
+ * Kick off player w/o GLEventListener, i.e. for audio only.
+ *
try {
ms.mPlayer.initGL(null);
} catch (Exception e) {
@@ -823,12 +867,38 @@ public class MovieSimple implements GLEventListener {
}
ms.mPlayer.play();
System.out.println("play.1 "+ms.mPlayer);
+ */
+ }
+ boolean destroy = false;
+ Throwable err = null;
+
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
+ err = ms.mPlayer.getStreamException();
+ if( null != err ) {
+ System.err.println("MovieSimple State: EOS + Exception");
+ destroy = true;
+ } else {
+ System.err.println("MovieSimple State: EOS");
+ if( loopEOS ) {
+ ms.mPlayer.seek(0);
+ ms.mPlayer.play();
+ } else {
+ destroy = true;
+ }
+ }
+ }
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_ERR & event_mask ) ) {
+ err = ms.mPlayer.getStreamException();
+ if( null != err ) {
+ System.err.println("MovieSimple State: ERR + Exception");
+ } else {
+ System.err.println("MovieSimple State: ERR");
}
+ destroy = true;
}
- if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) {
- final StreamException se = ms.mPlayer.getStreamException();
- if( null != se ) {
- se.printStackTrace();
+ if( destroy ) {
+ if( null != err ) {
+ err.printStackTrace();
}
destroyWindow();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java
index 89e31cf..c3d40b7 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -46,25 +46,25 @@ import com.jogamp.opengl.util.Animator;
*/
@SuppressWarnings("serial")
public class Bug848AppletGLCanvas01 extends Applet {
- private List<GLAnimatorControl> animators = new ArrayList<GLAnimatorControl>(2);
+ private final List<GLAnimatorControl> animators = new ArrayList<GLAnimatorControl>(2);
@Override
public void init() {
System.err.println("GearsApplet: init() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
new BoxLayout(this, BoxLayout.X_AXIS);
setSize(1024, 664);
- add(createCanvas());
- add(createCanvas());
- add(createCanvas());
- add(createCanvas());
- add(createCanvas());
- add(createCanvas());
+ add(createCanvas(0));
+ add(createCanvas(0));
+ add(createCanvas(0));
+ add(createCanvas(0));
+ add(createCanvas(0));
+ add(createCanvas(1));
System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
}
- private GLCanvas createCanvas() {
+ private GLCanvas createCanvas(int vsyncI) {
GLCanvas canvas = new GLCanvas();
- canvas.addGLEventListener(new GearsES2(1));
+ canvas.addGLEventListener(new GearsES2(vsyncI));
canvas.setSize(300, 300);
animators.add(new Animator(canvas));
return canvas;
@@ -73,7 +73,7 @@ public class Bug848AppletGLCanvas01 extends Applet {
String currentThreadName() {
return Thread.currentThread().getName();
}
-
+
@Override
public void start() {
System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
index 3a9cf8f..46e39be 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.demos.es2.awt;
import java.awt.AWTException;
@@ -63,12 +63,14 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
static Dimension wsize, rwsize=null;
static boolean forceES2 = false;
static boolean forceGL3 = false;
+ static boolean forceGLFFP = false;
static boolean shallUsePBuffer = false;
static boolean shallUseBitmap = false;
static boolean useMSAA = false;
static int swapInterval = 0;
static boolean useAnimator = true;
static boolean manualTest = false;
+ static boolean skipGLOrientationVerticalFlip = false;
@BeforeClass
public static void initClass() {
@@ -93,9 +95,9 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
}
-
+
protected void runTestGL(GLCapabilities caps)
throws AWTException, InterruptedException, InvocationTargetException
{
@@ -104,13 +106,18 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
final GLJPanel glJPanel = new GLJPanel(caps);
Assert.assertNotNull(glJPanel);
+ glJPanel.setSkipGLOrientationVerticalFlip(skipGLOrientationVerticalFlip);
glJPanel.setMinimumSize(wsize);
glJPanel.setPreferredSize(wsize);
glJPanel.setSize(wsize);
- if( caps.isBitmap() ) {
- glJPanel.addGLEventListener(new Gears(swapInterval));
+ if( caps.isBitmap() || caps.getGLProfile().isGL2() ) {
+ final Gears gears = new Gears(swapInterval);
+ gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
+ glJPanel.addGLEventListener(gears);
} else {
- glJPanel.addGLEventListener(new GearsES2(swapInterval));
+ final GearsES2 gears = new GearsES2(swapInterval);
+ gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
+ glJPanel.addGLEventListener(gears);
}
final SnapshotGLEventListener snap = new SnapshotGLEventListener();
glJPanel.addGLEventListener(snap);
@@ -135,17 +142,17 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel);
new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
-
+
snap.setMakeSnapshot();
-
+
if( null != rwsize ) {
- Thread.sleep(500); // 500ms delay
+ Thread.sleep(500); // 500ms delay
setFrameSize(frame, true, rwsize);
System.err.println("window resize pos/siz: "+glJPanel.getX()+"/"+glJPanel.getY()+" "+glJPanel.getWidth()+"x"+glJPanel.getHeight());
}
-
+
snap.setMakeSnapshot();
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
boolean triggerSnap = false;
@@ -187,6 +194,8 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
glp = GLProfile.get(GLProfile.GL3);
} else if(forceES2) {
glp = GLProfile.get(GLProfile.GLES2);
+ } else if(forceGLFFP) {
+ glp = GLProfile.getMaxFixedFunc(true);
} else {
glp = GLProfile.getGL2ES2();
}
@@ -216,7 +225,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
caps.setSampleBuffers(true);
runTestGL(caps);
}
-
+
@Test
public void test03_PbufferNorm()
throws AWTException, InterruptedException, InvocationTargetException
@@ -228,7 +237,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
caps.setPBuffer(true);
runTestGL(caps);
}
-
+
@Test
public void test04_PbufferMsaa()
throws AWTException, InterruptedException, InvocationTargetException
@@ -242,7 +251,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
caps.setPBuffer(true);
runTestGL(caps);
}
-
+
@Test
public void test05_BitmapNorm()
throws AWTException, InterruptedException, InvocationTargetException
@@ -254,7 +263,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
caps.setBitmap(true);
runTestGL(caps);
}
-
+
@Test
public void test06_BitmapMsaa()
throws AWTException, InterruptedException, InvocationTargetException
@@ -268,7 +277,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
caps.setBitmap(true);
runTestGL(caps);
}
-
+
@Test
public void test20_GLES2()
throws AWTException, InterruptedException, InvocationTargetException
@@ -276,7 +285,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
if( manualTest ) {
return;
}
-
+
if( !GLProfile.isAvailable(GLProfile.GLES2) ) {
System.err.println("GLES2 n/a");
return;
@@ -285,7 +294,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities( glp );
runTestGL(caps);
}
-
+
@Test
public void test30_GL3()
throws AWTException, InterruptedException, InvocationTargetException
@@ -293,7 +302,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
if( manualTest ) {
return;
}
-
+
if( !GLProfile.isAvailable(GLProfile.GL3) ) {
System.err.println("GL3 n/a");
return;
@@ -302,12 +311,12 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities( glp );
runTestGL(caps);
}
-
+
static long duration = 500; // ms
public static void main(String args[]) {
int w=640, h=480, rw=-1, rh=-1;
-
+
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
@@ -316,6 +325,8 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
forceES2 = true;
} else if(args[i].equals("-gl3")) {
forceGL3 = true;
+ } else if(args[i].equals("-glFFP")) {
+ forceGLFFP = true;
} else if(args[i].equals("-width")) {
i++;
w = MiscUtils.atoi(args[i], w);
@@ -328,6 +339,8 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
} else if(args[i].equals("-rheight")) {
i++;
rh = MiscUtils.atoi(args[i], rh);
+ } else if(args[i].equals("-userVFlip")) {
+ skipGLOrientationVerticalFlip = true;
} else if(args[i].equals("-vsync")) {
i++;
swapInterval = MiscUtils.atoi(args[i], swapInterval);
@@ -347,18 +360,20 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
if( 0 < rw && 0 < rh ) {
rwsize = new Dimension(rw, rh);
}
-
+
System.err.println("size "+wsize);
System.err.println("resize "+rwsize);
+ System.err.println("userVFlip "+skipGLOrientationVerticalFlip);
System.err.println("swapInterval "+swapInterval);
System.err.println("forceES2 "+forceES2);
System.err.println("forceGL3 "+forceGL3);
+ System.err.println("forceGLFFP "+forceGLFFP);
System.err.println("useMSAA "+useMSAA);
System.err.println("useAnimator "+useAnimator);
System.err.println("shallUsePBuffer "+shallUsePBuffer);
System.err.println("shallUseBitmap "+shallUseBitmap);
System.err.println("manualTest "+manualTest);
-
+
org.junit.runner.JUnitCore.main(TestGearsES2GLJPanelAWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
index 031d6a1..0d71c7a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
@@ -27,17 +27,19 @@ import com.jogamp.opengl.util.TileRendererBase;
* This version is equal to Brian Paul's version 1.2 1999/10/21
*/
public class Gears implements GLEventListener, TileRendererBase.TileRendererListener {
- private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f;
+ private float view_rotx = 20.0f, view_roty = 30.0f;
+ private final float view_rotz = 0.0f;
private int gear1=0, gear2=0, gear3=0;
private float angle = 0.0f;
private boolean doRotate = true;
- private int swapInterval;
- private MouseListener gearsMouse = new GearsMouseAdapter();
- private KeyListener gearsKeys = new GearsKeyAdapter();
+ private final int swapInterval;
+ private final MouseListener gearsMouse = new GearsMouseAdapter();
+ private final KeyListener gearsKeys = new GearsKeyAdapter();
private TileRendererBase tileRendererInUse = null;
private boolean doRotateBeforePrinting;
private boolean verbose = true;
-
+ private boolean flipVerticalInGLOrientation = false;
+
// private boolean mouseRButtonDown = false;
private int prevMouseX, prevMouseY;
@@ -48,17 +50,17 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
public Gears() {
this.swapInterval = 1;
}
-
+
@Override
public void addTileRendererNotify(TileRendererBase tr) {
tileRendererInUse = tr;
doRotateBeforePrinting = doRotate;
- setDoRotation(false);
+ setDoRotation(false);
}
@Override
public void removeTileRendererNotify(TileRendererBase tr) {
tileRendererInUse = null;
- setDoRotation(doRotateBeforePrinting);
+ setDoRotation(doRotateBeforePrinting);
}
@Override
public void startTileRendering(TileRendererBase tr) {
@@ -68,10 +70,11 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
public void endTileRendering(TileRendererBase tr) {
System.err.println("Gears.endTileRendering: "+tr);
}
-
+
public void setDoRotation(boolean rotate) { doRotate = rotate; }
public void setVerbose(boolean v) { verbose = v; }
-
+ public void setFlipVerticalInGLOrientation(boolean v) { flipVerticalInGLOrientation=v; }
+
public void setGears(int g1, int g2, int g3) {
gear1 = g1;
gear2 = g2;
@@ -98,24 +101,24 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
GL2 gl = drawable.getGL().getGL2();
init(gl);
-
+
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.addMouseListener(gearsMouse);
window.addKeyListener(gearsKeys);
} else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
final java.awt.Component comp = (java.awt.Component) upstreamWidget;
new AWTMouseAdapter(gearsMouse).addTo(comp);
- new AWTKeyAdapter(gearsKeys).addTo(comp);
+ new AWTKeyAdapter(gearsKeys).addTo(comp);
}
}
-
+
public void init(GL2 gl) {
- float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
- float red[] = { 0.8f, 0.1f, 0.0f, 0.7f };
- float green[] = { 0.0f, 0.8f, 0.2f, 0.7f };
- float blue[] = { 0.2f, 0.2f, 1.0f, 0.7f };
+ final float lightPos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
+ final float red[] = { 0.8f, 0.1f, 0.0f, 0.7f };
+ final float green[] = { 0.0f, 0.8f, 0.2f, 0.7f };
+ final float blue[] = { 0.2f, 0.2f, 1.0f, 0.7f };
System.err.println(Thread.currentThread()+" Gears.init: tileRendererInUse "+tileRendererInUse);
if(verbose) {
@@ -124,13 +127,16 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
System.err.println("INIT GL IS: " + gl.getClass().getName());
System.err.println(JoglVersion.getGLStrings(gl, null, false).toString());
}
-
- gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, pos, 0);
- gl.glEnable(GL2.GL_CULL_FACE);
+
+ gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, lightPos, 0);
+ if( ! ( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() ) ) {
+ // Only possible if we do not flip the projection matrix
+ gl.glEnable(GL2.GL_CULL_FACE);
+ }
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0);
gl.glEnable(GL2.GL_DEPTH_TEST);
-
+
/* make the gears */
if(0>=gear1) {
gear1 = gl.glGenLists(1);
@@ -142,7 +148,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
} else {
System.err.println("gear1 list reused: "+gear1);
}
-
+
if(0>=gear2) {
gear2 = gl.glGenLists(1);
gl.glNewList(gear2, GL2.GL_COMPILE);
@@ -153,7 +159,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
} else {
System.err.println("gear2 list reused: "+gear2);
}
-
+
if(0>=gear3) {
gear3 = gl.glGenLists(1);
gl.glNewList(gear3, GL2.GL_COMPILE);
@@ -164,14 +170,14 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
} else {
System.err.println("gear3 list reused: "+gear3);
}
-
+
gl.glEnable(GL2.GL_NORMALIZE);
}
-
+
@Override
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
final GL2 gl = glad.getGL().getGL2();
- if(-1 != swapInterval) {
+ if(-1 != swapInterval) {
gl.setSwapInterval(swapInterval);
}
reshape(gl, x, y, width, height, width, height);
@@ -179,7 +185,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
@Override
public void reshapeTile(TileRendererBase tr,
- int tileX, int tileY, int tileWidth, int tileHeight,
+ int tileX, int tileY, int tileWidth, int tileHeight,
int imageWidth, int imageHeight) {
final GL2 gl = tr.getAttachedDrawable().getGL().getGL2();
gl.setSwapInterval(0);
@@ -193,13 +199,9 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
if( msaa ) {
gl.glEnable(GL.GL_MULTISAMPLE);
}
-
- gl.glMatrixMode(GL2.GL_PROJECTION);
- gl.glLoadIdentity();
-
// compute projection parameters 'normal'
- float left, right, bottom, top;
+ float left, right, bottom, top;
if( imageHeight > imageWidth ) {
float a = (float)imageHeight / (float)imageWidth;
left = -1.0f;
@@ -215,24 +217,31 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
}
final float w = right - left;
final float h = top - bottom;
-
+
// compute projection parameters 'tiled'
final float l = left + tileX * w / imageWidth;
final float r = l + tileWidth * w / imageWidth;
+
final float b = bottom + tileY * h / imageHeight;
final float t = b + tileHeight * h / imageHeight;
final float _w = r - l;
final float _h = t - b;
if(verbose) {
- System.err.println(">> angle "+angle+", [l "+left+", r "+right+", b "+bottom+", t "+top+"] "+w+"x"+h+" -> [l "+l+", r "+r+", b "+b+", t "+t+"] "+_w+"x"+_h);
+ System.err.println(">> Gears angle "+angle+", [l "+left+", r "+right+", b "+bottom+", t "+top+"] "+w+"x"+h+" -> [l "+l+", r "+r+", b "+b+", t "+t+"] "+_w+"x"+_h+", v-flip "+flipVerticalInGLOrientation);
+ }
+
+ gl.glMatrixMode(GL2.GL_PROJECTION);
+ gl.glLoadIdentity();
+ if( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() ) {
+ gl.glScalef(1f, -1f, 1f);
}
gl.glFrustum(l, r, b, t, 5.0f, 60.0f);
- gl.glMatrixMode(GL2.GL_MODELVIEW);
+ gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -40.0f);
-
+
if( msaa ) {
gl.glDisable(GL.GL_MULTISAMPLE);
}
@@ -243,7 +252,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
System.err.println(Thread.currentThread()+" Gears.dispose: tileRendererInUse "+tileRendererInUse);
try {
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.removeMouseListener(gearsMouse);
window.removeKeyListener(gearsKeys);
@@ -261,7 +270,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
if( msaa ) {
gl.glEnable(GL.GL_MULTISAMPLE);
}
-
+
if( null == tileRendererInUse ) {
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
} else {
@@ -270,7 +279,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
// Special handling for the case where the GLJPanel is translucent
// and wants to be composited with other Java 2D content
- if (GLProfile.isAWTAvailable() &&
+ if (GLProfile.isAWTAvailable() &&
(drawable instanceof javax.media.opengl.awt.GLJPanel) &&
!((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() &&
((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
@@ -310,31 +319,31 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
gl.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
gl.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
gl.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
-
+
// Place the first gear and call its display list
gl.glPushMatrix();
gl.glTranslatef(-3.0f, -2.0f, 0.0f);
gl.glRotatef(angle, 0.0f, 0.0f, 1.0f);
gl.glCallList(gear1);
gl.glPopMatrix();
-
+
// Place the second gear and call its display list
gl.glPushMatrix();
gl.glTranslatef(3.1f, -2.0f, 0.0f);
gl.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
gl.glCallList(gear2);
gl.glPopMatrix();
-
+
// Place the third gear and call its display list
gl.glPushMatrix();
gl.glTranslatef(-3.1f, 4.2f, 0.0f);
gl.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
gl.glCallList(gear3);
gl.glPopMatrix();
-
+
// Remember that every push needs a pop; this one is paired with
// rotating the entire gear assembly
- gl.glPopMatrix();
+ gl.glPopMatrix();
}
public static void gear(GL2 gl,
@@ -352,9 +361,9 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0f;
r2 = outer_radius + tooth_depth / 2.0f;
-
+
da = 2.0f * (float) Math.PI / teeth / 4.0f;
-
+
gl.glShadeModel(GL2.GL_FLAT);
gl.glNormal3f(0.0f, 0.0f, 1.0f);
@@ -385,7 +394,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
gl.glVertex3f(r1 * (float)Math.cos(angle + 3.0f * da), r1 * (float)Math.sin(angle + 3.0f * da), width * 0.5f);
}
gl.glEnd();
-
+
/* draw back face */
gl.glBegin(GL2.GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++)
@@ -397,7 +406,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), -width * 0.5f);
}
gl.glEnd();
-
+
/* draw back sides of teeth */
gl.glBegin(GL2.GL_QUADS);
for (i = 0; i < teeth; i++)
@@ -409,7 +418,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), -width * 0.5f);
}
gl.glEnd();
-
+
/* draw outward faces of teeth */
gl.glBegin(GL2.GL_QUAD_STRIP);
for (i = 0; i < teeth; i++)
@@ -438,9 +447,9 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
gl.glVertex3f(r1 * (float)Math.cos(0), r1 * (float)Math.sin(0), width * 0.5f);
gl.glVertex3f(r1 * (float)Math.cos(0), r1 * (float)Math.sin(0), -width * 0.5f);
gl.glEnd();
-
+
gl.glShadeModel(GL2.GL_SMOOTH);
-
+
/* draw inside radius cylinder */
gl.glBegin(GL2.GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++)
@@ -453,7 +462,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
gl.glEnd();
}
- class GearsKeyAdapter extends KeyAdapter {
+ class GearsKeyAdapter extends KeyAdapter {
public void keyPressed(KeyEvent e) {
int kc = e.getKeyCode();
if(KeyEvent.VK_LEFT == kc) {
@@ -467,7 +476,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
}
}
}
-
+
class GearsMouseAdapter extends MouseAdapter {
public void mousePressed(MouseEvent e) {
prevMouseX = e.getX();
@@ -476,13 +485,13 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
// mouseRButtonDown = true;
}
}
-
+
public void mouseReleased(MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) {
// mouseRButtonDown = false;
}
}
-
+
public void mouseDragged(MouseEvent e) {
int x = e.getX();
int y = e.getY();
@@ -501,7 +510,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
}
float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width);
float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height);
-
+
prevMouseX = x;
prevMouseY = y;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java
new file mode 100644
index 0000000..0472fdb
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java
@@ -0,0 +1,253 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.junit.jogl.perf;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.opengl.GLAnimatorControl;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.awt.GLCanvas;
+import javax.media.opengl.awt.GLJPanel;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Multiple GLJPanels in a JFrame's Grid
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestPerf001GLJPanelInit01AWT extends UITestCase {
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton();
+ }
+
+ public void test(final GLCapabilitiesImmutable caps, final boolean useGears, final int width, final int height, final int rows,
+ final int columns, final boolean useGLJPanel, final boolean useAnim) {
+ final GLAnimatorControl animator = useAnim ? new Animator() : null;
+
+ final JFrame frame;
+ final JPanel panel;
+
+ panel = new JPanel();
+ frame = new JFrame("DemoGLJPanelGridAWT");
+
+ panel.setLayout(new GridLayout(rows, columns));
+ // panel.setBounds(0, 0, width, height);
+ final int panelCount = rows*columns;
+ final Dimension eSize = new Dimension(width/columns, height/rows);
+ final long[] t = new long[10];
+ if( wait ) {
+ UITestCase.waitForKey("Pre-Init");
+ }
+ System.err.println("INIT START");
+ initCount = 0;
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ t[0] = Platform.currentTimeMillis();
+ for(int i=0; i<panelCount; i++) {
+ final GLAutoDrawable glad = useGLJPanel ? createGLJPanel(caps, useGears, animator, eSize) : createGLCanvas(caps, useGears, animator, eSize);
+ glad.addGLEventListener(new GLEventListener() {
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ initCount++;
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {}
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ });
+ panel.add((Component)glad);
+ }
+ t[1] = Platform.currentTimeMillis();
+ frame.getContentPane().add(panel);
+
+ // frame.validate();
+ frame.pack();
+ frame.setVisible(true);
+ t[2] = Platform.currentTimeMillis();
+ } } );
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ while( panelCount > initCount ) {
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ t[3] = Platform.currentTimeMillis();
+ final double panelCountF = panelCount;
+ System.err.printf("P: %d %s:%n\tctor\t%6d/t %6.2f/1%n\tvisible\t%6d/t %6.2f/1%n\tsum-i\t%6d/t %6.2f/1%n",
+ panelCount,
+ useGLJPanel?"GLJPanel":"GLCanvas",
+ t[1]-t[0], (t[1]-t[0])/panelCountF,
+ t[3]-t[1], (t[3]-t[1])/panelCountF,
+ t[3]-t[0], (t[3]-t[0])/panelCountF);
+ System.err.println("INIT END: "+initCount);
+ if( wait ) {
+ UITestCase.waitForKey("Post-Init");
+ }
+ try {
+ Thread.sleep(duration);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ t[4] = Platform.currentTimeMillis();
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ } } );
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ final long ti_net = (t[4]-t[0])-duration;
+ System.err.printf("T: duration %d %d%n\ttotal-d\t%6d/t %6.2f/1%n\ttotal-i\t%6d/t %6.2f/1%n",
+ duration, t[4]-t[3],
+ t[4]-t[0], (t[4]-t[0])/panelCountF,
+ ti_net, ti_net/panelCountF);
+ System.err.println("Total: "+(t[4]-t[0]));
+ }
+
+ private GLAutoDrawable createGLCanvas(GLCapabilitiesImmutable caps, boolean useGears, GLAnimatorControl anim, Dimension size) {
+ GLCanvas canvas = new GLCanvas(caps);
+ canvas.setSize(size);
+ canvas.setPreferredSize(size);
+ if( useGears ) {
+ canvas.addGLEventListener(new GearsES2());
+ }
+ if( null != anim ) {
+ anim.add(canvas);
+ }
+ return canvas;
+ }
+ private GLAutoDrawable createGLJPanel(GLCapabilitiesImmutable caps, boolean useGears, GLAnimatorControl anim, Dimension size) {
+ GLJPanel canvas = new GLJPanel(caps);
+ canvas.setSize(size);
+ canvas.setPreferredSize(size);
+ if( useGears ) {
+ canvas.addGLEventListener(new GearsES2());
+ }
+ if( null != anim ) {
+ anim.add(canvas);
+ }
+ return canvas;
+ }
+
+ @Test
+ public void test01NopGLJPanelDef() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, width, height, rows, cols, true /* useGLJPanel */, false /*useAnim*/);
+ }
+
+ @Test
+ public void test02NopGLJPanelBitmap() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(null);
+ caps.setBitmap(true);
+ test(caps, false /*useGears*/, width, height, rows, cols, true /* useGLJPanel */, false /*useAnim*/);
+ }
+
+ @Test
+ public void test11NopGLCanvasDef() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, width, height, rows, cols, false /* useGLJPanel */, false /*useAnim*/);
+ }
+
+ static long duration = 0; // ms
+ static boolean wait = false;
+ static int width = 800, height = 600, rows = 5, cols = 5;
+
+ volatile int initCount = 0;
+
+ public static void main(String[] args) {
+ boolean useGLJPanel = true, useGears = false, manual=false;
+ boolean waitMain = false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-width")) {
+ width = MiscUtils.atoi(args[++i], width);
+ } else if(args[i].equals("-height")) {
+ height = MiscUtils.atoi(args[++i], height);
+ } else if(args[i].equals("-rows")) {
+ rows = MiscUtils.atoi(args[++i], rows);
+ } else if(args[i].equals("-cols")) {
+ cols = MiscUtils.atoi(args[++i], cols);
+ } else if(args[i].equals("-glcanvas")) {
+ useGLJPanel = false;
+ } else if(args[i].equals("-gears")) {
+ useGears = true;
+ } else if(args[i].equals("-wait")) {
+ wait = true;
+ manual = true;
+ } else if(args[i].equals("-waitMain")) {
+ waitMain = true;
+ manual = true;
+ } else if(args[i].equals("-manual")) {
+ manual = true;
+ }
+ }
+ if( waitMain ) {
+ UITestCase.waitForKey("Main-Start");
+ }
+ if( manual ) {
+ GLProfile.initSingleton();
+ TestPerf001GLJPanelInit01AWT demo = new TestPerf001GLJPanelInit01AWT();
+ demo.test(null, useGears, width, height, rows, cols, useGLJPanel, false /*useAnim*/);
+ } else {
+ org.junit.runner.JUnitCore.main(TestPerf001GLJPanelInit01AWT.class.getName());
+ }
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java
new file mode 100644
index 0000000..b513af9
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java
@@ -0,0 +1,441 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.junit.jogl.perf;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.opengl.GLAnimatorControl;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.awt.GLCanvas;
+import javax.media.opengl.awt.GLJPanel;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Multiple GLJPanels in a JFrame
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestPerf001GLJPanelInit02AWT extends UITestCase {
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton();
+ }
+
+ public void test(final GLCapabilitiesImmutable caps, final boolean useGears, final boolean skipGLOrientationVerticalFlip, final int width,
+ final int height, final int frameCount, final boolean initMT, final boolean useGLJPanel,
+ final boolean useSwingDoubleBuffer, final boolean useGLCanvas, final boolean useAnim, final boolean overlap) {
+ final GLAnimatorControl animator;
+ if( useAnim ) {
+ animator = new Animator();
+ animator.start();
+ } else {
+ animator = null;
+ }
+ final int eWidth, eHeight;
+ {
+ final int cols = (int)Math.round(Math.sqrt(frameCount));
+ final int rows = frameCount / cols;
+ eWidth = width/cols-32;
+ eHeight = height/rows-32;
+ }
+ System.err.println("Frame size: "+width+"x"+height+" -> "+frameCount+" x "+eWidth+"x"+eHeight+", overlap "+overlap);
+ System.err.println("SkipGLOrientationVerticalFlip "+skipGLOrientationVerticalFlip+", useGears "+useGears+", initMT "+initMT+", useAnim "+useAnim);
+ final JFrame[] frame = new JFrame[frameCount];
+ final long[] t = new long[10];
+ if( wait ) {
+ UITestCase.waitForKey("Pre-Init");
+ }
+ System.err.println("INIT START");
+ initCount = 0;
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ t[0] = Platform.currentTimeMillis();
+ int x = 32, y = 32;
+ for(int i=0; i<frameCount; i++) {
+ frame[i] = new JFrame("frame_"+i+"/"+frameCount);
+ frame[i].setLocation(x, y);
+ if(!overlap) {
+ x+=eWidth+32;
+ if(x>=width) {
+ x=32;
+ y+=eHeight+32;
+ }
+ }
+ final JPanel panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+ panel.setDoubleBuffered(useSwingDoubleBuffer);
+ // panel.setBounds(0, 0, width, height);
+ final Dimension eSize = new Dimension(eWidth, eHeight);
+ final GLAutoDrawable glad = useGLJPanel ? createGLJPanel(initMT, useSwingDoubleBuffer, caps, useGears, skipGLOrientationVerticalFlip, animator, eSize) : ( useGLCanvas ? createGLCanvas(caps, useGears, animator, eSize) : null );
+ if( null != glad ) {
+ glad.addGLEventListener(new GLEventListener() {
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ initCount++;
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {}
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ });
+ panel.add((Component)glad);
+ } else {
+ @SuppressWarnings("serial")
+ final JTextArea c = new JTextArea("area "+i) {
+ boolean initialized = false, added = false;
+ int reshapeWidth=0, reshapeHeight=0;
+ @Override
+ public void addNotify() {
+ added = true;
+ super.addNotify();
+ }
+ @SuppressWarnings("deprecation")
+ @Override
+ public void reshape(int x, int y, int width, int height) {
+ super.reshape(x, y, width, height);
+ reshapeWidth = width; reshapeHeight = height;
+ }
+ @Override
+ protected void paintComponent(final Graphics g) {
+ super.paintComponent(g);
+ if( !initialized && added && reshapeWidth > 0 && reshapeHeight > 0 && isDisplayable() ) {
+ initialized = true;
+ initCount++;
+ }
+ }
+ };
+ c.setEditable(false);
+ c.setSize(eSize);
+ c.setPreferredSize(eSize);
+ panel.add(c);
+ }
+ frame[i].getContentPane().add(panel);
+
+ // frame.validate();
+ frame[i].pack();
+ }
+ t[1] = Platform.currentTimeMillis();
+ for(int i=0; i<frameCount; i++) {
+ frame[i].setVisible(true);
+ }
+ t[2] = Platform.currentTimeMillis();
+ } } );
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ while( frameCount > initCount ) {
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ t[3] = Platform.currentTimeMillis();
+ final double panelCountF = frameCount;
+ System.err.printf("P: %d %s%s:%n\tctor\t%6d/t %6.2f/1%n\tvisible\t%6d/t %6.2f/1%n\tsum-i\t%6d/t %6.2f/1%n",
+ frameCount,
+ useGLJPanel?"GLJPanel":(useGLCanvas?"GLCanvas":"No_GL"), initMT?" (mt)":" (01)",
+ t[1]-t[0], (t[1]-t[0])/panelCountF,
+ t[3]-t[1], (t[3]-t[1])/panelCountF,
+ t[3]-t[0], (t[3]-t[0])/panelCountF);
+
+ System.err.println("INIT END: "+initCount);
+ if( wait ) {
+ UITestCase.waitForKey("Post-Init");
+ }
+ try {
+ Thread.sleep(duration);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ t[4] = Platform.currentTimeMillis();
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ for(int i=0; i<frameCount; i++) {
+ frame[i].dispose();
+ }
+ } } );
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ final long ti_net = (t[4]-t[0])-duration;
+ System.err.printf("T: duration %d %d%n\ttotal-d\t%6d/t %6.2f/1%n\ttotal-i\t%6d/t %6.2f/1%n",
+ duration, t[4]-t[3],
+ t[4]-t[0], (t[4]-t[0])/panelCountF,
+ ti_net, ti_net/panelCountF);
+ System.err.println("Total: "+(t[4]-t[0]));
+ }
+
+ private GLAutoDrawable createGLCanvas(GLCapabilitiesImmutable caps, boolean useGears, GLAnimatorControl anim, Dimension size) {
+ GLCanvas canvas = new GLCanvas(caps);
+ canvas.setSize(size);
+ canvas.setPreferredSize(size);
+ if( useGears ) {
+ final GearsES2 g = new GearsES2(0);
+ g.setVerbose(false);
+ canvas.addGLEventListener(g);
+ }
+ if( null != anim ) {
+ anim.add(canvas);
+ }
+ return canvas;
+ }
+ private GLAutoDrawable createGLJPanel(boolean initMT, boolean useSwingDoubleBuffer, GLCapabilitiesImmutable caps, boolean useGears, boolean skipGLOrientationVerticalFlip, GLAnimatorControl anim, Dimension size) {
+ GLJPanel canvas = new GLJPanel(caps);
+ canvas.setSize(size);
+ canvas.setPreferredSize(size);
+ canvas.setDoubleBuffered(useSwingDoubleBuffer);
+ if( skipGLOrientationVerticalFlip ) { // don't fiddle w/ default ..
+ canvas.setSkipGLOrientationVerticalFlip(skipGLOrientationVerticalFlip);
+ }
+ if( useGears ) {
+ final GearsES2 g = new GearsES2(0);
+ g.setVerbose(false);
+ g.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
+ canvas.addGLEventListener(g);
+ }
+ if( null != anim ) {
+ anim.add(canvas);
+ }
+ if( initMT ) {
+ canvas.initializeBackend(true /* offthread */);
+ }
+ return canvas;
+ }
+
+ static GLCapabilitiesImmutable caps = null;
+
+ //
+ // NOP
+ //
+
+ @Test
+ public void test00NopNoGLDefGrid() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ false /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ @Test
+ public void test01NopGLCanvasDefGrid() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ false /* useGLJPanel */, false /*useSwingDoubleBuffer*/, true /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ @Test
+ public void test02NopGLJPanelDefGridSingleAutoFlip() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ @Test
+ public void test03NopGLJPanelDefGridSingleManualFlip() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, true /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ @Test
+ public void test04NopGLJPanelDefGridMTManualFlip() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, true /*skipGLOrientationVerticalFlip*/, width , height, frameCount, true /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ //
+ // Gears
+ //
+
+ @Test
+ public void test10GearsNoGLDefGrid() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), true /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ false /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ @Test
+ public void test11GearsGLCanvasDefGrid() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), true /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ false /* useGLJPanel */, false /*useSwingDoubleBuffer*/, true /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ @Test
+ public void test12GearsGLJPanelDefGridSingleAutoFlip() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), true /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ @Test
+ public void test13GearsGLJPanelDefGridSingleManualFlip() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), true /*useGears*/, true /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+ @Test
+ public void test14GearsGLJPanelDefGridMTManualFlip() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), true /*useGears*/, true /*skipGLOrientationVerticalFlip*/, width , height, frameCount, true /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false /* overlap */);
+ }
+
+
+ //
+ // Overlap + NOP
+ //
+
+
+ @Test
+ public void test20NopNoGLDefOverlap() throws InterruptedException, InvocationTargetException {
+ test(null, false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ false /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, true /* overlap */);
+ }
+
+ @Test
+ public void test21NopGLCanvasDefOverlap() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ false /* useGLJPanel */, false /*useSwingDoubleBuffer*/, true /* useGLCanvas */, false /*useAnim*/, true /* overlap */);
+ }
+
+ @Test
+ public void test22NopGLJPanelDefOverlapSingle() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, true /* overlap */);
+ }
+
+ @Test
+ public void test23NopGLJPanelDefOverlapMT() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, true /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, true /* overlap */);
+ }
+
+ // @Test
+ public void testXXNopGLJPanelDefOverlapSingle() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, true /* overlap */);
+ }
+
+ // @Test
+ public void testXXNopGLJPanelBitmapGridSingle() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(null);
+ caps.setBitmap(true);
+ test(caps, false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */,
+ true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false);
+ }
+
+ static long duration = 0; // ms
+ static boolean wait = false;
+ static int width = 800, height = 600, frameCount = 25;
+
+ volatile int initCount = 0;
+
+ public static void main(String[] args) {
+ boolean manual=false;
+ boolean waitMain = false;
+ boolean useGLJPanel = true, initMT = false, useGLCanvas = false, useSwingDoubleBuffer=false;
+ boolean useGears = false, skipGLOrientationVerticalFlip=false, useAnim = false;
+ boolean overlap = false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-width")) {
+ width = MiscUtils.atoi(args[++i], width);
+ } else if(args[i].equals("-height")) {
+ height = MiscUtils.atoi(args[++i], height);
+ } else if(args[i].equals("-count")) {
+ frameCount = MiscUtils.atoi(args[++i], frameCount);
+ } else if(args[i].equals("-initMT")) {
+ initMT = true;
+ manual = true;
+ } else if(args[i].equals("-glcanvas")) {
+ useGLJPanel = false;
+ useGLCanvas = true;
+ manual = true;
+ } else if(args[i].equals("-swingDoubleBuffer")) {
+ useSwingDoubleBuffer = true;
+ } else if(args[i].equals("-glnone")) {
+ useGLJPanel = false;
+ useGLCanvas = false;
+ manual = true;
+ } else if(args[i].equals("-gears")) {
+ useGears = true;
+ } else if(args[i].equals("-anim")) {
+ useAnim = true;
+ } else if(args[i].equals("-userVertFlip")) {
+ skipGLOrientationVerticalFlip = true;
+ } else if(args[i].equals("-overlap")) {
+ overlap = true;
+ } else if(args[i].equals("-wait")) {
+ wait = true;
+ manual = true;
+ } else if(args[i].equals("-waitMain")) {
+ waitMain = true;
+ manual = true;
+ } else if(args[i].equals("-manual")) {
+ manual = true;
+ }
+ }
+ if( waitMain ) {
+ UITestCase.waitForKey("Main-Start");
+ }
+ if( manual ) {
+ GLProfile.initSingleton();
+ TestPerf001GLJPanelInit02AWT demo = new TestPerf001GLJPanelInit02AWT();
+ demo.test(null, useGears, skipGLOrientationVerticalFlip, width, height, frameCount,
+ initMT, useGLJPanel, useSwingDoubleBuffer, useGLCanvas, useAnim, overlap);
+ } else {
+ org.junit.runner.JUnitCore.main(TestPerf001GLJPanelInit02AWT.class.getName());
+ }
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java
new file mode 100644
index 0000000..4915cff
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java
@@ -0,0 +1,208 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.junit.jogl.perf;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.Screen;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Multiple GLJPanels in a JFrame
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestPerf001GLWindowInit03NEWT extends UITestCase {
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton();
+ }
+
+ public void test(final GLCapabilitiesImmutable caps, final boolean useGears, final int width, final int height, final int frameCount, boolean reuseDevice) {
+ final int cols = (int)Math.round(Math.sqrt(frameCount));
+ final int rows = frameCount / cols;
+ final int eWidth = width/cols;
+ final int eHeight = height/rows;
+
+ final GLWindow[] frame = new GLWindow[frameCount];
+ final long[] t = new long[10];
+ if( wait ) {
+ UITestCase.waitForKey("Pre-Init");
+ }
+ System.err.println("INIT START");
+ initCount = 0;
+
+ t[0] = Platform.currentTimeMillis();
+ int x = 32, y = 32;
+ for(int i=0; i<frameCount; i++) {
+ final Screen screen = NewtFactory.createScreen(NewtFactory.createDisplay(null, reuseDevice), 0);
+ frame[i] = GLWindow.create(screen, caps);
+ frame[i].setTitle("frame_"+i+"/"+frameCount);
+ frame[i].setPosition(x, y);
+ x+=eWidth+32;
+ if(x>=width) {
+ x=32;
+ y+=eHeight+32;
+ }
+ frame[i].setSize(eWidth, eHeight);
+ if( useGears ) {
+ frame[i].addGLEventListener(new GearsES2());
+ }
+ frame[i].addGLEventListener(new GLEventListener() {
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ initCount++;
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {}
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ });
+ }
+ t[1] = Platform.currentTimeMillis();
+ for(int i=0; i<frameCount; i++) {
+ frame[i].setVisible(false /*wait*/, true /*visible*/);
+ }
+ t[2] = Platform.currentTimeMillis();
+
+ while( frameCount > initCount ) {
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ t[3] = Platform.currentTimeMillis();
+ final double panelCountF = frameCount;
+ System.err.printf("P: %d GLWindow:%n\tctor\t%6d/t %6.2f/1%n\tvisible\t%6d/t %6.2f/1%n\tsum-i\t%6d/t %6.2f/1%n",
+ frameCount,
+ t[1]-t[0], (t[1]-t[0])/panelCountF,
+ t[3]-t[1], (t[3]-t[1])/panelCountF,
+ t[3]-t[0], (t[3]-t[0])/panelCountF);
+
+ System.err.println("INIT END: "+initCount);
+ if( wait ) {
+ UITestCase.waitForKey("Post-Init");
+ }
+ try {
+ Thread.sleep(duration);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ t[4] = Platform.currentTimeMillis();
+ for(int i=0; i<frameCount; i++) {
+ frame[i].destroy();
+ }
+
+ final long ti_net = (t[4]-t[0])-duration;
+ System.err.printf("T: duration %d %d%n\ttotal-d\t%6d/t %6.2f/1%n\ttotal-i\t%6d/t %6.2f/1%n",
+ duration, t[4]-t[3],
+ t[4]-t[0], (t[4]-t[0])/panelCountF,
+ ti_net, ti_net/panelCountF);
+ System.err.println("Total: "+(t[4]-t[0]));
+ }
+
+ static GLCapabilitiesImmutable caps = null;
+
+ @Test
+ public void test01NopGLWindowNoReuse() throws InterruptedException, InvocationTargetException {
+ if(!mainRun) {
+ System.err.println("Disabled for auto unit test until further analysis - Windows/ATI driver crash");
+ return;
+ }
+ test(new GLCapabilities(null), false /*useGears*/, width, height , frameCount, false /* reuseDevice */);
+ }
+ @Test
+ public void test02NopGLWindowReuse() throws InterruptedException, InvocationTargetException {
+ test(new GLCapabilities(null), false /*useGears*/, width, height , frameCount, true /* reuseDevice */);
+ }
+
+ static long duration = 0; // ms
+ static boolean wait = false, mainRun = false;
+ static int width = 800, height = 600, frameCount = 25;
+
+ volatile int initCount = 0;
+
+ public static void main(String[] args) {
+ mainRun = true;
+ boolean useGears = false, manual=false;
+ boolean waitMain = false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-width")) {
+ width = MiscUtils.atoi(args[++i], width);
+ } else if(args[i].equals("-height")) {
+ height = MiscUtils.atoi(args[++i], height);
+ } else if(args[i].equals("-count")) {
+ frameCount = MiscUtils.atoi(args[++i], frameCount);
+ } else if(args[i].equals("-gears")) {
+ useGears = true;
+ } else if(args[i].equals("-wait")) {
+ wait = true;
+ manual = true;
+ } else if(args[i].equals("-waitMain")) {
+ waitMain = true;
+ manual = true;
+ } else if(args[i].equals("-manual")) {
+ manual = true;
+ }
+ }
+ if( waitMain ) {
+ UITestCase.waitForKey("Main-Start");
+ }
+ if( manual ) {
+ GLProfile.initSingleton();
+ TestPerf001GLWindowInit03NEWT demo = new TestPerf001GLWindowInit03NEWT();
+ demo.test(null, useGears, width, height, frameCount, false /* reuseDevice */);
+ } else {
+ org.junit.runner.JUnitCore.main(TestPerf001GLWindowInit03NEWT.class.getName());
+ }
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java
new file mode 100644
index 0000000..6f7d932
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java
@@ -0,0 +1,234 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.junit.jogl.perf;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.VisualIDHolder;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLProfile;
+
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.newt.Display;
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.Screen;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Raw initialization of multiple offscreen GLAutoDrawables
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestPerf001RawInit00NEWT extends UITestCase {
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton();
+ }
+
+ public void testChooseOnly(final int runNum, final Screen screen, final int count) throws InterruptedException {
+ final long[] t = new long[10];
+ final GLProfile glp = GLProfile.getGL2ES2();
+ final int[] chosenCfgs = { 0 };
+
+ final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
+ final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(screen.getDisplay().getGraphicsDevice(), caps);
+
+ if( wait && 0 == runNum ) {
+ UITestCase.waitForKey("Pre-Init");
+ }
+ System.err.println("INIT START #"+runNum);
+ screen.getDisplay().getEDTUtil().invoke(true, new Runnable() {
+ public void run() {
+ t[0] = Platform.currentTimeMillis();
+ for(int i=0; i<count; i++) {
+ final AbstractGraphicsConfiguration cfg = factory.chooseGraphicsConfiguration(caps, caps, null, screen.getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED);
+ if( null != cfg ) {
+ chosenCfgs[0]++;
+ }
+ }
+ t[1] = Platform.currentTimeMillis();
+ } } );
+
+ final double countF = count;
+ System.err.printf("Run: %d, count %d/%d raw:%n\tchoose\t%6d/t %6.2f/1%n",
+ runNum, chosenCfgs[0], count, t[1]-t[0], (t[1]-t[0])/countF);
+ System.err.println("INIT END #"+runNum);
+ if( wait && 2 == runNum ) {
+ UITestCase.waitForKey("Post-Init");
+ }
+ }
+
+ public void testFull(final int runNum, final int width, final int height, final int count) {
+ // panel.setBounds(0, 0, width, height);
+ final long[] t = new long[10];
+ final GLDrawable[] glDrawables = new GLDrawable[count];
+ final GLContext[] glConti = new GLContext[count];
+ final GLProfile glp = GLProfile.getGL2ES2();
+ final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ if( wait && 0 == runNum ) {
+ UITestCase.waitForKey("Pre-Init");
+ }
+ System.err.println("INIT START #"+runNum);
+ t[0] = Platform.currentTimeMillis();
+ for(int i=0; i<count; i++) {
+ glDrawables[i] = factory.createOffscreenDrawable(null, caps, null, width, height);
+ }
+ t[1] = Platform.currentTimeMillis();
+ for(int i=0; i<count; i++) {
+ glDrawables[i].setRealized(true);
+ }
+ t[2] = Platform.currentTimeMillis();
+ // 1st makeCurrent - context creation incl. release
+ for(int i=0; i<count; i++) {
+ final GLContext context = glDrawables[i].createContext(null);
+ if( GLContext.CONTEXT_NOT_CURRENT >= context.makeCurrent() ) {
+ // oops
+ glDrawables[i].setRealized(false);
+ glDrawables[i] = null;
+ glConti[i] = null;
+ continue;
+ }
+ glConti[i] = context;
+ context.release();
+ }
+ t[3] = Platform.currentTimeMillis();
+ // 2nd makeCurrent and release
+ for(int i=0; i<count; i++) {
+ final GLContext context = glConti[i];
+ if( GLContext.CONTEXT_NOT_CURRENT >= context.makeCurrent() ) {
+ // oops
+ glDrawables[i].setRealized(false);
+ glDrawables[i] = null;
+ glConti[i] = null;
+ continue;
+ }
+ context.release();
+ }
+ t[4] = Platform.currentTimeMillis();
+
+ final double countF = count;
+ System.err.printf("Run: %d, count %d raw:%n\tglad-create\t%6d/t %6.2f/1%n"+
+ "\tglad-realize\t%6d/t %6.2f/1%n"+
+ "\tctx-create1\t%6d/t %6.2f/1%n"+
+ "\tctx-curren2\t%6d/t %6.2f/1%n"+
+ "\tglad-ctx-init\t%6d/t %6.2f/1%n",
+ runNum, count,
+ t[1]-t[0], (t[1]-t[0])/countF, // create
+ t[2]-t[1], (t[2]-t[1])/countF, // realize
+ t[3]-t[2], (t[3]-t[2])/countF, // context-create1
+ t[4]-t[3], (t[4]-t[3])/countF, // context-curren2
+ t[3]-t[0], (t[3]-t[0])/countF);// init total
+ System.err.println("INIT END #"+runNum);
+ if( wait && 2 == runNum ) {
+ UITestCase.waitForKey("Post-Init");
+ }
+
+ // destroy
+ for(int i=0; i<count; i++) {
+ final GLContext context = glConti[i];
+ if( null != context ) {
+ context.destroy();
+ }
+ final GLDrawable glDrawable = glDrawables[i];
+ if( null != glDrawable ) {
+ glDrawable.setRealized(false);
+ }
+ glConti[i] = null;
+ glDrawables[i] = null;
+ }
+ }
+
+ @Test
+ public void test01ChooseOnly() throws InterruptedException, InvocationTargetException {
+ if( 0 != manualTest && 1 != manualTest ) {
+ return;
+ }
+ final Display display = NewtFactory.createDisplay(null, false);
+ final Screen screen = NewtFactory.createScreen(display, 0);
+ screen.addReference();
+ try {
+ testChooseOnly(0, screen, count); // warm-up
+ testChooseOnly(1, screen, count);
+ testChooseOnly(2, screen, count);
+ } finally {
+ screen.removeReference();
+ }
+ }
+
+ @Test
+ public void test02Full() throws InterruptedException, InvocationTargetException {
+ if( 0 != manualTest && 2 != manualTest ) {
+ return;
+ }
+ testFull(0, width, height, count); // warm-up
+ testFull(1, width, height, count);
+ testFull(2, width, height, count);
+ }
+
+ static boolean wait = false;
+ static int manualTest = 0;
+ static int width = 800, height = 600, count = 50;
+
+ public static void main(String[] args) {
+ boolean waitMain = false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-width")) {
+ width = MiscUtils.atoi(args[++i], width);
+ } else if(args[i].equals("-height")) {
+ height = MiscUtils.atoi(args[++i], height);
+ } else if(args[i].equals("-count")) {
+ count = MiscUtils.atoi(args[++i], count);
+ } else if(args[i].equals("-wait")) {
+ wait = true;
+ } else if(args[i].equals("-waitMain")) {
+ waitMain = true;
+ } else if(args[i].equals("-test")) {
+ manualTest = MiscUtils.atoi(args[++i], manualTest);
+ }
+ }
+ if( waitMain ) {
+ UITestCase.waitForKey("Main-Start");
+ }
+ org.junit.runner.JUnitCore.main(TestPerf001RawInit00NEWT.class.getName());
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java
new file mode 100644
index 0000000..4b75376
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java
@@ -0,0 +1,332 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.swt;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import com.jogamp.nativewindow.swt.SWTAccessor;
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.event.WindowEvent;
+import com.jogamp.newt.event.WindowAdapter;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.swt.NewtCanvasSWT;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import javax.media.nativewindow.util.Dimension;
+import javax.media.nativewindow.util.Point;
+import javax.media.nativewindow.util.PointImmutable;
+import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLProfile;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug672NewtCanvasSWTSashForm extends UITestCase {
+ static int screenIdx = 0;
+ static PointImmutable wpos;
+ static DimensionImmutable wsize, rwsize = null;
+
+ static long duration = 500; // ms
+
+ @BeforeClass
+ public static void initClass() {
+ if(null == wsize) {
+ wsize = new Dimension(640, 480);
+ }
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ Display display = null;
+ Shell shell = null;
+ Composite composite = null;
+ SashForm sash = null;
+ com.jogamp.newt.Display swtNewtDisplay = null;
+
+ @Before
+ public void init() {
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ display = new Display();
+ Assert.assertNotNull( display );
+ }});
+ display.syncExec(new Runnable() {
+ public void run() {
+ shell = new Shell( display );
+ Assert.assertNotNull( shell );
+ shell.setLayout( new FillLayout() );
+ composite = new Composite( shell, SWT.NONE );
+ composite.setLayout( new FillLayout() );
+ Assert.assertNotNull( composite );
+ sash = new SashForm(composite, SWT.NONE);
+ Assert.assertNotNull( sash );
+ final org.eclipse.swt.widgets.Label c = new org.eclipse.swt.widgets.Label(sash, SWT.NONE);
+ c.setText("Left cell");
+ }});
+ swtNewtDisplay = NewtFactory.createDisplay(null, false); // no-reuse
+ }
+
+ @After
+ public void release() {
+ Assert.assertNotNull( display );
+ Assert.assertNotNull( shell );
+ Assert.assertNotNull( composite );
+ Assert.assertNotNull( sash );
+ try {
+ display.syncExec(new Runnable() {
+ public void run() {
+ sash.dispose();
+ composite.dispose();
+ shell.dispose();
+ }});
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ display.dispose();
+ }});
+ }
+ catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ swtNewtDisplay = null;
+ display = null;
+ shell = null;
+ composite = null;
+ sash = null;
+ }
+
+ class WaitAction implements Runnable {
+ private final long sleepMS;
+
+ WaitAction(long sleepMS) {
+ this.sleepMS = sleepMS;
+ }
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ // blocks on linux .. display.sleep();
+ try {
+ Thread.sleep(sleepMS);
+ } catch (InterruptedException e) { }
+ }
+ }
+ }
+ final WaitAction awtRobotWaitAction = new WaitAction(AWTRobotUtil.TIME_SLICE);
+ final WaitAction generalWaitAction = new WaitAction(10);
+
+ protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException {
+ com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx);
+ final GLWindow glWindow = GLWindow.create(screen, caps);
+ Assert.assertNotNull(glWindow);
+
+ final GearsES2 demo = new GearsES2(1);
+ glWindow.addGLEventListener(demo);
+
+ Animator animator = new Animator();
+ animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
+
+ QuitAdapter quitAdapter = new QuitAdapter();
+ //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
+ //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
+ glWindow.addKeyListener(quitAdapter);
+ glWindow.addWindowListener(quitAdapter);
+
+ glWindow.addWindowListener(new WindowAdapter() {
+ public void windowResized(WindowEvent e) {
+ System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight());
+ }
+ public void windowMoved(WindowEvent e) {
+ System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight());
+ }
+ });
+
+ glWindow.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
+ if(e.getKeyChar()=='f') {
+ new Thread() {
+ public void run() {
+ final Thread t = glWindow.setExclusiveContextThread(null);
+ System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
+ glWindow.setFullscreen(!glWindow.isFullscreen());
+ System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
+ glWindow.setExclusiveContextThread(t);
+ } }.start();
+ }
+ }
+ });
+
+ animator.add(glWindow);
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, null);
+ final NewtCanvasSWT canvas1 = NewtCanvasSWT.create( sash, 0, glWindow );
+ Assert.assertNotNull( canvas1 );
+
+ display.syncExec( new Runnable() {
+ public void run() {
+ shell.setText( getSimpleTestName(".") );
+ shell.setSize( wsize.getWidth(), wsize.getHeight() );
+ if( null != wpos ) {
+ shell.setLocation( wpos.getX(), wpos.getY() );
+ }
+ shell.open();
+ }
+ });
+ Assert.assertTrue("GLWindow didn't become visible natively!", AWTRobotUtil.waitForRealized(glWindow, awtRobotWaitAction, true));
+ Assert.assertNotNull( canvas1.getNativeWindow() );
+
+ System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
+ System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
+ System.err.println("window pos/siz.0: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
+ System.err.println("GLWindow LOS.0: "+glWindow.getLocationOnScreen(null));
+ System.err.println("NewtCanvasSWT LOS.0: "+canvas1.getNativeWindow().getLocationOnScreen(null));
+
+ if( null != rwsize ) {
+ for(int i=0; i<50; i++) { // 500 ms dispatched delay
+ generalWaitAction.run();
+ }
+ display.syncExec( new Runnable() {
+ public void run() {
+ shell.setSize( rwsize.getWidth(), rwsize.getHeight() );
+ }
+ });
+ System.err.println("window resize pos/siz.1: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
+ System.err.println("GLWindow LOS.1: "+glWindow.getLocationOnScreen(null));
+ System.err.println("NewtCanvasSWT LOS.1: "+canvas1.getNativeWindow().getLocationOnScreen(null));
+ }
+
+ final PointImmutable pSashRightClient = new Point(wsize.getWidth(), 0);
+ final PointImmutable pNatWinLOS = canvas1.getNativeWindow().getLocationOnScreen(null);
+ final PointImmutable pGLWinLOS = glWindow.getLocationOnScreen(null);
+
+ System.err.println("GLWindow LOS: "+pGLWinLOS);
+ System.err.println("NewtCanvasSWT LOS: "+pNatWinLOS);
+
+ Assert.assertTrue( "NewtCanvasAWT LOS "+pNatWinLOS+" not >= sash-right "+pSashRightClient, pNatWinLOS.compareTo(pSashRightClient) >= 0 );
+ Assert.assertTrue( "GLWindow LOS "+pGLWinLOS+" not >= sash-right "+pSashRightClient, pGLWinLOS.compareTo(pSashRightClient) >= 0 );
+
+ while( !quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration ) {
+ generalWaitAction.run();
+ }
+
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+ Assert.assertEquals(null, glWindow.getExclusiveContextThread());
+
+ canvas1.dispose();
+ glWindow.destroy();
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ }
+
+ @Test
+ public void test01() throws InterruptedException, InvocationTargetException {
+ final GLProfile glp = GLProfile.getGL2ES2();
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps);
+ }
+
+ public static void main(String args[]) throws IOException {
+ int x=0, y=0, w=640, h=480, rw=-1, rh=-1;
+ boolean usePos = false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-width")) {
+ i++;
+ w = MiscUtils.atoi(args[i], w);
+ } else if(args[i].equals("-height")) {
+ i++;
+ h = MiscUtils.atoi(args[i], h);
+ } else if(args[i].equals("-x")) {
+ i++;
+ x = MiscUtils.atoi(args[i], x);
+ usePos = true;
+ } else if(args[i].equals("-y")) {
+ i++;
+ y = MiscUtils.atoi(args[i], y);
+ usePos = true;
+ } else if(args[i].equals("-rwidth")) {
+ i++;
+ rw = MiscUtils.atoi(args[i], rw);
+ } else if(args[i].equals("-rheight")) {
+ i++;
+ rh = MiscUtils.atoi(args[i], rh);
+ } else if(args[i].equals("-screen")) {
+ i++;
+ screenIdx = MiscUtils.atoi(args[i], 0);
+ }
+ }
+ wsize = new Dimension(w, h);
+ if( 0 < rw && 0 < rh ) {
+ rwsize = new Dimension(rw, rh);
+ }
+
+ if(usePos) {
+ wpos = new Point(x, y);
+ }
+ System.err.println("position "+wpos);
+ System.err.println("size "+wsize);
+ System.err.println("resize "+rwsize);
+ System.err.println("screen "+screenIdx);
+
+ org.junit.runner.JUnitCore.main(TestBug672NewtCanvasSWTSashForm.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java
new file mode 100644
index 0000000..876eafe
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java
@@ -0,0 +1,339 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.swt;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import com.jogamp.nativewindow.swt.SWTAccessor;
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.event.WindowEvent;
+import com.jogamp.newt.event.WindowAdapter;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.swt.NewtCanvasSWT;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import javax.media.nativewindow.util.Dimension;
+import javax.media.nativewindow.util.Point;
+import javax.media.nativewindow.util.PointImmutable;
+import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLProfile;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase {
+ static int screenIdx = 0;
+ static PointImmutable wpos;
+ static DimensionImmutable wsize, rwsize = null;
+
+ static long duration = 500; // ms
+
+ @BeforeClass
+ public static void initClass() {
+ if(null == wsize) {
+ wsize = new Dimension(640, 480);
+ }
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ Display display = null;
+ Shell shell = null;
+ Composite composite = null;
+ SashForm sash = null;
+ Composite innerComposite = null;
+ com.jogamp.newt.Display swtNewtDisplay = null;
+
+ @Before
+ public void init() {
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ display = new Display();
+ Assert.assertNotNull( display );
+ }});
+ display.syncExec(new Runnable() {
+ public void run() {
+ shell = new Shell( display );
+ Assert.assertNotNull( shell );
+ shell.setLayout( new FillLayout() );
+ composite = new Composite( shell, SWT.NONE );
+ composite.setLayout( new FillLayout() );
+ Assert.assertNotNull( composite );
+ sash = new SashForm(composite, SWT.NONE);
+ Assert.assertNotNull( sash );
+ final org.eclipse.swt.widgets.Label c = new org.eclipse.swt.widgets.Label(sash, SWT.NONE);
+ c.setText("Left cell");
+ innerComposite = new Composite(sash, SWT.NONE);
+ Assert.assertNotNull( innerComposite );
+ innerComposite.setLayout( new FillLayout() );
+ }});
+ swtNewtDisplay = NewtFactory.createDisplay(null, false); // no-reuse
+ }
+
+ @After
+ public void release() {
+ Assert.assertNotNull( display );
+ Assert.assertNotNull( shell );
+ Assert.assertNotNull( composite );
+ Assert.assertNotNull( sash );
+ Assert.assertNotNull( innerComposite );
+ try {
+ display.syncExec(new Runnable() {
+ public void run() {
+ innerComposite.dispose();
+ sash.dispose();
+ composite.dispose();
+ shell.dispose();
+ }});
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ display.dispose();
+ }});
+ }
+ catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ swtNewtDisplay = null;
+ display = null;
+ shell = null;
+ composite = null;
+ sash = null;
+ innerComposite = null;
+ }
+
+ class WaitAction implements Runnable {
+ private final long sleepMS;
+
+ WaitAction(long sleepMS) {
+ this.sleepMS = sleepMS;
+ }
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ // blocks on linux .. display.sleep();
+ try {
+ Thread.sleep(sleepMS);
+ } catch (InterruptedException e) { }
+ }
+ }
+ }
+ final WaitAction awtRobotWaitAction = new WaitAction(AWTRobotUtil.TIME_SLICE);
+ final WaitAction generalWaitAction = new WaitAction(10);
+
+ protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException {
+ com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx);
+ final GLWindow glWindow = GLWindow.create(screen, caps);
+ Assert.assertNotNull(glWindow);
+
+ final GearsES2 demo = new GearsES2(1);
+ glWindow.addGLEventListener(demo);
+
+ Animator animator = new Animator();
+ animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
+
+ QuitAdapter quitAdapter = new QuitAdapter();
+ //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
+ //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
+ glWindow.addKeyListener(quitAdapter);
+ glWindow.addWindowListener(quitAdapter);
+
+ glWindow.addWindowListener(new WindowAdapter() {
+ public void windowResized(WindowEvent e) {
+ System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight());
+ }
+ public void windowMoved(WindowEvent e) {
+ System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight());
+ }
+ });
+
+ glWindow.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
+ if(e.getKeyChar()=='f') {
+ new Thread() {
+ public void run() {
+ final Thread t = glWindow.setExclusiveContextThread(null);
+ System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
+ glWindow.setFullscreen(!glWindow.isFullscreen());
+ System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
+ glWindow.setExclusiveContextThread(t);
+ } }.start();
+ }
+ }
+ });
+
+ animator.add(glWindow);
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, null);
+ final NewtCanvasSWT canvas1 = NewtCanvasSWT.create( innerComposite, 0, glWindow );
+ Assert.assertNotNull( canvas1 );
+
+ display.syncExec( new Runnable() {
+ public void run() {
+ shell.setText( getSimpleTestName(".") );
+ shell.setSize( wsize.getWidth(), wsize.getHeight() );
+ if( null != wpos ) {
+ shell.setLocation( wpos.getX(), wpos.getY() );
+ }
+ shell.open();
+ }
+ });
+ Assert.assertTrue("GLWindow didn't become visible natively!", AWTRobotUtil.waitForRealized(glWindow, awtRobotWaitAction, true));
+ Assert.assertNotNull( canvas1.getNativeWindow() );
+
+ System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
+ System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
+ System.err.println("window pos/siz.0: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
+ System.err.println("GLWindow LOS.0: "+glWindow.getLocationOnScreen(null));
+ System.err.println("NewtCanvasSWT LOS.0: "+canvas1.getNativeWindow().getLocationOnScreen(null));
+
+ if( null != rwsize ) {
+ for(int i=0; i<50; i++) { // 500 ms dispatched delay
+ generalWaitAction.run();
+ }
+ display.syncExec( new Runnable() {
+ public void run() {
+ shell.setSize( rwsize.getWidth(), rwsize.getHeight() );
+ }
+ });
+ System.err.println("window resize pos/siz.1: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
+ System.err.println("GLWindow LOS.1: "+glWindow.getLocationOnScreen(null));
+ System.err.println("NewtCanvasSWT LOS.1: "+canvas1.getNativeWindow().getLocationOnScreen(null));
+ }
+
+ final PointImmutable pSashRightClient = new Point(wsize.getWidth(), 0);
+ final PointImmutable pNatWinLOS = canvas1.getNativeWindow().getLocationOnScreen(null);
+ final PointImmutable pGLWinLOS = glWindow.getLocationOnScreen(null);
+
+ System.err.println("GLWindow LOS: "+pGLWinLOS);
+ System.err.println("NewtCanvasSWT LOS: "+pNatWinLOS);
+
+ Assert.assertTrue( "NewtCanvasAWT LOS "+pNatWinLOS+" not >= sash-right "+pSashRightClient, pNatWinLOS.compareTo(pSashRightClient) >= 0 );
+ Assert.assertTrue( "GLWindow LOS "+pGLWinLOS+" not >= sash-right "+pSashRightClient, pGLWinLOS.compareTo(pSashRightClient) >= 0 );
+
+ while( !quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration ) {
+ generalWaitAction.run();
+ }
+
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+ Assert.assertEquals(null, glWindow.getExclusiveContextThread());
+
+ canvas1.dispose();
+ glWindow.destroy();
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ }
+
+ @Test
+ public void test01() throws InterruptedException, InvocationTargetException {
+ final GLProfile glp = GLProfile.getGL2ES2();
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps);
+ }
+
+ public static void main(String args[]) throws IOException {
+ int x=0, y=0, w=640, h=480, rw=-1, rh=-1;
+ boolean usePos = false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-width")) {
+ i++;
+ w = MiscUtils.atoi(args[i], w);
+ } else if(args[i].equals("-height")) {
+ i++;
+ h = MiscUtils.atoi(args[i], h);
+ } else if(args[i].equals("-x")) {
+ i++;
+ x = MiscUtils.atoi(args[i], x);
+ usePos = true;
+ } else if(args[i].equals("-y")) {
+ i++;
+ y = MiscUtils.atoi(args[i], y);
+ usePos = true;
+ } else if(args[i].equals("-rwidth")) {
+ i++;
+ rw = MiscUtils.atoi(args[i], rw);
+ } else if(args[i].equals("-rheight")) {
+ i++;
+ rh = MiscUtils.atoi(args[i], rh);
+ } else if(args[i].equals("-screen")) {
+ i++;
+ screenIdx = MiscUtils.atoi(args[i], 0);
+ }
+ }
+ wsize = new Dimension(w, h);
+ if( 0 < rw && 0 < rh ) {
+ rwsize = new Dimension(rw, rh);
+ }
+
+ if(usePos) {
+ wpos = new Point(x, y);
+ }
+ System.err.println("position "+wpos);
+ System.err.println("size "+wsize);
+ System.err.println("resize "+rwsize);
+ System.err.println("screen "+screenIdx);
+
+ org.junit.runner.JUnitCore.main(TestBug672NewtCanvasSWTSashFormComposite.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java
index 87d4daf..be3a11b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java
@@ -33,13 +33,10 @@ import java.awt.Robot;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.swt.SWT ;
-
import org.eclipse.swt.layout.FillLayout ;
-
import org.eclipse.swt.widgets.Composite ;
import org.eclipse.swt.widgets.Display ;
import org.eclipse.swt.widgets.Shell ;
-
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
@@ -299,6 +296,22 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
shell = null;
composite = null;
}
+ class WaitAction implements Runnable {
+ private final long sleepMS;
+
+ WaitAction(long sleepMS) {
+ this.sleepMS = sleepMS;
+ }
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ // blocks on linux .. display.sleep();
+ try {
+ Thread.sleep(sleepMS);
+ } catch (InterruptedException e) { }
+ }
+ }
+ }
+ final WaitAction awtRobotWaitAction = new WaitAction(AWTRobotUtil.TIME_SLICE);
}
@Test
@@ -334,6 +347,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
dsc.shell.setSize( 400, 450 ) ;
dsc.shell.open() ;
} } );
+ Assert.assertTrue("GLWindow didn't become visible natively!", AWTRobotUtil.waitForRealized(glWindow, dsc.awtRobotWaitAction, true));
AWTRobotUtil.requestFocus(robot, glWindow, false);
AWTRobotUtil.setMouseToClientLocation(robot, glWindow, 50, 50);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
index bcb4629..5426ab7 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.swt;
import javax.media.opengl.GLAutoDrawable;
@@ -39,7 +39,6 @@ import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
@@ -56,6 +55,7 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.swt.NewtCanvasSWT;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -64,14 +64,14 @@ import com.jogamp.opengl.util.texture.TextureIO;
/**
* Tests that a basic SWT app can open without crashing under different GL profiles
- * _and_ custom GLCapabilities.
- * <p>
+ * _and_ custom GLCapabilities.
+ * <p>
* Uses JOGL's NewtCanvasSWT, which allows to be a native container of a NEWT Window.<br/>
* This method allows utilizing custom GLCapability settings,
* independent from the already instantiated SWT visual.
* </p>
* <p>
- * Note that {@link SWTAccessor#invoke(boolean, Runnable)} is still used to comply w/
+ * Note that {@link SWTAccessor#invoke(boolean, Runnable)} is still used to comply w/
* SWT running on Mac OSX, i.e. to enforce UI action on the main thread.
* </p>
*/
@@ -87,7 +87,7 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
Shell shell = null;
Composite composite = null;
com.jogamp.newt.Display swtNewtDisplay = null;
-
+
@BeforeClass
public static void startup() {
System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() );
@@ -96,12 +96,12 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
@Before
public void init() {
SWTAccessor.invoke(true, new Runnable() {
- public void run() {
+ public void run() {
display = new Display();
Assert.assertNotNull( display );
}});
display.syncExec(new Runnable() {
- public void run() {
+ public void run() {
shell = new Shell( display );
Assert.assertNotNull( shell );
shell.setLayout( new FillLayout() );
@@ -138,10 +138,28 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
composite = null;
}
- protected void runTestAGL( GLCapabilitiesImmutable caps, GLEventListener demo,
+ class WaitAction implements Runnable {
+ private final long sleepMS;
+
+ WaitAction(long sleepMS) {
+ this.sleepMS = sleepMS;
+ }
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ // blocks on linux .. display.sleep();
+ try {
+ Thread.sleep(sleepMS);
+ } catch (InterruptedException e) { }
+ }
+ }
+ }
+ final WaitAction awtRobotWaitAction = new WaitAction(AWTRobotUtil.TIME_SLICE);
+ final WaitAction generalWaitAction = new WaitAction(10);
+
+ protected void runTestAGL( GLCapabilitiesImmutable caps, GLEventListener demo,
boolean postAttach, boolean useAnimator ) throws InterruptedException {
final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
-
+
final Screen screen = NewtFactory.createScreen(swtNewtDisplay, 0);
final GLWindow glWindow1 = GLWindow.create(screen, caps);
Assert.assertNotNull(glWindow1);
@@ -151,7 +169,7 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
glWindow1.addGLEventListener(demo);
glWindow1.addGLEventListener(new GLEventListener() {
int displayCount = 0;
- public void init(final GLAutoDrawable drawable) { }
+ 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) {
@@ -159,8 +177,8 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
}
}
public void dispose(final GLAutoDrawable drawable) { }
- });
-
+ });
+
final NewtCanvasSWT canvas1 = NewtCanvasSWT.create( composite, 0, postAttach ? null : glWindow1 );
Assert.assertNotNull( canvas1 );
@@ -171,13 +189,18 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
shell.open();
}
});
-
+
if(postAttach) {
canvas1.setNEWTChild(glWindow1);
}
-
+
+ Assert.assertTrue("GLWindow didn't become visible natively!", AWTRobotUtil.waitForRealized(glWindow1, awtRobotWaitAction, true));
+
+ System.err.println("GLWindow LOS.0: "+glWindow1.getLocationOnScreen(null));
+ System.err.println("NewtCanvasSWT LOS.0: "+canvas1.getNativeWindow().getLocationOnScreen(null));
+
// canvas1.update();
-
+
Animator anim;
if(useAnimator) {
anim = new Animator(glWindow1);
@@ -185,15 +208,12 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
} else {
anim = null;
}
-
+
long lStartTime = System.currentTimeMillis();
long lEndTime = lStartTime + duration;
try {
while( (System.currentTimeMillis() < lEndTime) && !canvas1.isDisposed() ) {
- if( !display.readAndDispatch() ) {
- // blocks on linux .. display.sleep();
- Thread.sleep(10);
- }
+ generalWaitAction.run();
}
} catch( Throwable throwable ) {
throwable.printStackTrace();
@@ -202,7 +222,7 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
if(null != anim) {
anim.stop();
}
-
+
canvas1.dispose();
}
@@ -220,7 +240,7 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
public void postAttach_WithAnimator() throws InterruptedException {
runTestAGL( new GLCapabilities(GLProfile.getGL2ES2()), new GearsES2(), true /* postAttach */, true /* animator */);
}
-
+
@Test
public void test_MultisampleAndAlpha() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
index 72cb219..3dd3a83 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.tile;
import java.awt.BorderLayout;
@@ -81,7 +81,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
static boolean allow600dpi = false;
static GLProfile glp;
static int width, height;
-
+
@BeforeClass
public static void initClass() {
if(GLProfile.isAvailable(GLProfile.GL2)) {
@@ -99,12 +99,13 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
@AfterClass
public static void releaseClass() {
}
-
- protected void runTestGL(GLCapabilities caps, boolean layered) throws InterruptedException, InvocationTargetException {
+
+ protected void runTestGL(GLCapabilities caps, boolean layered, boolean skipGLOrientationVerticalFlip) throws InterruptedException, InvocationTargetException {
final int layerStepX = width/6, layerStepY = height/6;
final Dimension glc_sz = new Dimension(layered ? width - 2*layerStepX : width/2, layered ? height - 2*layerStepY : height);
final GLJPanel glJPanel1 = new GLJPanel(caps);
- Assert.assertNotNull(glJPanel1);
+ Assert.assertNotNull(glJPanel1);
+ glJPanel1.setSkipGLOrientationVerticalFlip(skipGLOrientationVerticalFlip);
glJPanel1.setMinimumSize(glc_sz);
glJPanel1.setPreferredSize(glc_sz);
if( layered ) {
@@ -112,10 +113,15 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
} else {
glJPanel1.setBounds(0, 0, glc_sz.width, glc_sz.height);
}
- glJPanel1.addGLEventListener(new Gears());
-
+ {
+ final Gears demo = new Gears();
+ demo.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
+ glJPanel1.addGLEventListener(demo);
+ }
+
final GLJPanel glJPanel2 = new GLJPanel(caps);
- Assert.assertNotNull(glJPanel2);
+ Assert.assertNotNull(glJPanel2);
+ glJPanel2.setSkipGLOrientationVerticalFlip(skipGLOrientationVerticalFlip);
glJPanel2.setMinimumSize(glc_sz);
glJPanel2.setPreferredSize(glc_sz);
if( layered ) {
@@ -123,9 +129,12 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
} else {
glJPanel2.setBounds(0, 0, glc_sz.width, glc_sz.height);
}
- glJPanel2.addGLEventListener(new RedSquareES1());
- // glJPanel2.addGLEventListener(new Gears());
-
+ {
+ final RedSquareES1 demo = new RedSquareES1();
+ demo.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
+ glJPanel2.addGLEventListener(demo);
+ }
+
final JComponent demoPanel;
if( layered ) {
glJPanel1.setOpaque(true);
@@ -146,10 +155,10 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
demoPanel.add(glJPanel1);
demoPanel.add(glJPanel2);
}
-
+
final JFrame frame = new JFrame("Swing Print");
Assert.assertNotNull(frame);
-
+
final ActionListener print72DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
doPrintManual(frame, 72, 0, -1, -1);
@@ -168,7 +177,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
print300DPIButton.addActionListener(print300DPIAction);
final Button print600DPIButton = new Button("600dpi");
print600DPIButton.addActionListener(print600DPIAction);
-
+
final JPanel printPanel = new JPanel();
printPanel.add(print72DPIButton);
printPanel.add(print300DPIButton);
@@ -179,7 +188,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
eastPanel.add(new Label("East"));
final JPanel westPanel = new JPanel();
westPanel.add(new Label("West"));
-
+
Animator animator = new Animator();
animator.add(glJPanel1);
animator.add(glJPanel2);
@@ -202,12 +211,12 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
frame.pack();
frame.setVisible(true);
} } ) ;
-
+
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel2, true));
-
- animator.setUpdateFPSFrames(60, System.err);
+
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
Assert.assertEquals(true, animator.isAnimating());
@@ -223,7 +232,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
{
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
- }
+ }
{
// No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
@@ -258,7 +267,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
// No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_BGR /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
- }
+ }
{
// No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
@@ -271,7 +280,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
}
}
}
-
+
Assert.assertNotNull(frame);
Assert.assertNotNull(glJPanel1);
Assert.assertNotNull(glJPanel2);
@@ -293,45 +302,85 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
}
@Test
- public void test01_aa0() throws InterruptedException, InvocationTargetException {
+ public void test01_flip1_aa0() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
- runTestGL(caps, false);
+ runTestGL(caps, false, false);
}
-
+
@Test
- public void test01_aa0_layered() throws InterruptedException, InvocationTargetException {
+ public void test01_flip1_aa0_layered() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(8);
- runTestGL(caps, true);
+ runTestGL(caps, true, false);
}
-
+
@Test
- public void test01_aa0_bitmap() throws InterruptedException, InvocationTargetException {
+ public void test01_flip1_aa0_bitmap() throws InterruptedException, InvocationTargetException {
if( Platform.OSType.WINDOWS == Platform.getOSType() ) {
GLCapabilities caps = new GLCapabilities(glp);
caps.setBitmap(true);
- runTestGL(caps, false);
+ runTestGL(caps, false, false);
} // issues w/ AMD catalyst driver and pixmap surface ..
}
-
+
@Test
- public void test01_aa0_bitmap_layered() throws InterruptedException, InvocationTargetException {
+ public void test01_flip1_aa0_bitmap_layered() throws InterruptedException, InvocationTargetException {
if( Platform.OSType.WINDOWS == Platform.getOSType() ) {
GLCapabilities caps = new GLCapabilities(glp);
caps.setBitmap(true);
caps.setAlphaBits(8);
- runTestGL(caps, true);
+ runTestGL(caps, true, false);
} // issues w/ AMD catalyst driver and pixmap surface ..
}
-
+
@Test
- public void test02_aa8() throws InterruptedException, InvocationTargetException {
+ public void test02_flip1_aa8() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
caps.setSampleBuffers(true);
caps.setNumSamples(8);
- runTestGL(caps, false);
+ runTestGL(caps, false, false);
}
-
+
+ @Test
+ public void test11_flip0_aa0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, false, true);
+ }
+
+ @Test
+ public void test11_flip0_aa0_layered() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(8);
+ runTestGL(caps, true, true);
+ }
+
+ @Test
+ public void test11_flip0_aa0_bitmap() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS == Platform.getOSType() ) {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, false, true);
+ } // issues w/ AMD catalyst driver and pixmap surface ..
+ }
+
+ @Test
+ public void test11_flip0_aa0_bitmap_layered() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS == Platform.getOSType() ) {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ caps.setAlphaBits(8);
+ runTestGL(caps, true, true);
+ } // issues w/ AMD catalyst driver and pixmap surface ..
+ }
+
+ @Test
+ public void test12_flip0_aa8() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(8);
+ runTestGL(caps, false, true);
+ }
+
static long duration = 500; // ms
public static void main(String args[]) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
index 2d4973d..29bf8a6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.tile;
import java.awt.BorderLayout;
@@ -77,7 +77,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
static boolean waitForKey = false;
static GLProfile glp;
static int width, height;
-
+
@BeforeClass
public static void initClass() {
if(GLProfile.isAvailable(GLProfile.GL2)) {
@@ -95,16 +95,21 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
@AfterClass
public static void releaseClass() {
}
-
- protected void runTestGL(GLCapabilities caps, final boolean addLayout, boolean layered, boolean useAnim) throws InterruptedException, InvocationTargetException {
+
+ protected void runTestGL(GLCapabilities caps, final boolean addLayout, boolean layered, boolean skipGLOrientationVerticalFlip, boolean useAnim) throws InterruptedException, InvocationTargetException {
final Dimension glc_sz = new Dimension(width, height);
final GLJPanel glJPanel1 = new GLJPanel(caps);
- Assert.assertNotNull(glJPanel1);
+ Assert.assertNotNull(glJPanel1);
+ glJPanel1.setSkipGLOrientationVerticalFlip(skipGLOrientationVerticalFlip);
glJPanel1.setMinimumSize(glc_sz);
glJPanel1.setPreferredSize(glc_sz);
glJPanel1.setBounds(0, 0, glc_sz.width, glc_sz.height);
- glJPanel1.addGLEventListener(new Gears());
-
+ {
+ final Gears demo = new Gears();
+ demo.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
+ glJPanel1.addGLEventListener(demo);
+ }
+
final JComponent tPanel, demoPanel;
if( layered ) {
glJPanel1.setOpaque(true);
@@ -133,13 +138,13 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
demoPanel = new JPanel();
demoPanel.add(glJPanel1);
} else {
- demoPanel = glJPanel1;
+ demoPanel = glJPanel1;
}
}
-
+
final JFrame frame = new JFrame("Swing Print");
Assert.assertNotNull(frame);
-
+
final ActionListener print72DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
doPrintManual(frame, 72, 0, -1, -1);
@@ -158,7 +163,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
print150DPIButton.addActionListener(print150DPIAction);
final Button print300DPIButton = new Button("300dpi");
print300DPIButton.addActionListener(print300DPIAction);
-
+
final JPanel printPanel = new JPanel();
printPanel.add(print72DPIButton);
printPanel.add(print150DPIButton);
@@ -169,7 +174,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
eastPanel.add(new Label("East"));
final JPanel westPanel = new JPanel();
westPanel.add(new Label("West"));
-
+
final Animator animator = useAnim ? new Animator() : null;
if( null != animator ) {
animator.add(glJPanel1);
@@ -181,7 +186,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
- final Container fcont = frame.getContentPane();
+ final Container fcont = frame.getContentPane();
if( addLayout ) {
fcont.setLayout(new BorderLayout());
fcont.add(printPanel, BorderLayout.NORTH);
@@ -201,12 +206,12 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
}
frame.setVisible(true);
} } ) ;
-
+
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true));
-
+
if( null != animator ) {
- animator.setUpdateFPSFrames(60, System.err);
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
Assert.assertEquals(true, animator.isAnimating());
}
@@ -226,11 +231,11 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
}
t1 = System.currentTimeMillis();
}
-
+
Assert.assertNotNull(frame);
Assert.assertNotNull(glJPanel1);
- if( null != animator ) {
+ if( null != animator ) {
animator.stop();
Assert.assertEquals(false, animator.isAnimating());
}
@@ -248,69 +253,133 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
}
@Test
- public void test01_norm_layout0_layered0() throws InterruptedException, InvocationTargetException {
+ public void test001_flip1_norm_layout0_layered0() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
- runTestGL(caps, false /* addLayout */, false /* layered */, false /* useAnim */);
+ runTestGL(caps, false /* addLayout */, false /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */);
}
-
+
@Test
- public void test02_norm_layout1_layered0() throws InterruptedException, InvocationTargetException {
+ public void test002_flip1_norm_layout1_layered0() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
- runTestGL(caps, true /* addLayout */, false /* layered */, false /* useAnim */);
+ runTestGL(caps, true /* addLayout */, false /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */);
}
-
+
@Test
- public void test03_norm_layout0_layered1() throws InterruptedException, InvocationTargetException {
+ public void test003_flip1_norm_layout0_layered1() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
- runTestGL(caps, false /* addLayout */, true /* layered */, false /* useAnim */);
+ runTestGL(caps, false /* addLayout */, true /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */);
}
-
+
@Test
- public void test04_norm_layout1_layered1() throws InterruptedException, InvocationTargetException {
+ public void test004_flip1_norm_layout1_layered1() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
- runTestGL(caps, true /* addLayout */, true /* layered */, false /* useAnim */);
+ runTestGL(caps, true /* addLayout */, true /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */);
}
-
+
@Test
- public void test11_bitm_layout0_layered0() throws InterruptedException, InvocationTargetException {
+ public void test011_flip1_bitm_layout0_layered0() throws InterruptedException, InvocationTargetException {
if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
return;
}
GLCapabilities caps = new GLCapabilities(glp);
caps.setBitmap(true);
- runTestGL(caps, false /* addLayout */, false /* layered */, false /* useAnim */);
+ runTestGL(caps, false /* addLayout */, false /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */);
}
-
+
@Test
- public void test12_bitm_layout1_layered0() throws InterruptedException, InvocationTargetException {
+ public void test012_flip1_bitm_layout1_layered0() throws InterruptedException, InvocationTargetException {
if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
return;
}
GLCapabilities caps = new GLCapabilities(glp);
caps.setBitmap(true);
- runTestGL(caps, true /* addLayout */, false /* layered */, false /* useAnim */);
+ runTestGL(caps, true /* addLayout */, false /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */);
}
-
+
@Test
- public void test13_bitm_layout0_layered1() throws InterruptedException, InvocationTargetException {
+ public void test013_flip1_bitm_layout0_layered1() throws InterruptedException, InvocationTargetException {
if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
return;
}
GLCapabilities caps = new GLCapabilities(glp);
caps.setBitmap(true);
- runTestGL(caps, false /* addLayout */, true /* layered */, false /* useAnim */);
+ runTestGL(caps, false /* addLayout */, true /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */);
}
-
+
@Test
- public void test14_bitm_layout1_layered1() throws InterruptedException, InvocationTargetException {
+ public void test014_flip1_bitm_layout1_layered1() throws InterruptedException, InvocationTargetException {
if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
return;
}
GLCapabilities caps = new GLCapabilities(glp);
caps.setBitmap(true);
- runTestGL(caps, true /* addLayout */, true /* layered */, false /* useAnim */);
+ runTestGL(caps, true /* addLayout */, true /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */);
+ }
+
+ @Test
+ public void test101_flip1_norm_layout0_layered0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, false /* addLayout */, false /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */);
+ }
+
+ @Test
+ public void test102_flip1_norm_layout1_layered0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, true /* addLayout */, false /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */);
+ }
+
+ @Test
+ public void test103_flip1_norm_layout0_layered1() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, false /* addLayout */, true /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */);
}
-
+
+ @Test
+ public void test104_flip1_norm_layout1_layered1() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, true /* addLayout */, true /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */);
+ }
+
+ @Test
+ public void test111_flip1_bitm_layout0_layered0() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, false /* addLayout */, false /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */);
+ }
+
+ @Test
+ public void test112_flip1_bitm_layout1_layered0() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, true /* addLayout */, false /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */);
+ }
+
+ @Test
+ public void test113_flip1_bitm_layout0_layered1() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, false /* addLayout */, true /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */);
+ }
+
+ @Test
+ public void test114_flip1_bitm_layout1_layered1() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, true /* addLayout */, true /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */);
+ }
+
static long duration = 500; // ms
public static void main(String args[]) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java
new file mode 100644
index 0000000..0266566
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java
@@ -0,0 +1,138 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.newt;
+
+
+import java.io.IOException;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestGLWindows03NEWTAnimResize extends UITestCase {
+ static GLProfile glp;
+ static int step = 4;
+ static int width, height;
+ static long durationPerTest = step*500; // ms
+
+ @BeforeClass
+ public static void initClass() {
+ width = 800;
+ height = 600;
+ glp = GLProfile.getDefault();
+ }
+
+ static void test(GLCapabilitiesImmutable caps, boolean undecorated) throws InterruptedException {
+ Assert.assertNotNull(caps);
+
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ final GLWindow glWindow = GLWindow.create(caps);
+
+ glWindow.setUpdateFPSFrames(1, null);
+ Assert.assertNotNull(glWindow);
+ glWindow.setUndecorated(undecorated);
+
+ GLEventListener demo = new GearsES2(1);
+ glWindow.addGLEventListener(demo);
+ glWindow.addWindowListener(new TraceWindowAdapter());
+ Assert.assertEquals(false,glWindow.isNativeValid());
+
+ glWindow.setPosition(100, 100);
+ glWindow.setSize(width/step, height/step);
+ Assert.assertEquals(false,glWindow.isVisible());
+ glWindow.setVisible(true);
+ Assert.assertEquals(true,glWindow.isVisible());
+ Assert.assertEquals(true,glWindow.isNativeValid());
+
+ final Animator animator = new Animator(glWindow);
+ animator.setUpdateFPSFrames(1, null);
+ Assert.assertTrue(animator.start());
+
+ int step_i = 0;
+ for(int i=0; i<durationPerTest; i+=50) {
+ Thread.sleep(50);
+ int j = (int) ( i / (durationPerTest/step) ) + 1;
+ if(j>step_i) {
+ final int w = width/step * j;
+ final int h = height/step * j;
+ System.err.println("resize: "+step_i+" -> "+j+" - "+w+"x"+h);
+ glWindow.setSize(w, h);
+ step_i = j;
+ }
+ }
+ Thread.sleep(50);
+
+ animator.stop();
+ glWindow.destroy();
+ Assert.assertEquals(false, glWindow.isNativeValid());
+ Assert.assertEquals(false, glWindow.isVisible());
+ }
+
+ @Test
+ public void test01WindowDecor() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ test(caps, false /* undecorated */);
+ }
+
+ @Test
+ public void test02WindowUndecor() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ test(caps, true /* undecorated */);
+ }
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atol(args[++i], durationPerTest);
+ }
+ }
+ String tstname = TestGLWindows03NEWTAnimResize.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
index 44d6a2d..a46e21b 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.event ;
import java.io.PrintStream ;
@@ -66,15 +66,15 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
protected static final int MS_ROBOT_KEY_PRESS_DELAY = 50 ;
protected static final int MS_ROBOT_KEY_RELEASE_DELAY = 50 ;
protected static final int MS_ROBOT_MOUSE_MOVE_DELAY = 200 ;
-
- protected static final int MS_ROBOT_AUTO_DELAY = 50 ;
+
+ protected static final int MS_ROBOT_AUTO_DELAY = 50 ;
protected static final int MS_ROBOT_POST_TEST_DELAY = 100;
-
+
protected static final boolean _debug = true ;
protected static PrintStream _debugPrintStream = System.err ;
-
+
////////////////////////////////////////////////////////////////////////////
-
+
static
{
GLProfile.initSingleton() ;
@@ -96,7 +96,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
public synchronized boolean modifierCheckEnabled() {
return _modifierCheckEnabled ;
}
-
+
/**
* Sets the modifiers the listener should expect, and clears
* out any existing accumulated failures. Normally this kind
@@ -108,20 +108,20 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_expectedModifiers = value ;
clear();
}
-
+
public synchronized ArrayList<String> clear() {
ArrayList<String> old = _failures;
-
+
_eventCount = 0;
// Assume we will have a failure due to no event delivery.
// If an event is delivered and it's good this assumed
- // failure will get cleared out.
+ // failure will get cleared out.
_failures = new ArrayList<String>();
_failures.add( NO_EVENT_DELIVERY );
return old;
}
-
+
public ArrayList<String> getFailures(int waitEventCount) {
int j;
for(j=0; j < 20 && _eventCount < waitEventCount; j++) { // wait until events are collected
@@ -132,14 +132,14 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
}
return clear();
}
-
+
private synchronized void _checkModifiers( com.jogamp.newt.event.MouseEvent hasEvent ) {
if( _modifierCheckEnabled ) {
- final MouseEvent expEvent = new MouseEvent(hasEvent.getEventType(), hasEvent.getSource(), hasEvent.getWhen(), _expectedModifiers,
- hasEvent.getX(), hasEvent.getY(), hasEvent.getClickCount(), hasEvent.getButton(),
+ final MouseEvent expEvent = new MouseEvent(hasEvent.getEventType(), hasEvent.getSource(), hasEvent.getWhen(), _expectedModifiers,
+ hasEvent.getX(), hasEvent.getY(), hasEvent.getClickCount(), hasEvent.getButton(),
hasEvent.getRotation(), hasEvent.getRotationScale());
-
+
_checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.SHIFT_MASK, "shift" ) ;
_checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.CTRL_MASK, "ctrl" ) ;
_checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.META_MASK, "meta" ) ;
@@ -180,7 +180,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_eventCount++;
if( _debug ) {
_debugPrintStream.println( "MousePressed "+_eventCount+": "+event);
- }
+ }
_checkModifiers( event ) ;
}
@@ -188,7 +188,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_eventCount++;
if( _debug ) {
_debugPrintStream.println( "MouseReleased "+_eventCount+": "+event);
- }
+ }
_checkModifiers( event ) ;
}
@@ -196,29 +196,29 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_eventCount++;
if( _debug ) {
_debugPrintStream.println( "MouseDragged "+_eventCount+": "+event);
- }
+ }
_checkModifiers( event ) ;
}
//
- // IGNORED
- //
-
- public synchronized void mouseMoved( com.jogamp.newt.event.MouseEvent event ) {
+ // IGNORED
+ //
+
+ public synchronized void mouseMoved( com.jogamp.newt.event.MouseEvent event ) {
// Ignored, since mouse MOVE doesn't hold mouse button, we look for DRAGGED!
// _eventCount++;
if( _debug ) {
_debugPrintStream.println( "MouseMoved ignored: "+event);
- }
+ }
// _checkModifiers( event ) ;
}
-
+
public synchronized void mouseClicked( com.jogamp.newt.event.MouseEvent event ) {
// Ignored, since we look for PRESS/RELEASE only!
// _eventCount++;
if( _debug ) {
_debugPrintStream.println( "MouseClicked ignored: "+event);
- }
+ }
// _checkModifiers( event ) ;
}
@@ -226,23 +226,23 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
// _eventCount++;
if( _debug ) {
_debugPrintStream.println( "MouseWheeleMoved ignored: "+event);
- }
+ }
// _checkModifiers( event ) ;
}
-
+
public synchronized void mouseEntered( com.jogamp.newt.event.MouseEvent event ) {
// _eventCount++;
if( _debug ) {
_debugPrintStream.println( "MouseEntered ignored: "+event);
- }
+ }
// _checkModifiers( event ) ;
}
-
+
public synchronized void mouseExited( com.jogamp.newt.event.MouseEvent event ) {
// _eventCount++;
if( _debug ) {
_debugPrintStream.println( "MouseExited ignored: "+event);
- }
+ }
// _checkModifiers( event ) ;
}
@@ -261,7 +261,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
public static int getAWTButtonMask(int button) {
// Java7: java.awt.event.InputEvent.getMaskForButton( n + 1 ) ; -> using InputEvent.BUTTON1_DOWN_MASK .. etc
- // Java6: Only use BUTTON1_MASK, ..
+ // Java6: Only use BUTTON1_MASK, ..
int m;
switch(button) {
case 1 : m = java.awt.event.InputEvent.BUTTON1_MASK; break;
@@ -271,14 +271,14 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
}
return m;
}
-
+
@BeforeClass
public static void baseBeforeClass() throws Exception {
// Who know how many buttons the AWT will say exist on given platform.
// We'll test the smaller of what NEWT supports and what the
// AWT says is available.
- /** Java7:
+ /** Java7:
if( java.awt.Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled() ) {
_numButtonsToTest = java.awt.MouseInfo.getNumberOfButtons() ;
} else {
@@ -300,7 +300,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_numButtonsToTest = 3 ;
{
- if( _numButtonsToTest > com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) {
+ if( _numButtonsToTest > com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) {
_numButtonsToTest = com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ;
}
@@ -309,10 +309,10 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
// either array.
_awtButtonMasks = new int[_numButtonsToTest] ;
-
+
for( int n = 0 ; n < _awtButtonMasks.length ; ++n ) {
_awtButtonMasks[n] = getAWTButtonMask( n + 1 );
- }
+ }
}
_robot = new java.awt.Robot() ;
@@ -326,23 +326,23 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
// to run the SWT event dispatch on the TK thread - which must be the main thread on OSX.
// We spawn off the actual test-action into another thread,
// while dispatching the events until the test-action is completed.
- // YES: This is sort of ideal - NOT :)
-
- protected void eventDispatch() {
+ // YES: This is sort of ideal - NOT :)
+
+ protected void eventDispatch() {
try {
Thread.sleep(100);
- } catch (InterruptedException e) { }
+ } catch (InterruptedException e) { }
}
-
+
private void execOffThreadWithOnThreadEventDispatch(Runnable testAction) throws Exception {
- _testMouseListener.setModifierCheckEnabled( false ) ;
+ _testMouseListener.setModifierCheckEnabled( false ) ;
_robot.setAutoDelay( MS_ROBOT_AUTO_DELAY ) ;
- {
+ {
// Make sure all the buttons and modifier keys are released.
clearKeyboadAndMouse();
}
_testMouseListener.setModifierCheckEnabled( true ) ;
-
+
Throwable throwable = null;
// final Object sync = new Object();
final RunnableTask rt = new RunnableTask( testAction, null, true, System.err );
@@ -361,13 +361,13 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
throw new RuntimeException(throwable);
}
// }
- } finally {
+ } finally {
System.err.println("WAIT-till-done: DONE");
- _testMouseListener.setModifierCheckEnabled( false ) ;
+ _testMouseListener.setModifierCheckEnabled( false ) ;
clearKeyboadAndMouse();
}
}
-
+
////////////////////////////////////////////////////////////////////////////
// The approach on all these tests is to tell the test mouse listener what
@@ -390,59 +390,59 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
@Test(timeout=180000) // TO 3 min
public void testSingleButtonPressAndRelease() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
- _doSingleButtonPressAndRelease( 0, 0 );
- } catch (Exception e) { throw new RuntimeException(e); }
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
+ _doSingleButtonPressAndRelease( 0, 0 );
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
@Test(timeout=180000) // TO 3 min
public void testSingleButtonPressAndReleaseWithShift() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
_doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_SHIFT, java.awt.event.InputEvent.SHIFT_DOWN_MASK ) ;
- } catch (Exception e) { throw new RuntimeException(e); }
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
@Test(timeout=180000) // TO 3 min
public void testSingleButtonPressAndReleaseWithCtrl() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
_doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_CONTROL, java.awt.event.InputEvent.CTRL_DOWN_MASK ) ;
- } catch (Exception e) { throw new RuntimeException(e); }
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
/**
* The META and ALT tests get too tied up with functions of the window system on X11,
- * so it's probably best to leave them commented out.
+ * so it's probably best to leave them commented out.
@Test(timeout=180000) // TO 3 min
public void testSingleButtonPressAndReleaseWithMeta() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
_doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_META, java.awt.event.InputEvent.META_DOWN_MASK ) ;
- } catch (Exception e) { throw new RuntimeException(e); }
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
-
+
@Test(timeout=180000) // TO 3 min
public void testSingleButtonPressAndReleaseWithAlt() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
_doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_ALT, java.awt.event.InputEvent.ALT_DOWN_MASK ) ;
- } catch (Exception e) { throw new RuntimeException(e); }
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
*/
- /**
+ /**
* FIXME - not sure yet what's up with ALT_GRAPH. It appears that this
* modifier didn't make it through, so I had to disable this test else it would always fail.
*
@@ -450,11 +450,11 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
* enough to not let this modifier slip through (?).
@Test
public void testSingleButtonPressAndReleaseWithAltGraph() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
_doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_ALT_GRAPH, java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK ) ;
- } catch (Exception e) { throw new RuntimeException(e); }
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
*/
@@ -463,31 +463,31 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
@Test(timeout=180000) // TO 3 min
public void testHoldOneButtonAndPressAnother() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
_doHoldOneButtonAndPressAnother( 0, 0 ) ;
- } catch (Exception e) { throw new RuntimeException(e); }
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
-
+
@Test(timeout=180000) // TO 3 min
public void testPressAllButtonsInSequence() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
_doPressAllButtonsInSequence( 0, 0 ) ;
- } catch (Exception e) { throw new RuntimeException(e); }
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
@Test(timeout=180000) // TO 3 min
public void testSingleButtonClickAndDrag() throws Exception {
- execOffThreadWithOnThreadEventDispatch(new Runnable() {
- public void run() {
- try {
+ execOffThreadWithOnThreadEventDispatch(new Runnable() {
+ public void run() {
+ try {
_doSingleButtonClickAndDrag( 0, 0 ) ;
- } catch (Exception e) { throw new RuntimeException(e); }
+ } catch (Exception e) { throw new RuntimeException(e); }
} } );
}
@@ -522,7 +522,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
private void _doHoldOneButtonAndPressAnother( final int keyCode, final int keyModifierMask ) throws Exception {
if( _debug ) { _debugPrintStream.println( "\n>>>> _doHoldOneButtonAndPressAnother" ) ; }
-
+
_doKeyPress( keyCode ) ;
for (int n = 0 ; n < _numButtonsToTest ; ++n) {
@@ -533,7 +533,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask ) ) ;
_robot.mousePress( awtButtonMask ) ;
_checkFailures("mouse-press("+(n+1)+")", 1) ;
-
+
for (int m = 0 ; m < _numButtonsToTest ; ++m) {
if( n != m ) {
@@ -564,12 +564,12 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
private void _doPressAllButtonsInSequence( final int keyCode, final int keyModifierMask ) throws Exception {
if( _debug ) { _debugPrintStream.println( "\n>>>> _doPressAllButtonsInSequence" ) ; }
-
+
_doKeyPress( keyCode ) ;
{
int cumulativeAwtModifiers = 0 ;
-
+
for (int n = 0 ; n < _numButtonsToTest ; ++n) {
cumulativeAwtModifiers |= _awtButtonMasks[n] ;
@@ -586,7 +586,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | cumulativeAwtModifiers ) ) ;
_robot.mouseRelease( _awtButtonMasks[n] ) ;
_checkFailures("mouse-release("+(n+1)+")", 1) ;
-
+
cumulativeAwtModifiers &= ~_awtButtonMasks[n] ;
}
}
@@ -627,7 +627,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_testMouseListener.setModifierCheckEnabled( false ) ;
_robot.mouseMove( INITIAL_MOUSE_X, INITIAL_MOUSE_Y ) ;
- _robot.delay(MS_ROBOT_MOUSE_MOVE_DELAY);
+ _robot.delay(MS_ROBOT_MOUSE_MOVE_DELAY);
_testMouseListener.setModifierCheckEnabled( true ) ;
}
@@ -637,7 +637,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
////////////////////////////////////////////////////////////////////////////
private void _doKeyPress( int keyCode ) {
- AWTRobotUtil.validateAWTEDTIsAlive();
+ AWTRobotUtil.validateAWTEDTIsAlive();
if( keyCode != 0 ) {
boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ;
_testMouseListener.setModifierCheckEnabled( false ) ;
@@ -686,9 +686,9 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
eventDispatch(); eventDispatch(); eventDispatch();
Thread.sleep( MS_ROBOT_POST_TEST_DELAY ) ;
eventDispatch(); eventDispatch(); eventDispatch();
- _testMouseListener.clear();
+ _testMouseListener.clear();
}
-
+
public void clearKeyboadAndMouse() throws Exception {
// Make sure all modifiers are released, otherwise the user's
// desktop can get locked up (ask me how I know this).
@@ -745,7 +745,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
* @return
* The equivalent NEWT modifiers.
*/
-
+
private int _getNewtModifiersForAwtExtendedModifiers( int awtExtendedModifiers ) {
int mask = 0 ;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java
index 4be8192..2516fc5 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java
@@ -186,7 +186,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
3 /* press-SI */, 3 /* release-SI */,
0 /* press-AR */, 0 /* release-AR */ );
- final List<EventObject> queue = keyAdapter.getQueued();
+ final List<EventObject> queue = keyAdapter.copyQueue();
int i=0;
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, 0, keyCode, keyCharOnly);
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, 0, keyCode, keyCharOnly);
@@ -226,7 +226,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
4 /* press-SI */, 4 /* release-SI */,
0 /* press-AR */, 0 /* release-AR */ );
- final List<EventObject> queue = keyAdapter.getQueued();
+ final List<EventObject> queue = keyAdapter.copyQueue();
int i=0;
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, m1m, m1k, KeyEvent.NULL_CHAR);
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, m1m|m2m, m2k, KeyEvent.NULL_CHAR);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java
index 4778b4f..71778c6 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.event;
import org.junit.After;
@@ -60,7 +60,6 @@ import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
-
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.util.NEWTKeyUtil.CodeSeg;
@@ -85,35 +84,35 @@ public class TestNewtKeyCodesAWT extends UITestCase {
@AfterClass
public static void release() {
}
-
+
@Before
- public void initTest() {
+ public void initTest() {
}
@After
- public void releaseTest() {
+ public void releaseTest() {
}
-
+
@Test(timeout=180000) // TO 3 min
public void test01NEWT() throws AWTException, InterruptedException, InvocationTargetException {
GLWindow glWindow = GLWindow.create(glCaps);
glWindow.setSize(width, height);
glWindow.setVisible(true);
-
+
testImpl(glWindow);
-
+
glWindow.destroy();
}
-
+
private void testNewtCanvasAWT_Impl(boolean onscreen) throws AWTException, InterruptedException, InvocationTargetException {
GLWindow glWindow = GLWindow.create(glCaps);
-
+
// Wrap the window in a canvas.
final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow);
if( !onscreen ) {
newtCanvasAWT.setShallUseOffscreenLayer(true);
}
-
+
// Add the canvas to a frame, and make it all visible.
final JFrame frame1 = new JFrame("Swing AWT Parent Frame: "+ glWindow.getTitle());
frame1.getContentPane().add(newtCanvasAWT, BorderLayout.CENTER);
@@ -122,11 +121,11 @@ public class TestNewtKeyCodesAWT extends UITestCase {
frame1.setSize(width, height);
frame1.setVisible(true);
} } );
-
+
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
-
+
testImpl(glWindow);
-
+
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -136,10 +135,10 @@ public class TestNewtKeyCodesAWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
glWindow.destroy();
}
-
+
@Test(timeout=180000) // TO 3 min
public void test02NewtCanvasAWT_Onscreen() throws AWTException, InterruptedException, InvocationTargetException {
if( JAWTUtil.isOffscreenLayerRequired() ) {
@@ -148,7 +147,7 @@ public class TestNewtKeyCodesAWT extends UITestCase {
}
testNewtCanvasAWT_Impl(true);
}
-
+
@Test(timeout=180000) // TO 3 min
public void test03NewtCanvasAWT_Offsccreen() throws AWTException, InterruptedException, InvocationTargetException {
if( !JAWTUtil.isOffscreenLayerSupported() ) {
@@ -157,7 +156,7 @@ public class TestNewtKeyCodesAWT extends UITestCase {
}
testNewtCanvasAWT_Impl(false);
}
-
+
/** Almost all keyCodes reachable w/o modifiers [shift, alt, ..] on US keyboard! */
static CodeSeg[] codeSegments = new CodeSeg[] {
// new CodeSeg(KeyEvent.VK_HOME, KeyEvent.VK_PRINTSCREEN, "home, end, final, prnt"),
@@ -188,16 +187,19 @@ public class TestNewtKeyCodesAWT extends UITestCase {
new CodeSeg(KeyEvent.VK_LEFT, KeyEvent.VK_DOWN, "cursor arrows"),
// new CodeSeg(KeyEvent.VK_WINDOWS, KeyEvent.VK_HELP, "windows, meta, hlp"),
};
-
- static void testKeyCodes(Robot robot, NEWTKeyAdapter keyAdapter) {
+
+ static void testKeyCodes(Robot robot, Object obj, NEWTKeyAdapter keyAdapter) throws InterruptedException, InvocationTargetException {
final List<List<EventObject>> cse = new ArrayList<List<EventObject>>();
-
+
+ keyAdapter.setVerbose(true); // FIXME
+ final int[] objCenter = AWTRobotUtil.getCenterLocation(obj, false /* onTitleBarIfWindow */);
+
for(int i=0; i<codeSegments.length; i++) {
keyAdapter.reset();
final CodeSeg codeSeg = codeSegments[i];
// System.err.println("*** Segment "+codeSeg.description);
int eventCount = 0;
- for(short c=codeSeg.min; c<=codeSeg.max; c++) {
+ for(short c=codeSeg.min; c<=codeSeg.max; c++) {
AWTRobotUtil.waitForIdle(robot);
// System.err.println("*** KeyCode 0x"+Integer.toHexString(c));
try {
@@ -216,15 +218,18 @@ public class TestNewtKeyCodesAWT extends UITestCase {
eventCount++;
}
AWTRobotUtil.waitForIdle(robot);
- for(int j=0; j < 20 && keyAdapter.getQueueSize() < eventCount; j++) { // wait until events are collected
- robot.delay(100);
+ for(int j=0; j < NEWTKeyUtil.POLL_DIVIDER && keyAdapter.getQueueSize() < eventCount; j++) { // wait until events are collected
+ robot.delay(NEWTKeyUtil.TIME_SLICE);
+ // Bug 919 - TestNewtKeyCodesAWT w/ NewtCanvasAWT Fails on Windows Due to Clogged Key-Release Event by AWT Robot
+ final int off = 0==j%2 ? 1 : -1;
+ AWTRobotUtil.awtRobotMouseMove(robot, objCenter[0]+off, objCenter[1]);
}
- final ArrayList<EventObject> events = new ArrayList<EventObject>(keyAdapter.getQueued());
- cse.add(events);
+ AWTRobotUtil.awtRobotMouseMove(robot, objCenter[0], objCenter[1]); // Bug 919: Reset mouse position
+ cse.add(keyAdapter.copyQueue());
}
- Assert.assertEquals("KeyCode impl. incomplete", true, NEWTKeyUtil.validateKeyCodes(codeSegments, cse, true));
+ Assert.assertEquals("KeyCode impl. incomplete", true, NEWTKeyUtil.validateKeyCodes(codeSegments, cse, true));
}
-
+
void testImpl(GLWindow glWindow) throws AWTException, InterruptedException, InvocationTargetException {
final Robot robot = new Robot();
robot.setAutoWaitForIdle(true);
@@ -238,20 +243,20 @@ public class TestNewtKeyCodesAWT extends UITestCase {
glWindow1KA.setVerbose(false);
glWindow.addKeyListener(glWindow1KA);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
// Continuous animation ..
Animator animator = new Animator(glWindow);
animator.start();
Thread.sleep(durationPerTest); // manual testing
-
+
AWTRobotUtil.assertRequestFocusAndWait(null, glWindow, glWindow, null, null); // programmatic
AWTRobotUtil.requestFocus(robot, glWindow, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input
- glWindow1KA.reset();
+ glWindow1KA.reset();
+
+ testKeyCodes(robot, glWindow, glWindow1KA);
- testKeyCodes(robot, glWindow1KA);
-
// Remove listeners to avoid logging during dispose/destroy.
glWindow.removeKeyListener(glWindow1KA);
@@ -276,7 +281,7 @@ public class TestNewtKeyCodesAWT extends UITestCase {
/**
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.err.println("Press enter to continue");
- System.err.println(stdin.readLine());
+ System.err.println(stdin.readLine());
*/
System.out.println("durationPerTest: "+durationPerTest);
String tstname = TestNewtKeyCodesAWT.class.getName();
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java
index 34e81c0..c374f1e 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.event;
import org.junit.After;
@@ -59,12 +59,11 @@ import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
-
import com.jogamp.opengl.test.junit.util.*;
/**
* Testing key event order incl. auto-repeat (Bug 601)
- *
+ *
* <p>
* Note Event order:
* <ol>
@@ -102,33 +101,33 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
@AfterClass
public static void release() {
}
-
+
@Before
- public void initTest() {
+ public void initTest() {
}
@After
- public void releaseTest() {
+ public void releaseTest() {
}
-
+
@Test(timeout=180000) // TO 3 min
public void test01NEWT() throws AWTException, InterruptedException, InvocationTargetException {
GLWindow glWindow = GLWindow.create(glCaps);
glWindow.setSize(width, height);
glWindow.setVisible(true);
-
+
testImpl(glWindow);
-
+
glWindow.destroy();
}
-
+
@Test(timeout=180000) // TO 3 min
public void test02NewtCanvasAWT() throws AWTException, InterruptedException, InvocationTargetException {
GLWindow glWindow = GLWindow.create(glCaps);
-
+
// Wrap the window in a canvas.
final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow);
-
+
// Add the canvas to a frame, and make it all visible.
final JFrame frame1 = new JFrame("Swing AWT Parent Frame: "+ glWindow.getTitle());
frame1.getContentPane().add(newtCanvasAWT, BorderLayout.CENTER);
@@ -137,11 +136,11 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
public void run() {
frame1.setVisible(true);
} } );
-
+
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
-
+
testImpl(glWindow);
-
+
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -151,17 +150,18 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
glWindow.destroy();
}
-
+
static void testKeyEventAutoRepeat(Robot robot, NEWTKeyAdapter keyAdapter, int loops, int pressDurationMS) {
System.err.println("KEY Event Auto-Repeat Test: "+loops);
EventObject[][] first = new EventObject[loops][2];
EventObject[][] last = new EventObject[loops][2];
-
+
keyAdapter.reset();
int firstIdx = 0;
+ // final ArrayList<EventObject> keyEvents = new ArrayList<EventObject>();
for(int i=0; i<loops; i++) {
System.err.println("+++ KEY Event Auto-Repeat START Input Loop: "+i);
AWTRobotUtil.waitForIdle(robot);
@@ -170,36 +170,36 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
AWTRobotUtil.waitForIdle(robot);
final int minCodeCount = firstIdx + 2;
final int desiredCodeCount = firstIdx + 4;
- for(int j=0; j < 10 && keyAdapter.getQueueSize() < desiredCodeCount; j++) { // wait until events are collected
- robot.delay(100);
+ for(int j=0; j < NEWTKeyUtil.POLL_DIVIDER && keyAdapter.getQueueSize() < desiredCodeCount; j++) { // wait until events are collected
+ robot.delay(NEWTKeyUtil.TIME_SLICE);
}
- Assert.assertTrue("AR Test didn't collect enough key events: required min "+minCodeCount+", received "+(keyAdapter.getQueueSize()-firstIdx)+", "+keyAdapter.getQueued(),
+ final List<EventObject> keyEvents = keyAdapter.copyQueue();
+ Assert.assertTrue("AR Test didn't collect enough key events: required min "+minCodeCount+", received "+(keyAdapter.getQueueSize()-firstIdx)+", "+keyEvents,
keyAdapter.getQueueSize() >= minCodeCount );
- final List<EventObject> keyEvents = keyAdapter.getQueued();
- first[i][0] = (KeyEvent) keyEvents.get(firstIdx+0);
- first[i][1] = (KeyEvent) keyEvents.get(firstIdx+1);
+ first[i][0] = keyEvents.get(firstIdx+0);
+ first[i][1] = keyEvents.get(firstIdx+1);
firstIdx = keyEvents.size() - 2;
- last[i][0] = (KeyEvent) keyEvents.get(firstIdx+0);
- last[i][1] = (KeyEvent) keyEvents.get(firstIdx+1);
+ last[i][0] = keyEvents.get(firstIdx+0);
+ last[i][1] = keyEvents.get(firstIdx+1);
System.err.println("+++ KEY Event Auto-Repeat END Input Loop: "+i);
-
+
// add a pair of normal press/release in between auto-repeat!
firstIdx = keyEvents.size();
AWTRobotUtil.waitForIdle(robot);
AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_B, 10);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_B, 250);
AWTRobotUtil.waitForIdle(robot);
- for(int j=0; j < 20 && keyAdapter.getQueueSize() < firstIdx+3; j++) { // wait until events are collected
- robot.delay(100);
+ for(int j=0; j < NEWTKeyUtil.POLL_DIVIDER && keyAdapter.getQueueSize() < firstIdx+2; j++) { // wait until events are collected
+ robot.delay(NEWTKeyUtil.TIME_SLICE);
}
- firstIdx = keyEvents.size();
+ firstIdx = keyAdapter.getQueueSize();
}
// dumpKeyEvents(keyEvents);
- final List<EventObject> keyEvents = keyAdapter.getQueued();
+ final List<EventObject> keyEvents = keyAdapter.copyQueue();
NEWTKeyUtil.validateKeyEventOrder(keyEvents);
-
+
final boolean hasAR = 0 < keyAdapter.getKeyPressedCount(true) ;
-
+
{
final int perLoopSI = 2; // per loop: 1 non AR event and 1 for non AR 'B'
final int expSI, expAR;
@@ -208,48 +208,48 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
expAR = ( keyEvents.size() - expSI*2 ) / 2; // auto-repeat release
} else {
expSI = keyEvents.size() / 2; // all released events
- expAR = 0;
+ expAR = 0;
}
-
- NEWTKeyUtil.validateKeyAdapterStats(keyAdapter,
- expSI /* press-SI */, expSI /* release-SI */,
- expAR /* press-AR */, expAR /* release-AR */ );
+
+ NEWTKeyUtil.validateKeyAdapterStats(keyAdapter,
+ expSI /* press-SI */, expSI /* release-SI */,
+ expAR /* press-AR */, expAR /* release-AR */ );
}
-
+
if( !hasAR ) {
System.err.println("No AUTO-REPEAT triggered by AWT Robot .. aborting test analysis");
return;
}
-
+
for(int i=0; i<loops; i++) {
System.err.println("Auto-Repeat Loop "+i+" - Head:");
NEWTKeyUtil.dumpKeyEvents(Arrays.asList(first[i]));
System.err.println("Auto-Repeat Loop "+i+" - Tail:");
NEWTKeyUtil.dumpKeyEvents(Arrays.asList(last[i]));
- }
+ }
for(int i=0; i<loops; i++) {
KeyEvent e = (KeyEvent) first[i][0];
Assert.assertTrue("1st Shall be A, but is "+e, KeyEvent.VK_A == e.getKeyCode() );
Assert.assertTrue("1st Shall be PRESSED, but is "+e, KeyEvent.EVENT_KEY_PRESSED == e.getEventType() );
Assert.assertTrue("1st Shall not be AR, but is "+e, 0 == ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) );
-
+
e = (KeyEvent) first[i][1];
Assert.assertTrue("2nd Shall be A, but is "+e, KeyEvent.VK_A == e.getKeyCode() );
Assert.assertTrue("2nd Shall be RELEASED, but is "+e, KeyEvent.EVENT_KEY_RELEASED == e.getEventType() );
Assert.assertTrue("2nd Shall be AR, but is "+e, 0 != ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) );
-
+
e = (KeyEvent) last[i][0];
Assert.assertTrue("last-1 Shall be A, but is "+e, KeyEvent.VK_A == e.getKeyCode() );
Assert.assertTrue("last-1 Shall be PRESSED, but is "+e, KeyEvent.EVENT_KEY_PRESSED == e.getEventType() );
Assert.assertTrue("last-1 Shall be AR, but is "+e, 0 != ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) );
-
+
e = (KeyEvent) last[i][1];
Assert.assertTrue("last-0 Shall be A, but is "+e, KeyEvent.VK_A == e.getKeyCode() );
Assert.assertTrue("last-2 Shall be RELEASED, but is "+e, KeyEvent.EVENT_KEY_RELEASED == e.getEventType() );
Assert.assertTrue("last-0 Shall not be AR, but is "+e, 0 == ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) );
}
}
-
+
void testImpl(GLWindow glWindow) throws AWTException, InterruptedException, InvocationTargetException {
final Robot robot = new Robot();
robot.setAutoWaitForIdle(true);
@@ -261,29 +261,29 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
glWindow1KA.setVerbose(false);
glWindow.addKeyListener(glWindow1KA);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
// Continuous animation ..
Animator animator = new Animator(glWindow);
animator.start();
Thread.sleep(durationPerTest); // manual testing
-
+
AWTRobotUtil.assertRequestFocusAndWait(null, glWindow, glWindow, null, null); // programmatic
AWTRobotUtil.requestFocus(robot, glWindow, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input
glWindow1KA.reset();
- //
+ //
// Test the key event order w/ auto-repeat
//
final int origAutoDelay = robot.getAutoDelay();
robot.setAutoDelay(10);
try {
testKeyEventAutoRepeat(robot, glWindow1KA, 3, 1000);
- } finally {
+ } finally {
robot.setAutoDelay(origAutoDelay);
}
-
+
// Remove listeners to avoid logging during dispose/destroy.
glWindow.removeKeyListener(glWindow1KA);
@@ -308,7 +308,7 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
/**
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.err.println("Press enter to continue");
- System.err.println(stdin.readLine());
+ System.err.println(stdin.readLine());
*/
System.out.println("durationPerTest: "+durationPerTest);
String tstname = TestNewtKeyEventAutoRepeatAWT.class.getName();
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
index 23de0e9..8cc4275 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
@@ -190,7 +190,7 @@ public class TestNewtKeyEventOrderAWT extends UITestCase {
robot.delay(250);
// dumpKeyEvents(keyAdapter.getQueued());
- NEWTKeyUtil.validateKeyEventOrder(keyAdapter.getQueued());
+ NEWTKeyUtil.validateKeyEventOrder(keyAdapter.copyQueue());
final int expTotal = 6*loops; // all typed events
NEWTKeyUtil.validateKeyAdapterStats(keyAdapter,
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java
similarity index 91%
rename from src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java
rename to src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java
index 5f37023..d3c29cf 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,13 +20,13 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
-package com.jogamp.opengl.test.junit.newt;
+
+package com.jogamp.opengl.test.junit.newt.event;
import org.junit.Assert;
import org.junit.AfterClass;
@@ -55,20 +55,20 @@ import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
-
+import com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT;
import com.jogamp.opengl.test.junit.util.*;
/**
- * Testing focus traversal of an AWT component tree with {@link NewtCanvasAWT} attached.
- * <p>
- * {@link JFrame} . {@link Container}+ . {@link NewtCanvasAWT} . {@link GLWindow}
+ * Testing focus <i>mouse-click</i> and <i>programmatic</i> traversal of an AWT component tree with {@link NewtCanvasAWT} attached.
+ * <p>
+ * {@link JFrame} . {@link Container}+ [ Button*, {@link NewtCanvasAWT} . {@link GLWindow} ]
* </p>
* <p>
- * <i>+ Container is the JFrame's implicit root content pane</i><br/>
+ * <i>+ Container is the JFrame's implicit root content pane</i><br/>
* </p>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestFocus01SwingAWTRobot extends UITestCase {
+public class TestParentingFocus01SwingAWTRobot extends UITestCase {
static int width, height;
static long durationPerTest = 10;
static long awtWaitTimeout = 1000;
@@ -119,7 +119,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
// Wrap the window in a canvas.
final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
// newtCanvasAWT.setShallUseOffscreenLayer(true);
-
+
// Monitor AWT focus and keyboard events.
AWTKeyAdapter newtCanvasAWTKA = new AWTKeyAdapter("NewtCanvasAWT");
newtCanvasAWT.addKeyListener(newtCanvasAWTKA);
@@ -140,7 +140,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
AWTMouseAdapter buttonMA = new AWTMouseAdapter("Button");
button.addMouseListener(buttonMA);
eventCountAdapters.add(buttonMA);
-
+
frame1.getContentPane().add(button, BorderLayout.NORTH);
frame1.setSize(width, height);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
@@ -148,12 +148,12 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
frame1.setVisible(true);
} } );
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
AWTRobotUtil.clearAWTFocus(robot);
Assert.assertTrue(AWTRobotUtil.toFrontAndRequestFocus(robot, frame1));
Thread.sleep(durationPerTest); // manual testing
-
+
int wait=0;
while(wait<awtWaitTimeout/100 && glWindow1.getTotalFPSFrames()<1) { Thread.sleep(awtWaitTimeout/10); wait++; }
System.err.println("Frames for initial setVisible(true): "+glWindow1.getTotalFPSFrames());
@@ -166,7 +166,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
// Button Focus
Thread.sleep(200); // allow event sync
-
+
System.err.println("FOCUS AWT Button request");
EventCountAdapterUtil.reset(eventCountAdapters);
AWTRobotUtil.assertRequestFocusAndWait(robot, button, button, buttonFA, null); // OSX sporadically button did not gain - major UI failure
@@ -174,9 +174,9 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
Assert.assertEquals(false, newtCanvasAWTFA.focusGained());
System.err.println("FOCUS AWT Button sync");
AWTRobotUtil.assertKeyType(robot, java.awt.event.KeyEvent.VK_A, 2, button, buttonKA);
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
button, buttonMA);
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
button, buttonMA);
// Request the AWT focus, which should automatically provide the NEWT window with focus.
@@ -186,14 +186,17 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
AWTRobotUtil.assertRequestFocusAndWait(robot, newtCanvasAWT, newtCanvasAWT.getNEWTChild(), glWindow1FA, buttonFA); // OSX sporadically button did not loose - minor UI failure
// Manually tested on Java7/[Linux,Windows] (where this assertion failed),
// Should be OK to have the AWT component assume it also has the focus.
- // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA,
+ // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA,
// AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA));
if( !AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) {
System.err.println("Info: Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA);
}
System.err.println("FOCUS NEWT Canvas/GLWindow sync");
AWTRobotUtil.assertKeyType(robot, java.awt.event.KeyEvent.VK_A, 2, glWindow1, glWindow1KA);
- Assert.assertEquals("AWT parent canvas received keyboard events", 0, newtCanvasAWTKA.getCount());
+ Assert.assertEquals("AWT parent canvas received non consumed keyboard events", newtCanvasAWTKA.getConsumedCount(), newtCanvasAWTKA.getCount());
+ if( !newtCanvasAWT.isAWTEventPassThrough() ) {
+ Assert.assertEquals("AWT parent canvas received consumed keyboard events", 0, newtCanvasAWTKA.getConsumedCount());
+ }
// Remove listeners to avoid logging during dispose/destroy.
glWindow1.removeKeyListener(glWindow1KA);
@@ -212,7 +215,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
glWindow1.destroy();
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, false));
}
@@ -234,10 +237,10 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
/**
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.err.println("Press enter to continue");
- System.err.println(stdin.readLine());
+ System.err.println(stdin.readLine());
*/
System.out.println("durationPerTest: "+durationPerTest);
- String tstname = TestFocus01SwingAWTRobot.class.getName();
+ String tstname = TestParentingFocus01SwingAWTRobot.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java
similarity index 87%
rename from src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java
rename to src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java
index 1c1ba90..edf82ca 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,13 +20,13 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
-package com.jogamp.opengl.test.junit.newt;
+
+package com.jogamp.opengl.test.junit.newt.event;
import java.lang.reflect.*;
@@ -59,16 +59,16 @@ import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
/**
- * Testing focus traversal of an AWT component tree with {@link NewtCanvasAWT} attached.
- * <p>
- * {@link JFrame} . {@link JPanel}+ . {@link Container} . {@link NewtCanvasAWT} . {@link GLWindow}
+ * Testing focus <i>mouse-click</i> and <i>programmatic</i> traversal of an AWT component tree with {@link NewtCanvasAWT} attached.
+ * <p>
+ * {@link JFrame} . {@link JPanel}+ . {@link Container} [ Button*, {@link NewtCanvasAWT} . {@link GLWindow} ]
* </p>
* <p>
- * <i>+ JPanel is set as JFrame's root content pane</i><br/>
+ * <i>+ JPanel is set as JFrame's root content pane</i><br/>
* </p>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestFocus02SwingAWTRobot extends UITestCase {
+public class TestParentingFocus02SwingAWTRobot extends UITestCase {
static int width, height;
static long durationPerTest = 10;
static long awtWaitTimeout = 1000;
@@ -96,8 +96,8 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
@AfterClass
public static void release() {
}
-
- private void testFocus01ProgrFocusImpl(Robot robot)
+
+ private void testFocus01ProgrFocusImpl(Robot robot)
throws AWTException, InterruptedException, InvocationTargetException {
ArrayList<EventCountAdapter> eventCountAdapters = new ArrayList<EventCountAdapter>();
@@ -169,7 +169,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
jFrame1.setVisible(true);
} } );
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(jFrame1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
AWTRobotUtil.clearAWTFocus(robot);
Assert.assertTrue(AWTRobotUtil.toFrontAndRequestFocus(robot, jFrame1));
@@ -184,7 +184,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
animator1.start();
Thread.sleep(durationPerTest); // manual testing
-
+
// Button Outer Focus
Thread.sleep(100); // allow event sync
System.err.println("FOCUS AWT Button Outer request");
@@ -195,10 +195,10 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
Assert.assertEquals(false, buttonNorthInnerFA.focusGained());
System.err.println("FOCUS AWT Button Outer sync");
AWTRobotUtil.assertKeyType(robot, java.awt.event.KeyEvent.VK_A, 2, buttonNorthOuter, buttonNorthOuterKA); // OSX sporadically won't receive the keyboard input - major UI failure
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ buttonNorthOuter, buttonNorthOuterMA);
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
buttonNorthOuter, buttonNorthOuterMA);
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
- buttonNorthOuter, buttonNorthOuterMA);
// NEWT Focus
Thread.sleep(100); // allow event sync
@@ -207,7 +207,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
AWTRobotUtil.assertRequestFocusAndWait(robot, newtCanvasAWT, newtCanvasAWT.getNEWTChild(), glWindow1FA, buttonNorthOuterFA);
// Manually tested on Java7/[Linux,Windows] (where this assertion failed),
// Should be OK to have the AWT component assume it also has the focus.
- // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA,
+ // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA,
// AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA));
if( !AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) {
System.err.println("Info: Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA);
@@ -215,12 +215,15 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
Assert.assertEquals(false, buttonNorthInnerFA.focusGained());
System.err.println("FOCUS NEWT Canvas/GLWindow sync");
AWTRobotUtil.assertKeyType(robot, java.awt.event.KeyEvent.VK_A, 2, glWindow1, glWindow1KA);
- Assert.assertEquals("AWT parent canvas received keyboard events", 0, newtCanvasAWTKA.getCount());
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ Assert.assertEquals("AWT parent canvas received non consumed keyboard events", newtCanvasAWTKA.getConsumedCount(), newtCanvasAWTKA.getCount());
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
glWindow1, glWindow1MA);
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
glWindow1, glWindow1MA);
- Assert.assertEquals("AWT parent canvas received mouse events", 0, newtCanvasAWTMA.getCount());
+ if( !newtCanvasAWT.isAWTEventPassThrough() ) {
+ Assert.assertEquals("AWT parent canvas received consumed keyboard events", 0, newtCanvasAWTKA.getConsumedCount());
+ Assert.assertEquals("AWT parent canvas received mouse events", 0, newtCanvasAWTMA.getCount());
+ }
// Button Inner Focus
Thread.sleep(100); // allow event sync
@@ -232,9 +235,9 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
Assert.assertEquals(false, buttonNorthOuterFA.focusGained());
System.err.println("FOCUS AWT Button sync");
AWTRobotUtil.assertKeyType(robot, java.awt.event.KeyEvent.VK_A, 2, buttonNorthInner, buttonNorthInnerKA);
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
buttonNorthInner, buttonNorthInnerMA);
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
buttonNorthInner, buttonNorthInnerMA);
// NEWT Focus
@@ -244,21 +247,24 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
AWTRobotUtil.assertRequestFocusAndWait(robot, newtCanvasAWT, newtCanvasAWT.getNEWTChild(), glWindow1FA, buttonNorthInnerFA);
// Manually tested on Java7/[Linux,Windows] (where this assertion failed),
// Should be OK to have the AWT component assume it also has the focus.
- // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA,
+ // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA,
// AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA));
if( !AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) {
System.err.println("Info: Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA);
}
-
+
Assert.assertEquals(false, buttonNorthOuterFA.focusGained());
System.err.println("FOCUS NEWT Canvas/GLWindow sync");
AWTRobotUtil.assertKeyType(robot, java.awt.event.KeyEvent.VK_A, 2, glWindow1, glWindow1KA);
- Assert.assertEquals("AWT parent canvas received keyboard events", 0, newtCanvasAWTKA.getCount());
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ Assert.assertEquals("AWT parent canvas received non consumed keyboard events", newtCanvasAWTKA.getConsumedCount(), newtCanvasAWTKA.getCount());
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
glWindow1, glWindow1MA);
- AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
+ AWTRobotUtil.assertMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
glWindow1, glWindow1MA);
- Assert.assertEquals("AWT parent canvas received mouse events", 0, newtCanvasAWTMA.getCount());
+ if( !newtCanvasAWT.isAWTEventPassThrough() ) {
+ Assert.assertEquals("AWT parent canvas received consumed keyboard events", 0, newtCanvasAWTKA.getConsumedCount());
+ Assert.assertEquals("AWT parent canvas received mouse events", 0, newtCanvasAWTMA.getCount());
+ }
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
@@ -295,8 +301,8 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
}
@SuppressWarnings("unused")
- public static void main(String args[])
- throws IOException, AWTException, InterruptedException, InvocationTargetException
+ public static void main(String args[])
+ throws IOException, AWTException, InterruptedException, InvocationTargetException
{
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -304,14 +310,14 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
}
}
if(true) {
- String tstname = TestFocus02SwingAWTRobot.class.getName();
+ String tstname = TestParentingFocus02SwingAWTRobot.class.getName();
org.junit.runner.JUnitCore.main(tstname);
- } else {
- TestFocus02SwingAWTRobot.initClass();
- TestFocus02SwingAWTRobot test = new TestFocus02SwingAWTRobot();
+ } else {
+ TestParentingFocus02SwingAWTRobot.initClass();
+ TestParentingFocus02SwingAWTRobot test = new TestParentingFocus02SwingAWTRobot();
test.testFocus01ProgrFocus();
test.testFocus02RobotFocus();
- TestFocus02SwingAWTRobot.release();
+ TestParentingFocus02SwingAWTRobot.release();
}
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java
similarity index 86%
rename from src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java
rename to src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java
index ff54040..71cc3fc 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,13 +20,13 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
-package com.jogamp.opengl.test.junit.newt.parenting;
+
+package com.jogamp.opengl.test.junit.newt.event;
import java.lang.reflect.*;
import java.util.HashSet;
@@ -63,9 +63,16 @@ import jogamp.newt.driver.DriverClearFocus;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter;
+/**
+ * Testing focus <i>key</i> traversal of an AWT component tree with {@link NewtCanvasAWT} attached.
+ * <p>
+ * {@link Frame} [ Button*, {@link NewtCanvasAWT} . {@link GLWindow} ]
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestParentingFocusTraversal01AWT extends UITestCase {
+public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
static Dimension glSize, fSize;
static int numFocus = 8;
static long durationPerTest = numFocus * 200;
@@ -92,22 +99,22 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
public void testWindowParentingAWTFocusTraversal(boolean onscreen) throws InterruptedException, InvocationTargetException, AWTException {
Robot robot = new Robot();
-
+
// Bug 4908075 - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4908075
// Bug 6463168 - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6463168
{
final KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
- final Set<AWTKeyStroke> bwdKeys = kfm.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
+ final Set<AWTKeyStroke> bwdKeys = kfm.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
final AWTKeyStroke newBack = AWTKeyStroke.getAWTKeyStroke(java.awt.event.KeyEvent.VK_BACK_SPACE, 0, false);
Assert.assertNotNull(newBack);
- final Set<AWTKeyStroke> bwdKeys2 = new HashSet<AWTKeyStroke>(bwdKeys);
+ final Set<AWTKeyStroke> bwdKeys2 = new HashSet<AWTKeyStroke>(bwdKeys);
bwdKeys2.add(newBack);
kfm.setDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, bwdKeys2);
}
{
final KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
- final Set<AWTKeyStroke> fwdKeys = kfm.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
- final Set<AWTKeyStroke> bwdKeys = kfm.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
+ final Set<AWTKeyStroke> fwdKeys = kfm.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
+ final Set<AWTKeyStroke> bwdKeys = kfm.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
Iterator<AWTKeyStroke> iter;
for(iter = fwdKeys.iterator(); iter.hasNext(); ) {
System.err.println("FTKL.fwd-keys: "+iter.next());
@@ -116,7 +123,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
System.err.println("FTKL.bwd-keys: "+iter.next());
}
}
-
+
final Frame frame1 = new Frame("AWT Parent Frame");
final Button cWest = new Button("WEST");
final Button cEast = new Button("EAST");
@@ -134,7 +141,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
cWest.addFocusListener(bWestFA);
AWTFocusAdapter bEastFA = new AWTFocusAdapter("EAST");
cEast.addFocusListener(bEastFA);
-
+
// Test KeyAdapter
NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1");
glWindow1.addKeyListener(glWindow1KA);
@@ -142,7 +149,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
cWest.addKeyListener(bWestKA);
AWTKeyAdapter bEastKA = new AWTKeyAdapter("East");
cEast.addKeyListener(bEastKA);
-
+
// demo ..
GLEventListener demo1 = new GearsES2(1);
setDemoFields(demo1, glWindow1, false);
@@ -152,32 +159,32 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
public void keyReleased(KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
- }
- if(e.getKeyChar()=='c') {
+ }
+ if(e.getKeyChar()=='c') {
System.err.println("Focus Clear");
if(glWindow1.getDelegatedWindow() instanceof DriverClearFocus) {
((DriverClearFocus)glWindow1.getDelegatedWindow()).clearFocus();
}
- } else if(e.getKeyChar()=='e') {
+ } else if(e.getKeyChar()=='e') {
System.err.println("Focus East");
try {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
cEast.requestFocusInWindow();
- }
+ }
});
} catch (Exception ex) { ex.printStackTrace(); }
- } else if(e.getKeyChar()=='w') {
+ } else if(e.getKeyChar()=='w') {
System.err.println("Focus West");
try {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
cWest.requestFocusInWindow();
- }
+ }
});
} catch (Exception ex) { ex.printStackTrace(); }
}
- }
+ }
});
GLAnimatorControl animator1 = new Animator(glWindow1);
animator1.start();
@@ -193,7 +200,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
public void run() {
frame1.setLocation(0, 0);
frame1.setSize(fSize);
- frame1.validate();
+ frame1.validate();
frame1.setVisible(true);
}});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, true));
@@ -201,88 +208,96 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
Assert.assertEquals(newtCanvasAWT1.getNativeWindow(),glWindow1.getParent());
AWTRobotUtil.clearAWTFocus(robot);
Assert.assertTrue(AWTRobotUtil.toFrontAndRequestFocus(robot, frame1));
-
+
Assert.assertEquals(true, animator1.isAnimating());
// Assert.assertEquals(false, animator1.isPaused());
Assert.assertNotNull(animator1.getThread());
-
+
if(manual) {
- Thread.sleep(durationPerTest);
+ Thread.sleep(durationPerTest);
} else {
//
// initial focus on bWest
- //
+ //
AWTRobotUtil.assertRequestFocusAndWait(robot, cWest, cWest, bWestFA, null);
Thread.sleep(durationPerTest/numFocus);
-
+
//
// forth
//
-
+
// bWest -> glWin
AWTRobotUtil.keyType(0, robot, java.awt.event.KeyEvent.VK_TAB, cWest, null);
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
Assert.assertEquals(true, glWindow1FA.focusGained());
Assert.assertEquals(true, bWestFA.focusLost());
Thread.sleep(durationPerTest/numFocus);
-
+
// glWin -> bEast
AWTRobotUtil.keyType(0, robot, java.awt.event.KeyEvent.VK_TAB, glWindow1, null);
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cEast, bEastFA, glWindow1FA));
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cEast, bEastFA, glWindow1FA));
Assert.assertEquals(true, bEastFA.focusGained());
Assert.assertEquals(true, glWindow1FA.focusLost());
Thread.sleep(durationPerTest/numFocus);
-
+
//
// back (using custom back traversal key 'backspace')
//
// bEast -> glWin
AWTRobotUtil.keyType(0, robot, java.awt.event.KeyEvent.VK_BACK_SPACE, cEast, null);
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bEastFA));
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bEastFA));
Assert.assertEquals(true, glWindow1FA.focusGained());
Assert.assertEquals(true, bEastFA.focusLost());
Thread.sleep(durationPerTest/numFocus);
-
+
AWTRobotUtil.keyType(0, robot, java.awt.event.KeyEvent.VK_BACK_SPACE, glWindow1, null);
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA));
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA));
Assert.assertEquals(true, bWestFA.focusGained());
Assert.assertEquals(true, glWindow1FA.focusLost());
- Thread.sleep(durationPerTest/numFocus);
-
+ Thread.sleep(durationPerTest/numFocus);
+
System.err.println("Test: Direct NewtCanvasAWT focus");
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
newtCanvasAWT1.requestFocus();
- }
+ }
});
- } catch (Exception ex) { ex.printStackTrace(); }
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
+ } catch (Exception ex) { ex.printStackTrace(); }
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
Assert.assertEquals(true, glWindow1FA.focusGained());
Assert.assertEquals(true, bWestFA.focusLost());
Thread.sleep(durationPerTest/numFocus);
-
+
System.err.println("Test: Direct AWT Button-West focus");
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
cWest.requestFocus();
- }
+ }
});
- } catch (Exception ex) { ex.printStackTrace(); }
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA));
+ } catch (Exception ex) { ex.printStackTrace(); }
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA));
Assert.assertEquals(true, bWestFA.focusGained());
Assert.assertEquals(true, glWindow1FA.focusLost());
Thread.sleep(durationPerTest/numFocus);
-
+
System.err.println("Test: Direct NEWT-Child request focus");
glWindow1.requestFocus();
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
+ {
+ // Short: Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
+ // More verbose:
+ final boolean ok = AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA);
+ System.err.println("glWindow hasFocus "+glWindow1.hasFocus());
+ System.err.println("glWindow1FA "+glWindow1FA);
+ System.err.println("bWestFA "+bWestFA);
+ Assert.assertTrue("Did not gain focus", ok);
+ }
Assert.assertEquals(true, glWindow1FA.focusGained());
Assert.assertEquals(true, bWestFA.focusLost());
- Thread.sleep(durationPerTest/numFocus);
+ Thread.sleep(durationPerTest/numFocus);
}
-
+
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
Assert.assertEquals(false, animator1.isPaused());
@@ -326,7 +341,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
forceGL3 = true;
}
}
- String tstname = TestParentingFocusTraversal01AWT.class.getName();
+ String tstname = TestParentingFocus03KeyTraversalAWT.class.getName();
/*
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
tstname,
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
index 4bf1f95..f7fbc73 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -42,24 +42,24 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
final NewtCanvasAWT newtCanvasAWT;
final GLWindow glWindow;
final QuitAdapter quitAdapter;
-
+
public NewtAWTReparentingKeyAdapter(Frame frame, NewtCanvasAWT newtCanvasAWT, GLWindow glWindow, QuitAdapter quitAdapter) {
this.frame = frame;
this.newtCanvasAWT = newtCanvasAWT;
this.glWindow = glWindow;
this.quitAdapter = quitAdapter;
}
-
+
public void keyReleased(KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
- }
+ }
if( e.getKeySymbol() == KeyEvent.VK_I ) {
System.err.println(glWindow);
} else if( e.getKeySymbol() == KeyEvent.VK_L ) {
javax.media.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null);
javax.media.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null);
- System.err.println("NewtCanvasAWT position: "+p0+", "+p1);
+ System.err.println("NewtCanvasAWT position: "+p0+", "+p1);
} else if( e.getKeySymbol() == KeyEvent.VK_D ) {
glWindow.setUndecorated(!glWindow.isUndecorated());
} else if( e.getKeySymbol() == KeyEvent.VK_S ) {
@@ -68,7 +68,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
glWindow.setPosition(100, 100);
} else {
System.err.println("XXX glWin to 0/0");
- glWindow.setPosition(0, 0);
+ glWindow.setPosition(0, 0);
}
} else if( e.getKeySymbol() == KeyEvent.VK_F ) {
if( null != quitAdapter ) {
@@ -92,8 +92,8 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
if(glWindow.getAnimator().isPaused()) {
glWindow.getAnimator().resume();
} else {
- glWindow.getAnimator().pause();
- }
+ glWindow.getAnimator().pause();
+ }
}
}.run();
} else if( e.getKeySymbol() == KeyEvent.VK_R ) {
@@ -105,7 +105,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
final Thread t = glWindow.setExclusiveContextThread(null);
if(glWindow.getParent()==null) {
System.err.println("XXX glWin to HOME");
- glWindow.reparentWindow(newtCanvasAWT.getNativeWindow());
+ glWindow.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, 0 /* hints */);
} else {
if( null != frame ) {
final InsetsImmutable nInsets = glWindow.getInsets();
@@ -121,10 +121,10 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
final int topLevelX = frame.getX()+frame.getWidth()+dx;
final int topLevelY = frame.getY()+dy;
System.err.println("XXX glWin to TOP.1 "+topLevelX+"/"+topLevelY+" - insets " + nInsets + ", " + aInsets);
- glWindow.reparentWindow(null, topLevelX, topLevelY, false);
+ glWindow.reparentWindow(null, topLevelX, topLevelY, 0 /* hint */);
} else {
System.err.println("XXX glWin to TOP.0");
- glWindow.reparentWindow(null);
+ glWindow.reparentWindow(null, -1, -1, 0 /* hints */);
}
}
glWindow.requestFocus();
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
index 1f19241..7beceb2 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.parenting;
@@ -62,7 +62,7 @@ public class TestParenting01NEWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy() throws InterruptedException {
+ public void test01CreateVisibleDestroy() throws InterruptedException {
Assert.assertEquals(0,Display.getActiveDisplayNumber());
Display display = null;
Screen screen = null;
@@ -82,7 +82,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(0,Display.getActiveDisplayNumber());
- glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy");
+ glWindow1.setTitle("test01CreateVisibleDestroy");
glWindow1.setSize(640, 480);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -151,13 +151,13 @@ public class TestParenting01NEWT extends UITestCase {
glWindow1.resetFPSCounter();
glWindow2.resetFPSCounter();
Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
Assert.assertEquals(true, animator1.isAnimating());
Assert.assertEquals(false, animator1.isPaused());
Assert.assertNotNull(animator1.getThread());
Animator animator2 = new Animator(glWindow2);
- animator2.setUpdateFPSFrames(1, null);
+ animator2.setUpdateFPSFrames(1, null);
animator2.start();
Assert.assertEquals(true, animator2.isAnimating());
Assert.assertEquals(false, animator2.isPaused());
@@ -286,25 +286,27 @@ public class TestParenting01NEWT extends UITestCase {
}
@Test
- public void testWindowParenting02ReparentTop2WinReparentRecreate() throws InterruptedException {
- testWindowParenting02ReparentTop2WinImpl(true);
+ public void test02aReparentTop2WinReparentRecreate() throws InterruptedException {
+ test02ReparentTop2WinImpl(true);
}
@Test
- public void testWindowParenting02ReparentTop2WinReparentNative() throws InterruptedException {
- testWindowParenting02ReparentTop2WinImpl(false);
+ public void test02bReparentTop2WinReparentNative() throws InterruptedException {
+ test02ReparentTop2WinImpl(false);
}
/**
* @param reparentRecreate true, if the followup reparent should utilize destroy/create, instead of native reparenting
*/
- protected void testWindowParenting02ReparentTop2WinImpl(boolean reparentRecreate) throws InterruptedException {
+ protected void test02ReparentTop2WinImpl(final boolean reparentRecreate) throws InterruptedException {
+ final int reparentHints = reparentRecreate ? Window.REPARENT_HINT_FORCE_RECREATION : 0;
+
Assert.assertEquals(0,Display.getActiveDisplayNumber());
Display display1 = null;
Screen screen1 = null;
GLWindow glWindow1 = GLWindow.create(glCaps);
- glWindow1.setTitle("testWindowParenting02ReparentTop2Win");
+ glWindow1.setTitle("test02ReparentTop2Win");
glWindow1.setSize(640, 480);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -379,7 +381,7 @@ public class TestParenting01NEWT extends UITestCase {
// glWindow2 -- child --> glWindow1: compatible
Assert.assertEquals(true, glWindow2.isVisible());
System.err.println("Frames(1) "+glWindow2.getTotalFPSFrames());
- reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentHints);
System.err.println("Frames(2) "+glWindow2.getTotalFPSFrames());
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
@@ -405,7 +407,7 @@ public class TestParenting01NEWT extends UITestCase {
// glWindow2 --> top
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentHints);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
@@ -484,16 +486,18 @@ public class TestParenting01NEWT extends UITestCase {
}
@Test
- public void testWindowParenting03ReparentWin2TopReparentRecreate() throws InterruptedException {
- testWindowParenting03ReparentWin2TopImpl(true);
+ public void test03aReparentWin2TopReparentRecreate() throws InterruptedException {
+ test03ReparentWin2TopImpl(true);
}
@Test
- public void testWindowParenting03ReparentWin2TopReparentNative() throws InterruptedException {
- testWindowParenting03ReparentWin2TopImpl(false);
+ public void test03bReparentWin2TopReparentNative() throws InterruptedException {
+ test03ReparentWin2TopImpl(false);
}
- protected void testWindowParenting03ReparentWin2TopImpl(boolean reparentRecreate) throws InterruptedException {
+ protected void test03ReparentWin2TopImpl(final boolean reparentRecreate) throws InterruptedException {
+ final int reparentHints = reparentRecreate ? Window.REPARENT_HINT_FORCE_RECREATION : 0;
+
Assert.assertEquals(0,Display.getActiveDisplayNumber());
Display display1 = null;
Screen screen1 = null;
@@ -503,7 +507,7 @@ public class TestParenting01NEWT extends UITestCase {
GLWindow glWindow1 = GLWindow.create(glCaps);
screen1 = glWindow1.getScreen();
display1 = screen1.getDisplay();
- glWindow1.setTitle("testWindowParenting03ReparentWin2Top");
+ glWindow1.setTitle("test03ReparentWin2Top");
glWindow1.setSize(640, 480);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -567,14 +571,14 @@ public class TestParenting01NEWT extends UITestCase {
switch(state) {
case 0:
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentHints);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFPSFrames());
Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
-
+
Assert.assertNull(glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
@@ -582,14 +586,14 @@ public class TestParenting01NEWT extends UITestCase {
break;
case 1:
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentHints);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFPSFrames());
Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
-
+
Assert.assertSame(glWindow1,glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
@@ -657,7 +661,7 @@ public class TestParenting01NEWT extends UITestCase {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
- Assert.assertNotNull(glWindow);
+ Assert.assertNotNull(glWindow);
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
@@ -689,8 +693,8 @@ public class TestParenting01NEWT extends UITestCase {
try {
TestParenting01NEWT.initClass();
TestParenting01NEWT m = new TestParenting01NEWT();
- m.testWindowParenting02ReparentTop2WinReparentRecreate();
- m.testWindowParenting01CreateVisibleDestroy();
+ m.test02aReparentTop2WinReparentRecreate();
+ m.test01CreateVisibleDestroy();
} catch (Throwable t ) {
t.printStackTrace();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
index 6de24d1..420a39c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -68,7 +68,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
+ public void test01WindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
final GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
@@ -112,11 +112,11 @@ public class TestParenting01aAWT extends UITestCase {
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
final Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow1, true));
-
+
while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) {
Thread.sleep(100);
}
@@ -126,17 +126,17 @@ public class TestParenting01aAWT extends UITestCase {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(false);
- } } );
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
- } } );
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen();
-
+
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.remove(newtCanvasAWT);
@@ -159,7 +159,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting02CreateVisibleDestroy2Defered() throws InterruptedException, InvocationTargetException {
+ public void test02WindowParenting02CreateVisibleDestroy2Defered() throws InterruptedException, InvocationTargetException {
final GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
@@ -211,7 +211,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting02CreateVisibleDestroy3Odd() throws InterruptedException, InvocationTargetException {
+ public void test03WindowParenting02CreateVisibleDestroy3Odd() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -256,7 +256,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting03ReparentNewtWin2Top() throws InterruptedException, InvocationTargetException {
+ public void test04WindowParenting03ReparentNewtWin2Top() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -283,7 +283,7 @@ public class TestParenting01aAWT extends UITestCase {
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
int state = 0;
@@ -291,12 +291,12 @@ public class TestParenting01aAWT extends UITestCase {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
- glWindow1.reparentWindow(null);
+ System.err.println("Reparent CHILD -> TOP: "+glWindow1.reparentWindow(null, -1, -1, 0 /* hints */));
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParent());
break;
case 1:
- glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow());
+ System.err.println("Reparent TOP -> CHILD: "+glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, 0 /* hints */));
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
break;
@@ -315,7 +315,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting04ReparentNewtWin2TopLayouted() throws InterruptedException, InvocationTargetException {
+ public void test05WindowParenting04ReparentNewtWin2TopLayouted() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -329,7 +329,7 @@ public class TestParenting01aAWT extends UITestCase {
frame.add(new Button("South"), BorderLayout.SOUTH);
frame.add(new Button("East"), BorderLayout.EAST);
frame.add(new Button("West"), BorderLayout.WEST);
-
+
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setSize(width, height);
@@ -344,11 +344,11 @@ public class TestParenting01aAWT extends UITestCase {
frame.validate();
}
});
-
+
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
int state = 0;
@@ -356,12 +356,12 @@ public class TestParenting01aAWT extends UITestCase {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
- glWindow1.reparentWindow(null);
+ System.err.println("Reparent CHILD -> TOP: "+glWindow1.reparentWindow(null, -1, -1, 0 /* hints */));
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParent());
break;
case 1:
- glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow());
+ System.err.println("Reparent TOP -> CHILD: "+glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, 0 /* hints */));
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
break;
@@ -380,7 +380,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
+ public void test06WindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquareES2();
@@ -427,7 +427,7 @@ public class TestParenting01aAWT extends UITestCase {
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
int state = 0;
@@ -442,7 +442,7 @@ public class TestParenting01aAWT extends UITestCase {
frame1.validate();
frame2.validate();
}
- });
+ });
break;
case 1:
SwingUtilities.invokeAndWait(new Runnable() {
@@ -452,7 +452,7 @@ public class TestParenting01aAWT extends UITestCase {
frame2.validate();
frame1.validate();
}
- });
+ });
break;
}
state++;
@@ -471,7 +471,7 @@ public class TestParenting01aAWT extends UITestCase {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
- Assert.assertNotNull(glWindow);
+ Assert.assertNotNull(glWindow);
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
@@ -498,17 +498,7 @@ public class TestParenting01aAWT extends UITestCase {
}
}
String tstname = TestParenting01aAWT.class.getName();
- org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
- tstname,
- "filtertrace=true",
- "haltOnError=false",
- "haltOnFailure=false",
- "showoutput=true",
- "outputtoformatters=true",
- "logfailedtests=true",
- "logtestlistenerevents=true",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java
index 45612eb..598e5f1 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
@@ -68,16 +68,16 @@ public class TestParenting01bAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2FrameFPS25Animator() throws InterruptedException, InvocationTargetException {
- testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(25);
+ public void test01AWTWinHopFrame2FrameFPS25Animator() throws InterruptedException, InvocationTargetException {
+ testAWTWinHopFrame2FrameImpl(25);
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2FrameStdAnimator() throws InterruptedException, InvocationTargetException {
- testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(0);
+ public void test02AWTWinHopFrame2FrameStdAnimator() throws InterruptedException, InvocationTargetException {
+ testAWTWinHopFrame2FrameImpl(0);
}
- public void testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(int fps) throws InterruptedException, InvocationTargetException {
+ public void testAWTWinHopFrame2FrameImpl(int fps) throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquareES2();
@@ -85,7 +85,7 @@ public class TestParenting01bAWT extends UITestCase {
glWindow1.addGLEventListener(demo1);
final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
-
+
final Frame frame1 = new Frame("AWT Parent Frame");
frame1.setLayout(new BorderLayout());
frame1.add(new Button("North"), BorderLayout.NORTH);
@@ -96,7 +96,7 @@ public class TestParenting01bAWT extends UITestCase {
public void run() {
frame1.setSize(width, height);
frame1.setLocation(0, 0);
- frame1.setVisible(true);
+ frame1.setVisible(true);
}
});
@@ -110,7 +110,7 @@ public class TestParenting01bAWT extends UITestCase {
public void run() {
frame2.setSize(width, height);
frame2.setLocation(640, 480);
- frame2.setVisible(true);
+ frame2.setVisible(true);
}
});
@@ -142,7 +142,7 @@ public class TestParenting01bAWT extends UITestCase {
frame1.validate();
frame2.validate();
}
- });
+ });
break;
case 1:
SwingUtilities.invokeAndWait(new Runnable() {
@@ -152,7 +152,7 @@ public class TestParenting01bAWT extends UITestCase {
frame2.validate();
frame1.validate();
}
- });
+ });
break;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
index dd5d6eb..1d74017 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
@@ -66,7 +66,7 @@ public class TestParenting01cAWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
+ public void test01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
int i;
GLWindow glWindow1 = GLWindow.create(glCaps);
@@ -154,7 +154,7 @@ public class TestParenting01cAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
+ public void test02AWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquareES2();
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
index 375f676..4d5c3b2 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -121,7 +121,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
+ public void test01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
/**
* JFrame . JPanel . Container . NewtCanvasAWT . GLWindow
*/
@@ -236,7 +236,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
+ public void test02AWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
/**
* JFrame . JPanel . Container . NewtCanvasAWT . GLWindow
*/
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java
similarity index 50%
copy from src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
copy to src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java
index dd5d6eb..00b32ac 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java
@@ -1,16 +1,16 @@
/**
- * Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright 2013 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
@@ -42,7 +42,7 @@ import java.awt.Frame;
import javax.media.opengl.*;
import javax.swing.SwingUtilities;
-import com.jogamp.newt.*;
+import com.jogamp.newt.Window;
import com.jogamp.newt.opengl.*;
import com.jogamp.newt.awt.NewtCanvasAWT;
@@ -52,38 +52,72 @@ import java.lang.reflect.InvocationTargetException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+/**
+ * Test GL preservation case for reparenting.
+ * <p>
+ * Also simulates adding and attaching an already created GLWindow
+ * to a NewtCanvasAWT in recreation mode, where the GL state shall be preserved.
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestParenting01cAWT extends UITestCase {
+public class TestParenting01dAWT extends UITestCase {
static int width, height;
static long durationPerTest = 800;
static GLCapabilities glCaps;
@BeforeClass
- public static void initClass() {
+ public static void initClass() throws InterruptedException {
width = 640;
height = 480;
glCaps = new GLCapabilities(null);
+ // Thread.sleep(10000);
+ }
+
+ static class MyGLEventListenerCounter extends GLEventListenerCounter {
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ super.init(drawable);
+ System.err.println("MyGLEventListenerCounter.init: "+this);
+ // Thread.dumpStack();
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ super.dispose(drawable);
+ System.err.println("MyGLEventListenerCounter.dispose: "+this);
+ // Thread.dumpStack();
+ }
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
- int i;
+ public void test01GLWindowReparentRecreateNoPreserve() throws InterruptedException, InvocationTargetException {
+ testGLWindowInvisibleReparentRecreateImpl(false /* triggerPreserveGLState */);
+ }
- GLWindow glWindow1 = GLWindow.create(glCaps);
+ @Test
+ public void test02GLWindowReparentRecreateGLPreserve() throws InterruptedException, InvocationTargetException {
+ testGLWindowInvisibleReparentRecreateImpl(true /* triggerPreserveGLState */);
+ }
+
+ private void testGLWindowInvisibleReparentRecreateImpl(boolean triggerPreserveGLState) throws InterruptedException, InvocationTargetException {
+ final GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParent());
glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy");
+ final MyGLEventListenerCounter glelCounter = new MyGLEventListenerCounter();
+ glWindow1.addGLEventListener(glelCounter);
GLEventListener demo1 = new RedSquareES2();
- setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
+ Assert.assertEquals("Init Counter Invalid "+glelCounter, 0, glelCounter.initCount);
final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
Assert.assertNotNull(newtCanvasAWT);
Assert.assertEquals(false, glWindow1.isVisible());
Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParent());
+ Assert.assertEquals("Init Counter Invalid "+glelCounter, 0, glelCounter.initCount);
final Frame frame1 = new Frame("AWT Parent Frame");
frame1.setLayout(new BorderLayout());
@@ -92,7 +126,7 @@ public class TestParenting01cAWT extends UITestCase {
frame1.add(new Button("East"), BorderLayout.EAST);
frame1.add(new Button("West"), BorderLayout.WEST);
- Container container1 = new Container();
+ final Container container1 = new Container();
container1.setLayout(new BorderLayout());
container1.add(new Button("north"), BorderLayout.NORTH);
container1.add(new Button("south"), BorderLayout.SOUTH);
@@ -111,31 +145,72 @@ public class TestParenting01cAWT extends UITestCase {
});
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
- for(i=0; i*100<durationPerTest; i++) {
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow1, true));
+ glWindow1.display();
+ Assert.assertEquals("Init Counter Invalid "+glelCounter, 1, glelCounter.initCount);
+ Assert.assertEquals("Dispose Counter Invalid "+glelCounter, 0, glelCounter.disposeCount);
+
+ final int reparentingHints = Window.REPARENT_HINT_FORCE_RECREATION |
+ ( triggerPreserveGLState ? Window.REPARENT_HINT_BECOMES_VISIBLE : 0 );
+
+ //
+ // Even though the hint REPARENT_HINT_BECOMES_VISIBLE is not set (triggerPrerveGLState == false),
+ // since GLWindow is visible already the GL state shall be preserved!
+ //
+ System.err.println(getSimpleTestName(".")+": Start Reparent #1");
+ final Window.ReparentOperation rop1 = glWindow1.reparentWindow(null, -1, -1, reparentingHints);
+ System.err.println(getSimpleTestName(".")+": Result Reparent #1: "+rop1);
+ Assert.assertEquals(Window.ReparentOperation.ACTION_NATIVE_CREATION, rop1);
+ glWindow1.display();
+ Assert.assertEquals("Init Counter Invalid (Preserve Failed 1) "+glelCounter, 1, glelCounter.initCount);
+ Assert.assertEquals("Dispose Counter Invalid (Preserve Failed 1) "+glelCounter, 0, glelCounter.disposeCount);
+
+ //
+ // The following step is equivalent with adding and attaching an already created GLWindow
+ // to a NewtCanvasAWT in recreation mode if REPARENT_HINT_BECOMES_VISIBLE hint is set (triggerPrerveGLState == true).
+ // GL state shall be preserved!
+ //
+ glWindow1.setVisible(false);
+ System.err.println(getSimpleTestName(".")+": Start Reparent #2");
+ final Window.ReparentOperation rop2 = glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, reparentingHints);
+ System.err.println(getSimpleTestName(".")+": Result Reparent #2: "+rop2);
+ Assert.assertEquals(Window.ReparentOperation.ACTION_NATIVE_CREATION, rop2);
+ glWindow1.setVisible(true);
+ glWindow1.display();
+ if( triggerPreserveGLState ) {
+ Assert.assertEquals("Init Counter Invalid (Preserve Failed 2) "+glelCounter, 1, glelCounter.initCount);
+ Assert.assertEquals("Dispose Counter Invalid (Preserve Failed 2) "+glelCounter, 0, glelCounter.disposeCount);
+ } else {
+ Assert.assertEquals("Init Counter Invalid (Preserve Failed 2) "+glelCounter, 2, glelCounter.initCount);
+ Assert.assertEquals("Dispose Counter Invalid (Preserve Failed 2) "+glelCounter, 1, glelCounter.disposeCount);
+ }
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while( t1 - t0 < durationPerTest ) {
Thread.sleep(100);
+ t1 = System.currentTimeMillis();
}
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(false);
- }
- });
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
- }
- });
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen();
-
+
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.remove(newtCanvasAWT);
- }
- });
+ } } );
// Assert.assertNull(glWindow1.getParent());
if( wasOnscreen ) {
Assert.assertEquals(true, glWindow1.isNativeValid());
@@ -151,128 +226,23 @@ public class TestParenting01cAWT extends UITestCase {
glWindow1.destroy();
Assert.assertEquals(false, glWindow1.isNativeValid());
- }
-
- @Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
- GLWindow glWindow1 = GLWindow.create(glCaps);
- glWindow1.setUndecorated(true);
- GLEventListener demo1 = new RedSquareES2();
- setDemoFields(demo1, glWindow1, false);
- glWindow1.addGLEventListener(demo1);
-
- final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
-
- final Frame frame1 = new Frame("AWT Parent Frame");
- frame1.setLayout(new BorderLayout());
- frame1.add(new Button("North"), BorderLayout.NORTH);
- frame1.add(new Button("South"), BorderLayout.SOUTH);
- frame1.add(new Button("East"), BorderLayout.EAST);
- frame1.add(new Button("West"), BorderLayout.WEST);
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame1.setSize(width, height);
- frame1.setLocation(0, 0);
- frame1.setVisible(true);
- }
- });
-
- final Frame frame2 = new Frame("AWT Parent Frame");
- frame2.setLayout(new BorderLayout());
- frame2.add(new Button("North"), BorderLayout.NORTH);
- frame2.add(new Button("South"), BorderLayout.SOUTH);
- frame2.add(new Button("East"), BorderLayout.EAST);
- frame2.add(new Button("West"), BorderLayout.WEST);
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame2.setSize(width, height);
- frame2.setLocation(640, 480);
- frame2.setVisible(true);
- }
- });
-
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame1.add(newtCanvasAWT, BorderLayout.CENTER);
- frame1.validate();
- }
- });
- Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
-
- int state;
- for(state=0; state<3; state++) {
- Thread.sleep(durationPerTest);
- switch(state) {
- case 0:
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame1.remove(newtCanvasAWT);
- frame2.add(newtCanvasAWT, BorderLayout.CENTER);
- frame1.validate();
- frame2.validate();
- }
- });
- break;
- case 1:
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame2.remove(newtCanvasAWT);
- frame1.add(newtCanvasAWT, BorderLayout.CENTER);
- frame1.validate();
- frame2.validate();
- }
- });
- break;
- }
- }
-
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame1.dispose();
- frame2.dispose();
- } } );
- glWindow1.destroy();
- }
-
- public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
- Assert.assertNotNull(demo);
- Assert.assertNotNull(glWindow);
- Window window = glWindow.getDelegatedWindow();
- if(debug) {
- MiscUtils.setFieldIfExists(demo, "glDebug", true);
- MiscUtils.setFieldIfExists(demo, "glTrace", true);
- }
- if(!MiscUtils.setFieldIfExists(demo, "window", window)) {
- MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
+ if( triggerPreserveGLState ) {
+ Assert.assertEquals("Init Counter Invalid (Preserve Failed 1) "+glelCounter, 1, glelCounter.initCount);
+ Assert.assertEquals("Dispose Counter Invalid (Preserve Failed 1) "+glelCounter, 1, glelCounter.disposeCount);
+ } else {
+ Assert.assertEquals("Init Counter Invalid (Preserve Failed 1) "+glelCounter, 2, glelCounter.initCount);
+ Assert.assertEquals("Dispose Counter Invalid (Preserve Failed 1) "+glelCounter, 2, glelCounter.disposeCount);
}
}
- static int atoi(String a) {
- int i=0;
- try {
- i = Integer.parseInt(a);
- } catch (Exception ex) { ex.printStackTrace(); }
- return i;
- }
-
public static void main(String args[]) throws IOException {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
- durationPerTest = atoi(args[++i]);
+ durationPerTest = MiscUtils.atol(args[++i], durationPerTest);
}
}
- String tstname = TestParenting01cAWT.class.getName();
- org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
- tstname,
- "filtertrace=true",
- "haltOnError=false",
- "haltOnFailure=false",
- "showoutput=true",
- "outputtoformatters=true",
- "logfailedtests=true",
- "logtestlistenerevents=true",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ String tstname = TestParenting01dAWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java
index d79bdca..b304a2c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
@@ -65,22 +65,22 @@ public class TestParenting02AWT extends UITestCase {
}
@Test
- public void testWindowParenting01NewtChildOnAWTParentLayouted() throws InterruptedException, InvocationTargetException {
+ public void test01NewtChildOnAWTParentLayouted() throws InterruptedException, InvocationTargetException {
runNewtChildOnAWTParent(true, false);
}
@Test
- public void testWindowParenting02NewtChildOnAWTParentLayoutedDef() throws InterruptedException, InvocationTargetException {
+ public void test02NewtChildOnAWTParentLayoutedDef() throws InterruptedException, InvocationTargetException {
runNewtChildOnAWTParent(true, true);
}
@Test
- public void testWindowParenting03NewtChildOnAWTParentDirect() throws InterruptedException, InvocationTargetException {
+ public void test03NewtChildOnAWTParentDirect() throws InterruptedException, InvocationTargetException {
runNewtChildOnAWTParent(false, false);
}
@Test
- public void testWindowParenting04NewtChildOnAWTParentDirectDef() throws InterruptedException, InvocationTargetException {
+ public void test04NewtChildOnAWTParentDirectDef() throws InterruptedException, InvocationTargetException {
runNewtChildOnAWTParent(false, true);
}
@@ -152,7 +152,7 @@ public class TestParenting02AWT extends UITestCase {
} while(!glWindow.isNativeValid()) ;
final boolean wasOnscreen = glWindow.getChosenCapabilities().isOnscreen();
-
+
Assert.assertEquals(true, glWindow.isNativeValid());
Assert.assertNotNull(glWindow.getParent());
if(verbose) {
@@ -203,7 +203,7 @@ public class TestParenting02AWT extends UITestCase {
Thread.sleep(step);
duration -= step;
- while( null != ( event = (NEWTEvent) eventFifo.get() ) ) {
+ while( null != ( event = eventFifo.get() ) ) {
Window source = (Window) event.getSource();
if(event instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent) event;
@@ -215,7 +215,7 @@ public class TestParenting02AWT extends UITestCase {
source.setFullscreen(!source.isFullscreen());
break;
}
- }
+ }
}
}
if(verbose) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java
index 6294483..9f56ecd 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.parenting;
@@ -92,7 +92,7 @@ public class TestParenting02NEWT extends UITestCase {
}
@Test
- public void testWindowParenting01NewtOnNewtParentChildDraw() throws InterruptedException {
+ public void test01NewtOnNewtParentChildDraw() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(null);
Assert.assertNotNull(caps);
Display display = NewtFactory.createDisplay(null); // local display
@@ -112,7 +112,7 @@ public class TestParenting02NEWT extends UITestCase {
glWindow1.setSize(width, height);
Assert.assertEquals(width,glWindow1.getWidth());
Assert.assertEquals(height,glWindow1.getHeight());
- glWindow1.setTitle("testWindowParenting01NewtOnNewtParentChildDraw - PARENT");
+ glWindow1.setTitle("test01NewtOnNewtParentChildDraw - PARENT");
glWindow1.setPosition(x,y);
//glWindow1.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo)));
//glWindow1.addWindowListener(new TraceWindowAdapter());
@@ -133,7 +133,7 @@ public class TestParenting02NEWT extends UITestCase {
glWindow2.setSize(width/2, height/2);
//Assert.assertEquals(width/2,glWindow2.getWidth());
//Assert.assertEquals(height/2,glWindow2.getHeight());
- glWindow2.setTitle("testWindowParenting01NewtOnNewtParentChildDraw - CHILD");
+ glWindow2.setTitle("test01NewtOnNewtParentChildDraw - CHILD");
glWindow2.setPosition(glWindow1.getWidth()/2, glWindow1.getHeight()/2);
//glWindow2.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo)));
//glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAction(eventFifo)));
@@ -166,7 +166,7 @@ public class TestParenting02NEWT extends UITestCase {
glWindow2.setPosition(glWindow1.getWidth()/2,glWindow1.getHeight()/2-y);
Thread.sleep(step);
- while( null != ( event = (NEWTEvent) eventFifo.get() ) ) {
+ while( null != ( event = eventFifo.get() ) ) {
Window source = (Window) event.getSource();
if(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY == event.getEventType()) {
shouldQuit = true;
@@ -180,7 +180,7 @@ public class TestParenting02NEWT extends UITestCase {
source.setFullscreen(!source.isFullscreen());
break;
}
- }
+ }
}
}
destroyWindow(null, null, window2, glWindow2);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
index 30ee0f1..b749719 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt.parenting;
import java.lang.reflect.*;
@@ -69,16 +69,16 @@ public class TestParenting03AWT extends UITestCase {
}
@Test
- public void testWindowParenting1AWTOneNewtChilds01() throws InterruptedException, InvocationTargetException {
- testWindowParenting1AWT(false);
+ public void test01AWTOneNewtChilds01() throws InterruptedException, InvocationTargetException {
+ testImpl(false);
}
@Test
- public void testWindowParenting1AWTTwoNewtChilds01() throws InterruptedException, InvocationTargetException {
- testWindowParenting1AWT(true);
+ public void test02AWTTwoNewtChilds01() throws InterruptedException, InvocationTargetException {
+ testImpl(true);
}
-
- public void testWindowParenting1AWT(boolean use2nd) throws InterruptedException, InvocationTargetException {
+
+ public void testImpl(boolean use2nd) throws InterruptedException, InvocationTargetException {
final Frame frame1 = new Frame("AWT Parent Frame");
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUpdateFPSFrames(1, null);
@@ -100,7 +100,7 @@ public class TestParenting03AWT extends UITestCase {
glWindow2.setUpdateFPSFrames(1, null);
newtCanvasAWT2 = new NewtCanvasAWT(glWindow2);
newtCanvasAWT2.setPreferredSize(glSize);
-
+
GLEventListener demo2 = new GearsES2(1);
setDemoFields(demo2, glWindow2, false);
glWindow2.addGLEventListener(demo2);
@@ -141,12 +141,12 @@ public class TestParenting03AWT extends UITestCase {
System.err.println("******* Frame setVisible");
frame1.setLocation(0, 0);
frame1.setSize(fSize);
- frame1.validate();
+ frame1.validate();
frame1.setVisible(true);
}});
Assert.assertEquals(newtCanvasAWT1.getNativeWindow(),glWindow1.getParent());
-
+
Assert.assertEquals(true, animator1.isAnimating());
Assert.assertEquals(false, animator1.isPaused());
Assert.assertNotNull(animator1.getThread());
@@ -157,7 +157,7 @@ public class TestParenting03AWT extends UITestCase {
Assert.assertNotNull(animator2.getThread());
Thread.sleep(waitAdd2nd);
-
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.add(cont2, BorderLayout.WEST);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java
index 827ac52..126aaaf 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java
@@ -70,13 +70,13 @@ public class TestParenting04AWT extends UITestCase {
}
@Test
- public void winHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException {
+ public void test01WinHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException {
// Will produce some artifacts .. resizing etc
winHopFrame2Frame(false);
}
@Test
- public void winHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException {
+ public void test02WinHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException {
// Note: detaching first setNEWTChild(null) is much cleaner visually
winHopFrame2Frame(true);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java
index 78b3bc4..586db8a 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java
@@ -136,13 +136,13 @@ public class TestParenting04SWT extends UITestCase {
}
@Test
- public void winHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException {
+ public void test01WinHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException {
// Will produce some artifacts .. resizing etc
winHopFrame2Frame(false);
}
@Test
- public void winHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException {
+ public void test02WinHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException {
// Note: detaching first setNEWTChild(null) is much cleaner visually
winHopFrame2Frame(true);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java
index 776c3c7..9461af5 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.util;
import java.awt.event.KeyEvent;
@@ -37,6 +37,7 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
String prefix;
int keyPressed, keyReleased;
+ int consumed;
boolean pressed;
List<EventObject> queue = new ArrayList<EventObject>();
boolean verbose = true;
@@ -46,35 +47,40 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
reset();
}
- public synchronized void setVerbose(boolean v) { verbose = false; }
+ public synchronized void setVerbose(boolean v) { verbose = v; }
public synchronized boolean isPressed() {
return pressed;
}
-
+
public synchronized int getCount() {
return keyReleased;
}
+ public synchronized int getConsumedCount() {
+ return consumed;
+ }
+
public synchronized int getKeyPressedCount(boolean autoRepeatOnly) {
- return keyPressed;
+ return keyPressed;
}
-
+
public synchronized int getKeyReleasedCount(boolean autoRepeatOnly) {
- return keyReleased;
+ return keyReleased;
}
-
- public synchronized List<EventObject> getQueued() {
- return queue;
+
+ public synchronized List<EventObject> copyQueue() {
+ return new ArrayList<EventObject>(queue);
}
-
+
public synchronized int getQueueSize() {
return queue.size();
}
-
+
public synchronized void reset() {
keyPressed = 0;
keyReleased = 0;
+ consumed = 0;
pressed = false;
queue.clear();
}
@@ -91,12 +97,15 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
public synchronized void keyReleased(KeyEvent e) {
pressed = false;
keyReleased++;
+ if(e.isConsumed()) {
+ consumed++;
+ }
queue.add(e);
if( verbose ) {
System.err.println("KEY AWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
- public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+"]"; }
+ public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+", consumed "+consumed+"]"; }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java
index 31362bf..c1bec79 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.util;
import java.awt.event.MouseEvent;
@@ -36,6 +36,7 @@ import java.util.List;
public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements InputEventCountAdapter {
String prefix;
int mouseClicked;
+ int consumed;
boolean pressed;
List<EventObject> queue = new ArrayList<EventObject>();
boolean verbose = true;
@@ -45,26 +46,31 @@ public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements Inpu
reset();
}
- public synchronized void setVerbose(boolean v) { verbose = false; }
-
+ public synchronized void setVerbose(boolean v) { verbose = v; }
+
public synchronized boolean isPressed() {
return pressed;
}
-
+
public synchronized int getCount() {
return mouseClicked;
}
-
- public synchronized List<EventObject> getQueued() {
- return queue;
+
+ public synchronized int getConsumedCount() {
+ return consumed;
}
-
+
+ public synchronized List<EventObject> copyQueue() {
+ return new ArrayList<EventObject>(queue);
+ }
+
public synchronized int getQueueSize() {
return queue.size();
}
public synchronized void reset() {
mouseClicked = 0;
+ consumed = 0;
pressed = false;
queue.clear();
}
@@ -84,15 +90,18 @@ public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements Inpu
System.err.println("MOUSE AWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
-
+
public synchronized void mouseClicked(java.awt.event.MouseEvent e) {
mouseClicked+=e.getClickCount();
+ if(e.isConsumed()) {
+ consumed++;
+ }
queue.add(e);
if( verbose ) {
System.err.println("MOUSE AWT CLICKED ["+mouseClicked+"]: "+prefix+", "+e);
}
- }
-
- public String toString() { return prefix+"[pressed "+pressed+", clicked "+mouseClicked+"]"; }
+ }
+
+ public String toString() { return prefix+"[pressed "+pressed+", clicked "+mouseClicked+", consumed "+consumed+"]"; }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
index cd14835..cf58ae2 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -59,9 +59,6 @@ public class AWTRobotUtil {
public static final int TIME_SLICE = TIME_OUT / POLL_DIVIDER ;
public static Integer AWT_CLICK_TO = null;
- static Object awtEDTAliveSync = new Object();
- static volatile boolean awtEDTAliveFlag = false;
-
static class OurUncaughtExceptionHandler implements UncaughtExceptionHandler {
@Override
public void uncaughtException(Thread t, Throwable e) {
@@ -82,12 +79,7 @@ public class AWTRobotUtil {
}
synchronized ( awtEDTAliveSync ) {
awtEDTAliveFlag = false;
- EventQueue.invokeLater(new Runnable() {
- @Override
- public void run() {
- awtEDTAliveFlag = true;
- }
- });
+ EventQueue.invokeLater(aliveRun);
for (int wait=0; wait<POLL_DIVIDER && !awtEDTAliveFlag; wait++) {
try {
Thread.sleep(TIME_SLICE);
@@ -98,6 +90,10 @@ public class AWTRobotUtil {
return awtEDTAliveFlag;
}
}
+ private static Runnable aliveRun = new Runnable() { public void run() { awtEDTAliveFlag = true; } };
+ private static Object awtEDTAliveSync = new Object();
+ private static volatile boolean awtEDTAliveFlag = false;
+
/** Throws Error if {@link #isAWTEDTAlive()} returns false. */
public static void validateAWTEDTIsAlive() {
if( !isAWTEDTAlive() ) {
@@ -184,6 +180,11 @@ public class AWTRobotUtil {
return new int[] { (int)p0.getX(), (int)p0.getY() };
}
+ public static void awtRobotMouseMove(Robot robot, int x, int y) {
+ robot.mouseMove( x, y );
+ robot.delay(ROBOT_DELAY);
+ }
+
/**
* toFront, call setVisible(true) and toFront(),
* after positioning the mouse in the middle of the window via robot.
@@ -203,9 +204,8 @@ public class AWTRobotUtil {
robot.setAutoWaitForIdle(true);
}
int[] p0 = getCenterLocation(window, false);
- System.err.println("toFront: robot pos: "+p0[0]+"x"+p0[1]);
- robot.mouseMove( p0[0], p0[1] );
- robot.delay(ROBOT_DELAY);
+ System.err.println("toFront: robot pos: "+p0[0]+"/"+p0[1]);
+ awtRobotMouseMove(robot, p0[0], p0[1] );
int wait=0;
do {
@@ -247,9 +247,7 @@ public class AWTRobotUtil {
int[] p0 = getCenterLocation(obj, onTitleBarIfWindow);
System.err.println("centerMouse: robot pos: "+p0[0]+"x"+p0[1]+", onTitleBarIfWindow: "+onTitleBarIfWindow);
-
- robot.mouseMove( p0[0], p0[1] );
- robot.delay(ROBOT_DELAY);
+ awtRobotMouseMove(robot, p0[0], p0[1] );
}
public static void setMouseToClientLocation(Robot robot, Object obj, int x, int y)
@@ -261,9 +259,7 @@ public class AWTRobotUtil {
}
int[] p0 = getClientLocation(obj, x, y);
-
- robot.mouseMove( p0[0], p0[1] );
- robot.delay(ROBOT_DELAY);
+ awtRobotMouseMove(robot, p0[0], p0[1] );
}
public static int getClickTimeout(Object obj) {
@@ -682,53 +678,97 @@ public class AWTRobotUtil {
}
/**
+ * @param obj the component to wait for
+ * @param realized true if waiting for component to become realized, otherwise false
* @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT
+ * @throws InterruptedException
*/
public static boolean waitForRealized(Object obj, boolean realized) throws InterruptedException {
- int wait;
+ return waitForRealized(obj, null, realized);
+ }
+
+ /**
+ * @param obj the component to wait for
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @param realized true if waiting for component to become realized, otherwise false
+ * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT
+ * @throws InterruptedException
+ */
+ public static boolean waitForRealized(Object obj, Runnable waitAction, boolean realized) throws InterruptedException {
+ long t0 = System.currentTimeMillis();
+ long t1 = t0;
if(obj instanceof com.jogamp.newt.Screen) {
com.jogamp.newt.Screen screen = (com.jogamp.newt.Screen) obj;
- for (wait=0; wait<POLL_DIVIDER && realized != screen.isNativeValid(); wait++) {
- Thread.sleep(TIME_SLICE);
+ while( (t1-t0) < TIME_OUT && realized != screen.isNativeValid() ) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ t1 = System.currentTimeMillis();
}
} else if(obj instanceof com.jogamp.newt.Window) {
com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj;
- for (wait=0; wait<POLL_DIVIDER && realized != win.isNativeValid(); wait++) {
- Thread.sleep(TIME_SLICE);
+ while( (t1-t0) < TIME_OUT && realized != win.isNativeValid() ) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ t1 = System.currentTimeMillis();
}
} else if (NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) {
java.awt.Component comp = (java.awt.Component) obj;
- for (wait=0; wait<POLL_DIVIDER && realized != comp.isDisplayable(); wait++) {
- Thread.sleep(TIME_SLICE);
+ while( (t1-t0) < TIME_OUT && realized != comp.isDisplayable() ) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ t1 = System.currentTimeMillis();
}
// if GLCanvas, ensure it got also painted -> drawable.setRealized(true);
- if(wait<POLL_DIVIDER && comp instanceof GLAutoDrawable) {
+ if( (t1-t0) < TIME_OUT && comp instanceof GLAutoDrawable) {
GLAutoDrawable glad = (GLAutoDrawable) comp;
- for (wait=0; wait<POLL_DIVIDER && realized != glad.isRealized(); wait++) {
- Thread.sleep(TIME_SLICE);
+ t0 = System.currentTimeMillis();
+ while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ t1 = System.currentTimeMillis();
}
- if(wait>=POLL_DIVIDER) {
+ if( (t1-t0) >= TIME_OUT ) {
// for some reason GLCanvas hasn't been painted yet, force it!
System.err.println("XXX: FORCE REPAINT PRE - glad: "+glad);
comp.repaint();
- for (wait=0; wait<POLL_DIVIDER && realized != glad.isRealized(); wait++) {
- Thread.sleep(TIME_SLICE);
+ t0 = System.currentTimeMillis();
+ while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ t1 = System.currentTimeMillis();
}
System.err.println("XXX: FORCE REPAINT POST - glad: "+glad);
}
- for (wait=0; wait<POLL_DIVIDER && realized != glad.isRealized(); wait++) {
- Thread.sleep(TIME_SLICE);
- }
}
} else if(obj instanceof GLAutoDrawable) {
GLAutoDrawable glad = (GLAutoDrawable) obj;
- for (wait=0; wait<POLL_DIVIDER && realized != glad.isRealized(); wait++) {
- Thread.sleep(TIME_SLICE);
+ while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ t1 = System.currentTimeMillis();
}
} else {
throw new RuntimeException("Neither AWT nor NEWT nor GLAutoDrawable: "+obj);
}
- return wait<POLL_DIVIDER;
+ return (t1-t0) < TIME_OUT;
}
/**
diff --git a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
index e49679d..99db075 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.util;
@@ -37,7 +37,7 @@ public class DumpGLInfo implements GLEventListener {
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- System.err.println(JoglVersion.getGLInfo(gl, null));
+ System.err.println(JoglVersion.getGLInfo(gl, null, true));
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
diff --git a/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java b/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java
index b121a4c..b0f6e2c 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -35,14 +35,14 @@ public class GLEventListenerCounter implements GLEventListener {
public int displayCount = 0;
public int reshapeCount = 0;
public int disposeCount = 0;
-
+
public void reset() {
initCount = 0;
displayCount = 0;
reshapeCount = 0;
- disposeCount = 0;
+ disposeCount = 0;
}
-
+
@Override
public void init(GLAutoDrawable drawable) {
initCount++;
@@ -50,7 +50,7 @@ public class GLEventListenerCounter implements GLEventListener {
@Override
public void dispose(GLAutoDrawable drawable) {
- disposeCount++;
+ disposeCount++;
}
@Override
@@ -61,5 +61,9 @@ public class GLEventListenerCounter implements GLEventListener {
@Override
public void reshape(GLAutoDrawable d, int x, int y, int width, int height) {
reshapeCount++;
- }
+ }
+
+ public String toString() {
+ return "GLEventListenerCounter[init "+initCount+", dispose "+disposeCount+", reshape "+reshapeCount+", display "+displayCount+"]";
+ }
}
\ No newline at end of file
diff --git a/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java
index c407843..a32e995 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,22 +20,23 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.util;
import java.util.EventObject;
import java.util.List;
public interface InputEventCountAdapter extends EventCountAdapter {
+ int getConsumedCount();
int getCount();
boolean isPressed();
-
- public List<EventObject> getQueued();
+
+ public List<EventObject> copyQueue();
public int getQueueSize();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
index d143b3c..0e86afd 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.util;
import java.util.ArrayList;
@@ -41,6 +41,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
String prefix;
int keyPressed, keyReleased;
int keyPressedAR, keyReleasedAR;
+ int consumed;
boolean pressed;
List<EventObject> queue = new ArrayList<EventObject>();
boolean verbose = true;
@@ -49,29 +50,33 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
this.prefix = prefix;
reset();
}
-
- public synchronized void setVerbose(boolean v) { verbose = false; }
+
+ public synchronized void setVerbose(boolean v) { verbose = v; }
public synchronized boolean isPressed() {
return pressed;
}
-
+
public synchronized int getCount() {
return keyReleased;
}
+ public synchronized int getConsumedCount() {
+ return consumed;
+ }
+
public synchronized int getKeyPressedCount(boolean autoRepeatOnly) {
- return autoRepeatOnly ? keyPressedAR: keyPressed;
+ return autoRepeatOnly ? keyPressedAR: keyPressed;
}
-
+
public synchronized int getKeyReleasedCount(boolean autoRepeatOnly) {
- return autoRepeatOnly ? keyReleasedAR: keyReleased;
+ return autoRepeatOnly ? keyReleasedAR: keyReleased;
}
-
- public synchronized List<EventObject> getQueued() {
- return queue;
+
+ public synchronized List<EventObject> copyQueue() {
+ return new ArrayList<EventObject>(queue);
}
-
+
public synchronized int getQueueSize() {
return queue.size();
}
@@ -79,6 +84,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
public synchronized void reset() {
keyPressed = 0;
keyReleased = 0;
+ consumed = 0;
keyPressedAR = 0;
keyReleasedAR = 0;
pressed = false;
@@ -96,10 +102,13 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
System.err.println("KEY NEWT PRESSED ["+pressed+"]: "+prefix+", "+e);
}
}
-
+
public synchronized void keyReleased(KeyEvent e) {
pressed = false;
keyReleased++;
+ if(e.isConsumed()) {
+ consumed++;
+ }
if( 0 != ( e.getModifiers() & InputEvent.AUTOREPEAT_MASK ) ) {
keyReleasedAR++;
}
@@ -108,7 +117,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
System.err.println("KEY NEWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
-
- public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+"]"; }
+
+ public String toString() { return prefix+"[pressed "+pressed+", keysPressed "+keyPressed+" (AR "+keyPressedAR+"), keyReleased "+keyReleased+" (AR "+keyReleasedAR+"), consumed "+consumed+"]"; }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java
index 9909309..89bafbd 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -37,11 +37,15 @@ import com.jogamp.common.util.IntIntHashMap;
import com.jogamp.newt.event.KeyEvent;
public class NEWTKeyUtil {
+ public static final int TIME_OUT = 2000; // 2s
+ public static final int POLL_DIVIDER = 20; // TO/20
+ public static final int TIME_SLICE = TIME_OUT / POLL_DIVIDER ;
+
public static class CodeSeg {
public final short min;
public final short max;
public final String description;
-
+
public CodeSeg(int min, int max, String description) {
this.min = (short)min;
this.max = (short)max;
@@ -52,23 +56,23 @@ public class NEWTKeyUtil {
public final short code;
public final String description;
public final KeyEvent event;
-
+
public CodeEvent(short code, String description, KeyEvent event) {
this.code = code;
this.description = description;
this.event = event;
}
public String toString() {
- return "Code 0x"+Integer.toHexString( (int)code & 0x0000FFFF )+" != "+event+" // "+description;
+ return "Code 0x"+Integer.toHexString( code & 0x0000FFFF )+" != "+event+" // "+description;
}
}
-
+
public static void dumpKeyEvents(List<EventObject> keyEvents) {
for(int i=0; i<keyEvents.size(); i++) {
System.err.println(i+": "+keyEvents.get(i));
- }
+ }
}
-
+
public static boolean validateKeyCodes(CodeSeg[] codeSegments, List<List<EventObject>> keyEventsList, boolean verbose) {
final List<CodeEvent> missCodes = new ArrayList<CodeEvent>();
int totalCodeCount = 0;
@@ -78,7 +82,7 @@ public class NEWTKeyUtil {
totalCodeCount += codeSeg.max - codeSeg.min + 1;
final List<EventObject> keyEvents = keyEventsList.get(i);
res &= validateKeyCodes(missCodes, codeSeg, keyEvents, verbose);
- }
+ }
if(verbose) {
System.err.println("*** Total KeyCode Misses "+missCodes.size()+" / "+totalCodeCount+", valid "+res);
for(int i=0; i<missCodes.size(); i++) {
@@ -104,7 +108,7 @@ public class NEWTKeyUtil {
missCodes.add(new CodeEvent(c, codeSeg.description, e));
misses++;
}
- evtIdx += 2;
+ evtIdx += 2;
}
}
final boolean res = evtIdx == keyEvents.size() && 0 == missCodes.size();
@@ -113,7 +117,7 @@ public class NEWTKeyUtil {
}
return res;
}
-
+
public static void validateKeyEvent(KeyEvent e, short eventType, int modifiers, short keyCode, char keyChar) {
if(0 <= eventType) {
Assert.assertTrue("KeyEvent type mismatch, expected 0x"+Integer.toHexString(eventType)+", has "+e, eventType == e.getEventType());
@@ -126,24 +130,24 @@ public class NEWTKeyUtil {
}
if(KeyEvent.NULL_CHAR != keyChar) {
Assert.assertTrue("KeyEvent char mismatch, expected 0x"+Integer.toHexString(keyChar)+", has "+e, keyChar == e.getKeyChar());
- }
+ }
}
-
+
public static short getNextKeyEventType(KeyEvent e) {
final int et = e.getEventType();
switch( et ) {
case KeyEvent.EVENT_KEY_PRESSED:
return KeyEvent.EVENT_KEY_RELEASED;
case KeyEvent.EVENT_KEY_RELEASED:
- return KeyEvent.EVENT_KEY_PRESSED;
+ return KeyEvent.EVENT_KEY_PRESSED;
default:
Assert.assertTrue("Invalid event "+e, false);
return 0;
}
}
-
+
public static void validateKeyEventOrder(List<EventObject> keyEvents) {
- IntIntHashMap keyCode2NextEvent = new IntIntHashMap();
+ IntIntHashMap keyCode2NextEvent = new IntIntHashMap();
for(int i=0; i<keyEvents.size(); i++) {
final KeyEvent e = (KeyEvent) keyEvents.get(i);
int eet = keyCode2NextEvent.get(e.getKeyCode());
@@ -154,9 +158,9 @@ public class NEWTKeyUtil {
Assert.assertEquals("Key event not in proper order "+i+"/"+keyEvents.size()+" - event "+e, eet, et);
eet = getNextKeyEventType(e);
keyCode2NextEvent.put(e.getKeyCode(), eet);
- }
+ }
}
-
+
/**
* @param keyAdapter
* @param expPressedCountSI number of single key press events
@@ -164,46 +168,46 @@ public class NEWTKeyUtil {
* @param expPressedCountAR number of auto-repeat key press events
* @param expReleasedCountAR number of auto-repeat key release events
*/
- public static void validateKeyAdapterStats(NEWTKeyAdapter keyAdapter,
- int expPressedCountSI, int expReleasedCountSI,
+ public static void validateKeyAdapterStats(NEWTKeyAdapter keyAdapter,
+ int expPressedCountSI, int expReleasedCountSI,
int expPressedCountAR, int expReleasedCountAR) {
final int expPressReleaseCountSI = expPressedCountSI + expReleasedCountSI;
final int expPressReleaseCountAR = expPressedCountAR + expReleasedCountAR;
final int expPressReleaseCountALL = expPressReleaseCountSI + expPressReleaseCountAR;
-
+
final int keyPressedALL = keyAdapter.getKeyPressedCount(false);
final int keyPressedAR = keyAdapter.getKeyPressedCount(true);
final int keyReleasedALL = keyAdapter.getKeyReleasedCount(false);
final int keyReleasedAR = keyAdapter.getKeyReleasedCount(true);
-
+
final int keyPressedSI = keyPressedALL-keyPressedAR;
final int keyReleasedSI = keyReleasedALL-keyReleasedAR;
-
+
final int pressReleaseCountALL = keyPressedALL + keyReleasedALL;
final int pressReleaseCountSI = keyPressedSI + keyReleasedSI;
final int pressReleaseCountAR = keyPressedAR + keyReleasedAR;
System.err.println("Expec Single Press "+expPressedCountSI +", Release "+expReleasedCountSI);
System.err.println("Expec AutoRp Press "+expPressedCountAR +", Release "+expReleasedCountAR);
-
+
System.err.println("Total Single Press "+keyPressedSI +", Release "+keyReleasedSI +", Events "+pressReleaseCountSI);
System.err.println("Total AutoRp Press "+keyPressedAR +", Release "+keyReleasedAR +", Events "+pressReleaseCountAR);
System.err.println("Total ALL Press "+keyPressedALL +", Release "+keyReleasedALL +", Events "+pressReleaseCountALL);
-
+
Assert.assertEquals("Internal Error: pressReleaseSI != pressReleaseALL - pressReleaseAR", pressReleaseCountSI, pressReleaseCountALL - pressReleaseCountAR);
-
+
Assert.assertEquals("Key press count failure (SI)", expPressedCountSI, keyPressedSI);
Assert.assertEquals("Key released count failure (SI)", expReleasedCountSI, keyReleasedSI);
Assert.assertEquals("Key press count failure (AR)", expPressedCountAR, keyPressedAR);
Assert.assertEquals("Key released count failure (AR)", expReleasedCountAR, keyReleasedAR);
-
+
Assert.assertEquals("Key pressRelease count failure (SI)", expPressReleaseCountSI, pressReleaseCountSI);
Assert.assertEquals("Key pressRelease count failure (AR)", expPressReleaseCountAR, pressReleaseCountAR);
-
- final List<EventObject> keyEvents = keyAdapter.getQueued();
-
+
+ final List<EventObject> keyEvents = keyAdapter.copyQueue();
+
Assert.assertEquals("Key pressRelease count failure (ALL) w/ list sum ", expPressReleaseCountALL, pressReleaseCountALL);
Assert.assertEquals("Key total count failure (ALL) w/ list size ", pressReleaseCountALL, keyEvents.size());
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java
index 6445237..22e241f 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.util;
import java.util.ArrayList;
@@ -39,6 +39,7 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda
String prefix;
int mouseClicked;
+ int consumed;
boolean pressed;
List<EventObject> queue = new ArrayList<EventObject>();
boolean verbose = true;
@@ -48,26 +49,31 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda
reset();
}
- public synchronized void setVerbose(boolean v) { verbose = false; }
-
+ public synchronized void setVerbose(boolean v) { verbose = v; }
+
public synchronized boolean isPressed() {
return pressed;
}
-
+
public synchronized int getCount() {
return mouseClicked;
}
- public synchronized List<EventObject> getQueued() {
- return queue;
+ public synchronized int getConsumedCount() {
+ return consumed;
}
-
+
+ public synchronized List<EventObject> copyQueue() {
+ return new ArrayList<EventObject>(queue);
+ }
+
public synchronized int getQueueSize() {
return queue.size();
}
public synchronized void reset() {
mouseClicked = 0;
+ consumed = 0;
pressed = false;
queue.clear();
}
@@ -79,7 +85,7 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda
System.err.println("MOUSE NEWT PRESSED ["+pressed+"]: "+prefix+", "+e);
}
}
-
+
public synchronized void mouseReleased(MouseEvent e) {
pressed = false;
queue.add(e);
@@ -87,15 +93,18 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda
System.err.println("MOUSE NEWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
-
+
public synchronized void mouseClicked(MouseEvent e) {
mouseClicked+=e.getClickCount();
+ if(e.isConsumed()) {
+ consumed++;
+ }
queue.add(e);
if( verbose ) {
System.err.println("MOUSE NEWT CLICKED ["+mouseClicked+"]: "+prefix+", "+e);
}
}
-
- public String toString() { return prefix+"[pressed "+pressed+", clicked "+mouseClicked+"]"; }
+
+ public String toString() { return prefix+"[pressed "+pressed+", clicked "+mouseClicked+", consumed "+consumed+"]"; }
}
diff --git a/www/2125.pdf b/www/2125.pdf
deleted file mode 100644
index dbd2e58..0000000
Binary files a/www/2125.pdf and /dev/null differ
diff --git a/www/3167.pdf b/www/3167.pdf
deleted file mode 100644
index 5d61b89..0000000
Binary files a/www/3167.pdf and /dev/null differ
diff --git a/www/BOF-3908-JOGL-slides.pdf b/www/BOF-3908-JOGL-slides.pdf
deleted file mode 100644
index 710f2e8..0000000
Binary files a/www/BOF-3908-JOGL-slides.pdf and /dev/null differ
diff --git a/www/JOGLGlueGen.pdf b/www/JOGLGlueGen.pdf
deleted file mode 100644
index df67d05..0000000
Binary files a/www/JOGLGlueGen.pdf and /dev/null differ
diff --git a/www/License_TCK_JSR231.pdf b/www/License_TCK_JSR231.pdf
deleted file mode 100644
index 0812a0d..0000000
Binary files a/www/License_TCK_JSR231.pdf and /dev/null differ
diff --git a/www/bof0899.pdf b/www/bof0899.pdf
deleted file mode 100644
index fc2bc87..0000000
Binary files a/www/bof0899.pdf and /dev/null differ
diff --git a/www/index.html b/www/index.html
deleted file mode 100644
index ff81a77..0000000
--- a/www/index.html
+++ /dev/null
@@ -1,654 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href="../../style.css" rel="stylesheet" type="text/css"/>
- <title>JOGL - Java Binding for the OpenGL API</title>
- <link href="../../SocialCoding/logo_symbol_finals/website_final_blue_favicon_symbol_16x16pel.ico" rel="shortcut icon"/>
- </head>
- <body>
- <div id="container">
- <div id="header">
- <div id="slogan"><img src="../../images/jogamp_symbols/website_final_sideslogan_jogl_404x20pel.png" alt="Java Binding for the OpenGL® API"/></div>
- <div id="logo"><a href="http://jogamp.org/"><img src="../../images/jogamp_symbols/website_final_blue_jogl_346x70pel.png" alt="JOGL Symbol"/></a></div>
- </div>
- <div id="menu">
- <ul>
- <li><a href="../../">Home</a></li>
- <li><a href="../../deployment/jogamp-current/jogl-test-applets.html">Tests</a></li>
- <li><a href="../../jogl-demos/www/">Demos</a></li>
- <li><a href="../../deployment/jogamp-next/javadoc/jogl/javadoc/">JavaDoc</a></li>
- <li><a href="../../gluegen/www/">Gluegen</a></li>
- <li><a href="../../wiki/">Wiki</a></li>
- <li><a href="../../blog/">Blogs</a></li>
- <li><a href="http://forum.jogamp.org/" target="_blank">Forum</a></li>
- </ul>
- </div>
- <div id="main">
- <div id="sidebar">
- <h3>Useful Links</h3>
- <ul>
- <li><a href="../../">Builds / Downloads</a></li>
- <li><a href="../../deployment/jogamp-next/javadoc/jogl/javadoc/">JavaDoc</a></li>
- <li><a href="../../wiki/index.php/Jogl_Overview">Project Overview</a></li>
- <li><a href="../doc/HowToBuild.html">Building JOGL</a></li>
- <li><a href="../doc/deployment/JOGL-DEPLOYMENT.html">Deploying JOGL</a></li>
- <li><a href="../../wiki/index.php/Jogl_Tutorial">Tutorial</a></li>
- <li><a href="../doc/userguide/">Userguide</a></li>
- <li><a href="../../wiki/index.php/Jogl_FAQ">FAQ</a></li>
- <li><a href="../../git/?p=jogl.git">Code Repository</a></li>
- <li><a href="../../git/?p=jogl-demos.git">Demo Repository</a></li>
- <li><a href="http://www.khronos.org/registry/"><b>Khronos Registry</b></a></li>
- <li><a href="http://www.khronos.org/opengles/sdk/docs/man3/">ES 3 Ref Pages</a></li>
- <li><a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf">ES 3.0 Spec</a></li>
- <li><a href="http://www.khronos.org/registry/gles/specs/3.0/GLSL_ES_Specification_3.00.4.pdf">GLSL ES 3.00 Spec</a></li>
- <li><a href="http://www.khronos.org/files/opengles3-quick-reference-card.pdf">ES 3.0 Ref Card</a></li>
- <li><a href="http://www.opengl.org/registry/"><b>OpenGL Registry</b></a></li>
- <li><a href="http://www.opengl.org/sdk/docs/man4/">GL 4 Ref Pages </a></li>
- <li><a href="http://www.opengl.org/sdk/docs/manglsl/">GLSL Ref Pages </a></li>
- <li><a href="http://www.opengl.org/registry/doc/glspec43.core.20130214.withchanges.pdf">GL 4.3 Core Spec</a></li>
- <li><a href="http://www.opengl.org/registry/doc/glspec43.compatibility.20130214.withchanges.pdf">GL 4.3 Compat. Spec</a></li>
- <li><a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.30.8.pdf">GLSL 4.30 spec</a></li>
- <li><a href="http://www.khronos.org/files/opengl43-quick-reference-card.pdf">GL 4.3 Ref Card</a></li>
- </ul>
- <h3>Presentations</h3>
- <ul>
- <li><a href="../../doc/siggraph2013/">Siggraph 2013</a></li>
- <li><a href="../../doc/fosdem2013/">Fosdem 2013</a></li>
- <li><a href="../../doc/gpunurbs2011/graphicon2011-slides.pdf">NURBS @ GPU</a></li>
- <li><a href="../../doc/siggraph2012/">Siggraph 2012</a></li>
- <li><a href="../../doc/siggraph2011/jogamp-siggraph2011.pdf">Siggraph 2011</a></li>
- <li><a href="../../doc/siggraph2010/jogamp-siggraph2010.pdf">Siggraph 2010</a></li>
- <li><a href="BOF-3908-JOGL-slides.pdf"> JavaOne 2007 BOF Slides</a></li>
- <li><a href="bof0899.pdf">JavaOne 2006 BOF Slides</a></li>
- <li><a href="ts1361.pdf">JavaOne 2004 Slides</a></li>
- <li><a href="2125.pdf">JavaOne 2003 Slides</a></li>
- <li><a href="3167.pdf">JavaOne 2002 Slides</a></li>
- </ul>
- <h3>Papers</h3>
- <ul>
- <li><a href="../../doc/gpunurbs2011/p70-santina.pdf">NURBS @ GPU</a></li>
- </ul>
- <h3>Archive</h3>
- <ul>
- <li><a href="http://jausoft.com/gl4java/">GL4Java</a></li>
- </ul>
- </div>
- <div id="text">
-
- <h3>Overview</h3>
-
- <p>
- The JOGL project hosts the development version of the Java™ Binding for the OpenGL® API,
- and is designed to provide hardware-supported 3D graphics to applications written in Java.
- </p>
- <p>
- JOGL provides full access to the APIs in the OpenGL [ 1.0 .. 4.3 ], ES 1, ES 2 and ES 3 specification
- as well as nearly all vendor extensions.<br/>
- <a href="../doc/Overview-OpenGL-Evolution-And-JOGL.html">OpenGL Evolution & JOGL</a>
- and the <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/overview-summary.html#overview_description">JOGL Specification</a>
- may give you a brief overview.
- </p>
- <p>
- JOGL integrates with the AWT, Swing and SWT widget sets, as well as with custom windowing toolkits using the NativeWindow API.<br/>
- JOGL also provides its own <a href="../doc/NEWT-Overview.html">native windowing toolkit, NEWT</a>.
- </p>
- <p>
- Quick Version Info: Current [ <a href="../../deployment/jogamp-current/jogl-applet-version-napplet.html">NApplet</a>,
- <a href="../../deployment/jogamp-current/jogl-application-version.jnlp">Webstart</a> ],
- Next [ <a href="../../deployment/jogamp-next/jogl-applet-version-napplet.html">NApplet</a>,
- <a href="../../deployment/jogamp-next/jogl-application-version.jnlp">Webstart</a> ].
- </p>
- <p>
- Please see the <a href="../../deployment/jogamp-current/jogl-test-applets.html"><b>JOGL Tests</b></a>
- (<a href="../../deployment/jogamp-next/jogl-test-applets.html"><i>next version</i></a>)
- and <a href="../../jogl-demos/www"><b>JOGL demos</b></a> for illustrations of
- advanced OpenGL techniques now possible with the Java platform.
- </p>
- <!--
- <div class="splash" style="padding: 0; text-align: left; font-size:21px; line-height:100%; position:relative; top:-21px;" >
- <a href="../../wiki/index.php/JogAmp_BOF_SIGGRAPH_2013_PLANNING">Meet us @</a>
- <a href="http://s2013.siggraph.org/attendees/birds-feather/events/jogamp-2d3d-multimedia-across-devices">
- <img style="position:relative; top:+25px;" src="../../doc/siggraph2013/media/siggraph2013-logo_right-transparent-226x55.png" width="226" height="55" alt="JogAmp @ SIGGRAPH 2013"/>
- </a><br/>
- <i style="font-size:10px;">.. and get an awesome T-Shirt free!</i>
- </div> -->
-
- <h3>Featured Projects</h3>
- <p>
- The following are a few examples of projects and products using
- JOGL. To have your project featured here, please email the
- <a href="../../wiki/index.php/Maintainer_and_Contacts">project maintainers</a>.<br/>
-
- <i>Sections:</i> <a href="#feat_apps">Applications</a>, <a href="#feat_utils">Utilities</a>, <a href="#feat_games">Games</a> and
- <a href="#feat_old">Old</a>.
- </p>
- <table border="0" cellpadding="5" cellspacing="1" width="100%">
- <tbody>
- <tr>
- <th colspan="1"><a id="feat_apps">Applications (Content, Simulations, CAD, Scientific, ..)</a></th>
- </tr>
- <tr>
- <td >
- <table border="0" cellspacing="15">
- <tbody>
- <tr>
- <td width="50%">
- <a href="http://c3d.com"><img src="media/c3d-mobile-01-coll01-160x160.png"
- width="160" height="160" align="left" alt="C3D"></img>C3D</a>'s
- <a href="http://c3d.com/index.php?option=com_content&view=section&layout=blog&id=5&Itemid=65">product palette</a>
- for desktop and mobile.
- <a href="http://c3d.com/index.php?option=com_content&view=article&id=46:c3dstudio&catid=34:generalproducts&Itemid=65">C3D Studio</a>
- is a 3D based visual framework for developing visual project control solutions for construction projects.
- C3D Studio provides a dynamic link between the 3D model of the project and the back-end data.
- <a href="http://c3d.com/index.php?option=com_content&view=article&id=47:c3dviewer&catid=34:generalproducts&Itemid=65">C3D Viewer</a>
- is the visualization tool for the 3D Model and related data, which can be linked and displayed for navigation and updates.
- <a href="https://play.google.com/store/apps/details?id=cctintl.c3d.android">C3D Mobile</a>
- allows supervisors to interact with 3D models and details relevant to their tasks on the construction site.
- Models and revisions can be shared using DropBox, Gmail, …etc. while on the move.
- </td>
-
- <td width="50%">
- <a href="http://processing.org/"><img src="media/processing.jpg" width="160" height="158" align="left" alt="Processing"></img>
- Processing</a> is an open
- source programming language and environment for people who want to
- program images, animation, and sound. It is used by students, artists,
- designers, architects, researchers, and hobbyists for learning,
- prototyping, and production. Processing is developed by artists and
- designers as an alternative to proprietary software tools in the same
- domain. It uses JOGL for its hardware accelerated 3D rendering
- support.
- </td>
- </tr>
-
- <tr>
- <td width="50%">
- <a href="http://worldwind.arc.nasa.gov/java/">
- <img src="media/worldwind.jpg" width="160" align="left" alt="World Wind"></img>NASA World Wind Java</a>
- provides a suite of <a href="http://worldwind31.arc.nasa.gov/svn/">open</a>-<a href="https://github.com/wcmatthysen/World-Wind-Java">source</a>
- <a href="http://goworldwind.org/features/">3-D virtual globe technologies</a>
- for Java applications, which can be utilized in user applications.
- Version 2.0 now uses JOGL 2.
- It provides a rich set of features for displaying and interacting with geographic data and representing
- a wide range of geometric objects.
- <a href="http://goworldwind.org/demos/">Online demos</a> are available,
- as well as an <a href="http://www.disti.com/Products/demonstrations/java.html">F-16 Flight Simulator</a>
- from Disti.
- </td>
-
- <td width="50%">
- <a href="http://projects.hepforge.org/frog/ "><img src="media/Frog-Craft3_2.160w.png"
- width="160" height="120" align="left" alt="FROG"></img>FROG</a>
- is a fast OpenGL event display tool mainly developed for visualization of data
- in the field of high energy physics. FROG is mostly used to visualized/animate data
- from proton/proton collision produced in the CMS experiment at the LHC, CERN, Switzerland.
- Animations produced by this tools are frequently used to share the progress of the
- CMS experiment with the media of the world
- (animations are often visible on scientific website or even on TV).
-
- FROG has recently been ported to Java and is now using JOGL
- and also offers an
- <a href="http://projects.hepforge.org/frog/Downloads/jfrog/jfrog_web.jnlp ">online demonstration</a>.
- </td>
- </tr>
-
- <tr>
- <td width="50%">
- <a href="http://www.scilab.org/"><img src="media/scilab.png" width="160" height="159" align="left" alt="Scilab"></img>
- Scilab</a> is a free scientific software
- package for numerical computations providing a powerful open computing
- environment for engineering and scientific applications. It has
- sophisticated data structures, an interpreter and a high level
- programming language. It also integrates a 2-D and 3-D plotting module
- designed to visually represent and understand complex data. Fully
- integrated within the Scilab's Swing UI, the plotting module is based
- on JOGL, allowing it to take advantage of the OpenGL accelerated
- graphics.
- </td>
-
- <td >
- <a href="http://www3.math.tu-berlin.de/jreality/index.php?article_id=1"><img src="media/jreality-logo-discreteksurfaces.png"
- width="160" height="105" align="left" alt="jReality"></img>jReality</a>
- is a Java based, open-source, full-featured 3D scene graph package designed for 3D visualization and specialized in mathematical visualization.
- It provides several backends, including a JOGL one for Java based OpenGL rendering. JReality is thread-safe,
- has a flexible shading model based on an attribute-inheritance mechanism in the scene graph, device-independent user interaction and support
- for 3D audio (JACK). It has a plugin system for assembling custom viewers,
- <a href="http://www3.math.tu-berlin.de/jreality/phpbb/">an active forum</a> and a growing set of
- <a href="http://www3.math.tu-berlin.de/jreality/mediawiki/index.php/Developer_Tutorial">tutorial examples</a>
- to help developers interested in using jReality to solve their Java 3D problems.
- For further information please look <a href="http://www3.math.tu-berlin.de/jreality/index.php?article_id=29">here</a>.
- </td>
- </tr>
-
- <tr>
- <td width="50%">
- <a href="http://biojava.org/wiki/RCSB_Viewers:About"><img src="media/mbt.jpg" width="160" height="122" align="left" alt="Molecular Biology Toolkit"></img></a>
- <a href="http://biojava.org/">BioJava</a>
- is an <a href="https://github.com/biojava">open-source</a> project dedicated to providing a Java framework for processing biological data. It provides analytical and statistical routines, parsers for common file formats and allows the manipulation of sequences and 3D structures.
- <a href="http://biojava.org/wiki/RCSB_Viewers:About">The RCSB Viewers suite</a> of frameworks provides the capability of creating 3-d viewing applications. The libraries are Java based, and use JOGL for 3d rendering.
- Some visualization tools are <a
- href="http://www.rcsb.org/">RCSB Protein Data Bank</a> (<a
- href="http://www.rcsb.org/pdb/explore/viewerLaunch.do?viewerType=PW&structureId=3VTQ&unit=bio&unit_id=1">Example</a>) and
- <a href="http://www.iedb.org/">Epitode Database</a>
- (<a href="http://www.iedb.org/browse_by_3D.php?name=TCELL&mhc_allele_id=143_9606_Homo_sapiens_TCELL">Windows only</a>).
- </td>
-
- <td width="50%">
- <a href="http://www.geogebra.org/"><img src="media/geogebra-screenshot-tangents.png" width="160" align="left" alt="GeoGebra"></img>GeoGebra</a>
- is free and multi-platform dynamic mathematics software for all levels of education that joins geometry, algebra,
- tables, graphing, statistics and calculus in one easy-to-use package.
- It has received several educational software awards in Europe and the USA.
- <a href="http://www.geogebra.org/forum/viewtopic.php?f=52&t=19846">GeoGebra 5.0</a> has experimental 3D support utilizing JOGL.
- Misc resources: <a href="https://dev.geogebra.org/trac">Developer Wiki</a>, <a href="http://dev.geogebra.org/svn">SVN Repository</a>.
- </td>
- </tr>
-
- <tr>
- <td width="50%">
- <a href="http://gephi.org/"><img src="media/gephi.jpg" width="160" height="122" align="left" alt="Gephi"></img>
- Gephi</a> is a tool for people that have to explore and understand graphs. Like Photoshop but for data,
- the user interacts with the representation, manipulate the structures, shapes and colors to reveal hidden properties.
- The goal is to help data analysts to make hypothesis, intuitively discover patterns, isolate structure singularities or
- faults during data sourcing. It is a complementary tool to traditional statistics,
- as visual thinking with interactive interfaces is now recognized to facilitate reasoning.
- This is a software for Exploratory Data Analysis, a paradigm appeared in the Visual Analytics field of research.
- </td>
-
- <td width="50%">
- <a href="https://github.com/AusencoSimulation/JaamSim">
- <img src="media/JaamSim_160x120.png" width="160" height="120" align="left" alt="Volume Viewer"></img>JaamSim</a>
- is a discrete-event simulation environment developed by Ausenco Sandwell as
- the foundation of all our simulation applications. It includes
- interactive 3d graphics, drag and drop model building, collada model
- import and is fully open source (GPLv3).
- </td>
- </tr>
- <tr>
- <td width="50%">
- <a href="http://volumeviewer.kenai.com/">
- <img src="media/VolumeViewer-160x120.png" width="160" height="120" align="left" alt="Volume Viewer"></img>Volume Viewer</a>
- is an open source renderer for 3D volumetric data. It provides tools for coloring your model,
- cutting away pieces, and viewing it from any angle. It can cast shadows within the model for extra realism.
- You can even upload your own volumetric data and view it in real time.
- </td>
-
- <td width="50%">
- <a href="http://jzy3d.org/">
- <img src="media/jzy3d-demo-surface-160x160.png" width="160" height="160" align="left" alt="Jzy3D"></img>
- Jzy3d</a>
- stands for Java Easy 3d, and allows a rapid display of 3d scientific
- data. User can define z=f(x,y) functions binded to (customizable)
- colormaps, as well as rendering predefined simple 3d shapes
- programmaticaly or from csv files.
- One can moreover add pre/post renderers for adding java2d layers
- to the 3d scene. Jzy3d provides a simple bridge to AWT, SWT, or
- Swing, and has already been integrated in Eclipse RCP
- and Swing applications. The API releases one of the burden
- of working with OpenGL,
- 3d polygon ordering and transparency management.
- </td>
- </tr>
- <tr>
- <td width="50%">
- <a href="http://www.brightideassoftware.com/Pebbles/PebblesHome.aspx">
- <img src="media/pebbles.png" width="160" align="left" alt="OneStone Pebbles"></img>
- OneStone® Pebbles</a> are a new series of calculus visualization tools developed
- by <a href="http://www.brightideassoftware.com/">Bright Ideas Software®</a>.
- Each 'Pebble' in the series is a stand-alone
- program designed to illustrate a specific topic in the calculus
- syllabus. While the topic of each Pebble is different, the experience
- of using each remains as constant as possible, and features several
- elements identified as contributing to the development of a deeper
- understanding of dynamic covariant relationships. The Pebbles use JOGL
- for their interactive 3D rendering. Try the
- <a href="http://www.brightideassoftware.com/Pebbles/CurveFamilies.aspx"> Curve Families</a> and
- <a href="http://www.brightideassoftware.com/Pebbles/SurfacesOfRevolution.aspx">Surfaces of Revolution</a> examples!
- </td>
-
- <td width="50%">
- <a href="http://www.impact-fem.org/"><img src="media/Impact_Bullet_AKM.in-1.png" width="160" align="left" alt="Impact"></img>
- Impact</a> is a
- complete finite element suite including preprocessor, solver and
- postprocessor which is useable for simulating dynamic events such as
- car crashes or stamping of metal sheets. The suite allows 3D
- modelling, solving and viewing of simulation results, all in OpenGL
- accelerated graphics through the use of JOGL.
- </td>
- </tr>
- <tr>
- <td width="50%">
- <a href="http://www.insparia.com/"><img src="media/insparia-160x132.jpg" width="160" height="132" align="left" alt="Insparia"></img>
- Insparia</a> was created to help people
- easily visualize, construct and track information about a 3d
- environment online. Shape and texture importing as well as a robust
- renderer will be available in the final commercial version. Insparia
- uses JOGL to allow the user to construct and interact with their 3d
- environment in real-time. Please note that Insparia is in alpha
- testing. Feedback is appreciated.
- </td>
- <td width="50%">
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- <tr>
- <th colspan="1"><a id="feat_utils">Utilities, Libraries, Building blocks</a></th>
- </tr>
- <tr>
- <td >
- <table border="0" cellspacing="15">
- <tbody>
- <tr>
- <td width="50%">
- <a href="http://jmonkeyengine.org/"><img src="media/jmonkeyengine.png"
- width="160" align="left" alt="jMonkeyEngine"></img>jMonkeyEngine</a>
- is a game engine made for developers who want to create 3D games following modern technology standards.
- The framework is programmed entirely in Java aimed at wide accessibility and quick deployment to desktop, web, and mobile platforms.<br/>
- Currently <a href="../../wiki/index.php/Maintainer_and_Contacts#Julien_Gouesse">Julien Gouesse</a>
- develops a <a href="http://jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/jogl-support-jogl2-that-is/">JOGL backend for jME3</a>
- with support of the jME team. <i>NEWT support</i> is also underway, which will allow jME3 to run <i>on mobile devices</i> as long
- proper <a href="http://jogamp.org/jogl/doc/Overview-OpenGL-Evolution-And-JOGL.html">JOGL/OpenGL</a>
- <a href="http://jogamp.org/jogl/doc/bouml/html/fig128069.png">profile separation</a> is being used.
- </td>
-
- <td width="50%">
- <a href="http://ardor3d.com/"><img src="media/ardor3d.png"
- width="160" align="left" alt="Ardor3D"></img>Ardor3D</a>
- is a professionally oriented, open source, Java based 3D engine brought to you by <a href="http://www.ardorlabs.com/">Ardor Labs</a>.<br/>
- <a href="../../wiki/index.php/Maintainer_and_Contacts#Julien_Gouesse">Julien Gouesse</a> started the new JOGL backend development,
- which is now merged into the official trunk.
- </td>
- </tr>
- <tr>
- <td width="50%">
- <a href="http://en.wikipedia.org/wiki/Java_3D"><img src="media/Java3d.png" width="160" align="left" alt="Ardor3D"></img>Java3D</a>
- <a href="http://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/">is back</a>.
- It is maintained by <a href="../../wiki/index.php/Maintainer_and_Contacts#Harvey_Harrison">Harvey Harrison</a> and initially ported to
- our current JOGL version by <a href="../../wiki/index.php/Maintainer_and_Contacts#Julien_Gouesse">Julien Gouesse</a>.<br/>
- Source available via this <a href="https://github.com/hharrison/java3d-core">git repository</a>
- and JAR files can <a href="http://jogamp.org/deployment/java3d/">be downloaded here</a>.
- Our <a href="http://forum.jogamp.org/java3d-f3728156.html">forum</a> may help you with your questions.
- </td>
-
- <td width="50%">
- <a href="http://libgdx.badlogicgames.com/"><img src="media/libgdx.png"
- width="160" height="55" align="left" alt="libGDX"></img>libGDX</a>
- provides a cross-platform API for game and real-time application development. It's powerful abstractions let you chose how you want to write your game or application, w/o a <i>one size fit all</i> approach. The JOGL backend, a <a href="http://forum.jogamp.org/JOGL-2-0-OpenGL-OpenGL-ES-backend-for-LibGDX-td4027689.html">team effort of the JogAmp community</a>, allows libGDX applications to be deployed on desktop and mobile platforms. Sou [...]
- LibGDX is released under the Apache 2.0 license.
- </td>
- </tr>
- <tr>
- <td width="50%">
- <a href="http://nifty-gui.lessvoid.com/"><img src="media/nifty-logo-new.png" width="160" align="left" alt="Nifty GUI"></img>
- Nifty GUI</a> is a Java Library that supports the building of interactive user interfaces for games or similar applications.
- The configuration of the GUI is stored in xml files with little supporting Java code.
- In short Nifty helps you to layout stuff, display it in a cool way and interact with it :)<br/>
- Source code is available in this <a href="https://github.com/void256/nifty-gui">git repository</a>.
- JOGL is one renderer backend besides others.
- </td>
- <td width="50%">
- <a href="http://brandonborkholder.github.com/glg2d/"><img src="media/glg2d-demo.png" width="160" align="left" alt="GLG2D"></img>
- GLG2D</a> is a Graphics2D implementation that uses OpenGL to implement basic Java2D drawing functionality.
- We currently use the fixed function pipeline, with the GL2 profile for most functionality.
- But a shader implementation is in the pipeline (so to speak).
- See <a href="http://brandonborkholder.github.com/glg2d/implementationstatus.html">implementation status</a>
- for which features are fully implemented.
- </td>
- </tr>
- <tr>
- <td width="50%">
- <a href="http://mvn.io7m.com/jspatial/">
- <img src="media/jspatial-1-160x160.png" width="160" align="left" alt="dyn4j"></img>jspatial</a>
- implements a set of spatial data structures. It
- features Quadtree and Octtree implementations, including efficient area
- and raycast queries. It has numerous working examples and full
- documentation including tutorials and JavaDoc. It includes a test suite
- with 97% automated unit test coverage. It is platform and
- rendering-system independent, but uses JOGL for the included example
- Octtree viewer. The code is under the extremely liberal ISC
- (BSD-like) license.
- </td>
-
- <td width="50%">
- <a href="http://www.dyn4j.org/"><img src="media/dyn4j.png"
- width="160" align="left" alt="dyn4j"></img>dyn4j</a>
- is a 100% Java 2D collision detection and physics engine. Designed to be fast, stable, extensible, and easy to use.
- dyn4j is free for use in commercial and non-commercial applications and licensed under the New BSD License.
- The project comprises hundreds of JUnit test cases, Sandbox: a GUI test application, two example applications (ExampleGraphics2D and ExampleJOGL),
- Javadocs, wiki, forum, and more!
- </td>
- </tr>
- <tr>
- <td width="50%">
- <a href="http://www.disti.com/Products/glstudio/index.html"><img
- src="media/glstudio.jpg" width="160" height="135" align="left" alt="GL Studio"></img>
- GL Studio</a> is an object oriented rapid application
- development tool that allows a user to graphically combine
- photographs, 3D models and behavior logic to create advanced 2D and 3D
- human machine interfaces. GL Studio generates Java or C++ source code
- which can then be integrated into the user’s application as a user
- interface.
- Java code using JOGL can be exported.
- An <a href="http://www.disti.com/Products/demonstrations/java.html">F-16 Flight Simulator using NASA World Wind is demonstrated</a>.
- </td>
- <td width="50%">
- <a href="http://www.dok-ing.hr/solutions/myhmi"><img src="media/MyHmi-Collage-160x152.png"
- width="160" height="152" align="left" alt="MyHMI"></img>MyHMI</a>
- is a Java based object oriented software framework for industrial graphical user interfaces development.
- It enables creation of visually adjustable interfaces for embedded systems, independently of underlying OS
- or hardware platform, communication or data processing mechanisms.
- An expressive and comprehensive 3D visualization MyHMI provides, is based on
- a low level OpenGL and OpenGL ES standards and a higher interlayer
- based on JOGL enabling multiplatform compatibility.
- </td>
- </tr>
- <tr>
- <td width="50%">
- <a href="http://jebgl.com/"><img src="media/JebGL_logo.160w.png"
- width="160" height="87" align="left" alt="JebGL"></img>JebGL</a>
- is a piece of Javascript which lets you run your WebGL apps in browsers lacking WebGL support without having to modify your existing code!
- Behind the scenes JebGL uses a fallback Java applet to emulate the WebGL canvas if needed, and the Java applet runs hardware accelerated
- on all platforms using JOGL.
- JebGL is released under the MIT license.
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- <tr>
- <th colspan="1"><a id="feat_games">Games</a></th>
- </tr>
- <tr>
- <td >
- <table border="0" cellspacing="15">
- <tbody>
- <tr>
- <td width="50%">
- <a href="http://store.steampowered.com/app/108200/"><img src="media/ticket2ride_picture5-160x132.jpg"
- width="160" height="132" align="left" alt="Ticket to Ride"></img>Ticket to Ride</a>
- and <a href="http://store.steampowered.com/app/108210/">Memoir '44</a> are boardgames published by
- <a href="http://www.daysofwonder.com/">Days of Wonder</a>.
- They also make digital versions of these games since 2006. These are available on all desktops computers (Windows, MacOS and Linux),
- thanks to the use of Java and JOGL.
- This has proven to be the best solution to create the same gaming experience on all desktop computers with a single code base.
- The games are available on Steam. Days of Wonder is currently porting their engine to JOGL2, allowing the inclusion of Android devices.
- </td>
-
- <td width="50%">
- <a href="http://www.everplanes.com/"><img src="media/EverplanesLogo_160x160.png" width="122" height="122" align="left" alt="Everplanes"></img>
- Everplanes</a> is a game of exploration, building, survival and strategy.
- It introduces new gameplay, resources and challenges in the updates.
- Each time the game is started, it automatically downloads the latest updates.
- The game includes a built-in server for LAN or Internet play.
- You can run an open server, or configure various levels of access control.
- Everplanes features a built-in server browser and also includes global chat facility.
- Everplanes is available for Mac OS X 10.4+, Windows XP/Vista/7 and Linux.
- </td>
- </tr>
-
- <tr>
- <td width="50%">
- <a href="http://www.codefrontiers.com/page/elflight-engine/"><img src="media/elflightengine-160x122.png" width="160" height="122" align="left" alt="Elflight Engine"></img>
- The Elflight Engine</a> is a games engine designed for the web.
- It supports hardware accelerated 3D games and applications in a web browser,
- with the ability to import assets from major 3D packages such as Maya and 3D Studio.
- The focus of the engine's architecture is minimal startup time, fast streaming, local
- caching and collaborative real-time editing. The Elflight Engine is multi-user and so
- lends itself to the development of virtual worlds and MMOs.
- </td>
-
- <td width="50%">
- <a href="http://bytonic.de/html/jake2.html">
- <img src="media/jake2-160x160.png" width="160" height="128" align="left" alt="Jake2"></img>Jake2</a> is a port
- of id Software's GPL'd Quake II engine from C to Java done by <a
- href="http://bytonic.de/">bytonic software</a>.<br/>
- Jake2 has been ported to the current JOGL version for desktop OpenGL and mobile OpenGL ES1 and ES2 use
- including dropping AWT in favor of NEWT.
- You can run the game online as an
- <a href="http://jogamp.org/deployment/test/jake2/jake2-napplet01.html">NApplet</a>
- or via <a href="http://jogamp.org/deployment/test/jake2/jake2_jogl.jnlp">Webstart</a>
- on all of JOGL's supported platforms.<br/>
- You can find the current source code in this
- <a href="http://jogamp.org/git/?p=users/sgothel/jake2.git;a=summary">git repository</a>.
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- <tr>
- <th colspan="1"><a id="feat_old">Older projects ...</a></th>
- </tr>
- <tr>
- <td >
- <table border="0" cellspacing="15">
- <tbody>
- <tr>
- <td width="50%">
-
- <a href="http://chronotext.org/"><img src="media/chronotext.jpg" width="160" height="120" align="left" alt="chronotext"></img>
- chronotext</a> is a series
- of visual design experiments involving animated text and 3D objects
- and surfaces. Several examples can be run on-line via <a
- href="http://chronotext.org/scriptorium/behind/index.htm">Java Web
- Start</a>. See the <a href="http://www.chronotext.org/mapping/">latest
- experiments</a> of mapping text on to real 3D surfaces.
- </td>
-
- <td width="50%">
- <a href="http://3d-alignment.eu"><img src="media/strap.jpg" width="160" height="118" align="left" alt="STRAP"></img></a>
- With <a href="http://3d-alignment.eu">STRAP</a> you can align your proteins by
- sequence and 3D-structure. STRAP simultaneously displays
- 3d-structures, amino acid sequence alignment and nucleotide sequences.
- It has powerful annotation features.
- </td>
- </tr>
-
- <tr>
- <td width="50%">
- <a href="http://www.artofillusion.org/"><img src="media/artofillusion.jpg" width="160" height="117" align="left" alt="Art Of Illusion"></img>
- Art of Illusion</a> is a free, open source 3D modelling and rendering
- studio. Many of its capabilities rival those found in commercial
- programs. Some of the highlights include subdivision surface based
- modelling tools, skeleton based animation, and a graphical language
- for designing procedural textures and materials. It uses JOGL for
- real-time OpenGL rendering in its modeling views.
- </td>
-
- <td width="50%">
- <a href="http://www.insightmachines.com/en/vehicleDynamicsEngine.shtml">
- <img src="media/vehicle.jpg" width="160" height="117" align="left" alt="Vehicle Dynamics Engine Demo"></img>Vehicle Dynamics Engine Demo</a>
- is a Java Web Start demonstration of a 3D physics engine developed by
- <a href="http://www.insightmachines.com/">Insight Machines</a>. The
- engine is designed especially for car games. The demo uses JOGL and
- employs such techniques like shadow casting using the stencil buffer.
- </td>
- </tr>
-
- <tr>
- <td width="50%">
- <a href="http://www.sculpteo.com"><img src="media/sculpteo_3_robot_72dpi_sm.jpg" width="160" height="79" align="left" alt="Sculpteo"></img>
- Sculpteo</a> offers a 3D printing service, fast and available for everyone.
- Starting from a 3D design, Sculpteo makes a specific object : interior decoration, characters, robots, miniatures, models, mechanic objects...
- </td>
- <td width="50%">
- <a href="http://www.fenggui.org/"><img src="media/fenggui.jpg" width="160" height="108" align="left" alt="FengGUI"></img>
- FengGUI</a> is a graphical
- user interface (GUI) application programming interface (API) based on
- OpenGL. FengGUI provides all typical GUI components like buttons,
- sliders, trees, text areas, frames, tabs, etc. which are required to
- build a complete GUI system. Since it is based on OpenGL, FengGUI fits
- well in multimedia and game environments.
- </td>
- </tr>
-
- <tr>
- <td width="50%">
- <a href="http://www.fusion-laboratory.de/"><img
- src="media/fusion_logo.jpg" width="135" height="57" align="left"
- alt="Fusion Laboratory"></img>The Fusion Framework</a> enables Swing
- components to be extended with 3D content via JOGL.
- In general the 3D content will show up in layers on top of the corresponding Swing
- component. The system provides a simple scenegraph, Swing-like mouse interaction, and low-level
- animation support, as well as GLSL shaders and .obj file loading. The
- demo page contains several Java Web Start applications.
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- <tr>
- <th colspan="1">Discontinued projects</th>
- </tr>
- <!--- abandoned JOGL ..
- <tr>
- <td >
- <table border="0" cellspacing="15">
- <tbody>
- <tr>
- <td >
- <a href="http://openendedgroup.com/field"><img src="media/field.png"
- width="160" height="159" align="left" alt="Field"></img>Field</a> is an
- open-source development environment for digital art and experimental
- code writing. Built around the needs of programmers that manipulate
- images, make animations and compose music, Field seeks to tie
- text-based programming with ad hoc visual metaphors. Field uses Python
- and other programming languages and wants to be integrated into your
- own personal code-base. And it comes with special support for the <a
- href="http://processing.org/">Processing</a> environment. Field uses
- JOGL for its UI and its built-in drawing system; it provides a
- JOGL-based scene-graph library for 3D visualization.
- </td>
- </tr>
- <td width="50%">
- <a href="http://www.eclipse.org/gef3d/"><img src="http://wiki.eclipse.org/images/thumb/b/be/Gef3d_sample_ecore3D.png/800px-Gef3d_sample_ecore3D.png" width="160" height="94" align="left" alt="GEF3d"></img>
- GEF3D</a> is an Eclipse GEF extension bringing 3D to diagram editing.
- That is with GEF3D you can create 3D diagrams, 2D diagrams and combine
- 3D with 2D diagrams. GEF3D extends GEF by providing 3D enabled draw and
- controller classes. Instead of drawing 2D figures, you can now draw 3D figures.
- Existing GEF-based 2D editors can be embedded into 3D editors with minimal effort.
- </td>
- </tbody>
- </table>
- </td>
- </tr>
- -->
- </tbody>
- </table>
- </div>
- </div>
- <div id="footer">
- <div id="footer_left">
- <span>JogAmp.org</span>
- by <a href="../../">http://jogamp.org</a>
- is licensed under a <br/>
- <a href="http://creativecommons.org/licenses/by/3.0/us/">Creative Commons Attribution 3.0 License</a>.
- </div>
- </div>
- </div>
- </body>
-</html>
diff --git a/www/media/EverplanesLogo_160x160.png b/www/media/EverplanesLogo_160x160.png
deleted file mode 100644
index 4513118..0000000
Binary files a/www/media/EverplanesLogo_160x160.png and /dev/null differ
diff --git a/www/media/Frog-Craft3_2.160w.png b/www/media/Frog-Craft3_2.160w.png
deleted file mode 100644
index 64fefd0..0000000
Binary files a/www/media/Frog-Craft3_2.160w.png and /dev/null differ
diff --git a/www/media/Frog-Craft3_2.png b/www/media/Frog-Craft3_2.png
deleted file mode 100644
index 4da8907..0000000
Binary files a/www/media/Frog-Craft3_2.png and /dev/null differ
diff --git a/www/media/Impact_Bullet_AKM.in-1.png b/www/media/Impact_Bullet_AKM.in-1.png
deleted file mode 100644
index fb47ac4..0000000
Binary files a/www/media/Impact_Bullet_AKM.in-1.png and /dev/null differ
diff --git a/www/media/JaamSim_160x120.png b/www/media/JaamSim_160x120.png
deleted file mode 100644
index b7f954f..0000000
Binary files a/www/media/JaamSim_160x120.png and /dev/null differ
diff --git a/www/media/Java3d.png b/www/media/Java3d.png
deleted file mode 100644
index ea7ea1b..0000000
Binary files a/www/media/Java3d.png and /dev/null differ
diff --git a/www/media/JebGL_logo.160w.png b/www/media/JebGL_logo.160w.png
deleted file mode 100644
index 416ec9f..0000000
Binary files a/www/media/JebGL_logo.160w.png and /dev/null differ
diff --git a/www/media/JebGL_logo.png b/www/media/JebGL_logo.png
deleted file mode 100644
index 8891216..0000000
Binary files a/www/media/JebGL_logo.png and /dev/null differ
diff --git a/www/media/MyHmi-Collage-160x152.png b/www/media/MyHmi-Collage-160x152.png
deleted file mode 100644
index 8f14af7..0000000
Binary files a/www/media/MyHmi-Collage-160x152.png and /dev/null differ
diff --git a/www/media/NetBeansOpenGLPackLogo160.png b/www/media/NetBeansOpenGLPackLogo160.png
deleted file mode 100644
index ef0050b..0000000
Binary files a/www/media/NetBeansOpenGLPackLogo160.png and /dev/null differ
diff --git a/www/media/VolumeViewer-160x120.png b/www/media/VolumeViewer-160x120.png
deleted file mode 100644
index 2bb36d8..0000000
Binary files a/www/media/VolumeViewer-160x120.png and /dev/null differ
diff --git a/www/media/ardor3d.png b/www/media/ardor3d.png
deleted file mode 100644
index 9be4474..0000000
Binary files a/www/media/ardor3d.png and /dev/null differ
diff --git a/www/media/artofillusion.jpg b/www/media/artofillusion.jpg
deleted file mode 100644
index a4747f0..0000000
Binary files a/www/media/artofillusion.jpg and /dev/null differ
diff --git a/www/media/avengina.jpg b/www/media/avengina.jpg
deleted file mode 100644
index 267f405..0000000
Binary files a/www/media/avengina.jpg and /dev/null differ
diff --git a/www/media/c3d-mobile-01-coll01-160x160.png b/www/media/c3d-mobile-01-coll01-160x160.png
deleted file mode 100644
index 1b11b80..0000000
Binary files a/www/media/c3d-mobile-01-coll01-160x160.png and /dev/null differ
diff --git a/www/media/c3d-mobile-01-pipes01-160x125.png b/www/media/c3d-mobile-01-pipes01-160x125.png
deleted file mode 100644
index e7434ad..0000000
Binary files a/www/media/c3d-mobile-01-pipes01-160x125.png and /dev/null differ
diff --git a/www/media/c3d-mobile-01-pipes07-160x120.png b/www/media/c3d-mobile-01-pipes07-160x120.png
deleted file mode 100644
index 20a30d7..0000000
Binary files a/www/media/c3d-mobile-01-pipes07-160x120.png and /dev/null differ
diff --git a/www/media/c3d-studio-snap2-160x160.png b/www/media/c3d-studio-snap2-160x160.png
deleted file mode 100644
index c379017..0000000
Binary files a/www/media/c3d-studio-snap2-160x160.png and /dev/null differ
diff --git a/www/media/chronotext.jpg b/www/media/chronotext.jpg
deleted file mode 100644
index 7636d31..0000000
Binary files a/www/media/chronotext.jpg and /dev/null differ
diff --git a/www/media/dyn4j.png b/www/media/dyn4j.png
deleted file mode 100644
index 3fd7bf6..0000000
Binary files a/www/media/dyn4j.png and /dev/null differ
diff --git a/www/media/elflightengine-160x122.png b/www/media/elflightengine-160x122.png
deleted file mode 100644
index 92ecc12..0000000
Binary files a/www/media/elflightengine-160x122.png and /dev/null differ
diff --git a/www/media/fenggui.jpg b/www/media/fenggui.jpg
deleted file mode 100644
index 0bddf0e..0000000
Binary files a/www/media/fenggui.jpg and /dev/null differ
diff --git a/www/media/field.png b/www/media/field.png
deleted file mode 100644
index 559ce5b..0000000
Binary files a/www/media/field.png and /dev/null differ
diff --git a/www/media/fusion_logo.jpg b/www/media/fusion_logo.jpg
deleted file mode 100644
index 613ddaa..0000000
Binary files a/www/media/fusion_logo.jpg and /dev/null differ
diff --git a/www/media/geogebra-screenshot-tangents.png b/www/media/geogebra-screenshot-tangents.png
deleted file mode 100644
index 8607abe..0000000
Binary files a/www/media/geogebra-screenshot-tangents.png and /dev/null differ
diff --git a/www/media/gephi.jpg b/www/media/gephi.jpg
deleted file mode 100644
index fea90a7..0000000
Binary files a/www/media/gephi.jpg and /dev/null differ
diff --git a/www/media/glg2d-demo.png b/www/media/glg2d-demo.png
deleted file mode 100644
index 662c6e3..0000000
Binary files a/www/media/glg2d-demo.png and /dev/null differ
diff --git a/www/media/glstudio.jpg b/www/media/glstudio.jpg
deleted file mode 100644
index d11b138..0000000
Binary files a/www/media/glstudio.jpg and /dev/null differ
diff --git a/www/media/impact.jpg b/www/media/impact.jpg
deleted file mode 100644
index 7eb239a..0000000
Binary files a/www/media/impact.jpg and /dev/null differ
diff --git a/www/media/insparia-160x132.jpg b/www/media/insparia-160x132.jpg
deleted file mode 100644
index 5bb8bfc..0000000
Binary files a/www/media/insparia-160x132.jpg and /dev/null differ
diff --git a/www/media/jackflowers.jpg b/www/media/jackflowers.jpg
deleted file mode 100644
index 21e072f..0000000
Binary files a/www/media/jackflowers.jpg and /dev/null differ
diff --git a/www/media/jake2-160x160.png b/www/media/jake2-160x160.png
deleted file mode 100644
index 0721458..0000000
Binary files a/www/media/jake2-160x160.png and /dev/null differ
diff --git a/www/media/jmonkeyengine.png b/www/media/jmonkeyengine.png
deleted file mode 100644
index a3e2a2a..0000000
Binary files a/www/media/jmonkeyengine.png and /dev/null differ
diff --git a/www/media/jogl-applet-demoscene-elektronenmultiplizierer01-small.png b/www/media/jogl-applet-demoscene-elektronenmultiplizierer01-small.png
deleted file mode 100644
index 3087379..0000000
Binary files a/www/media/jogl-applet-demoscene-elektronenmultiplizierer01-small.png and /dev/null differ
diff --git a/www/media/jogl-applet-demoscene-elektronenmultiplizierer01.png b/www/media/jogl-applet-demoscene-elektronenmultiplizierer01.png
deleted file mode 100644
index c990c78..0000000
Binary files a/www/media/jogl-applet-demoscene-elektronenmultiplizierer01.png and /dev/null differ
diff --git a/www/media/jogl-applet-gearses2-normal-small.png b/www/media/jogl-applet-gearses2-normal-small.png
deleted file mode 100644
index 4fdf3fc..0000000
Binary files a/www/media/jogl-applet-gearses2-normal-small.png and /dev/null differ
diff --git a/www/media/jogl-applet-gearses2-normal.png b/www/media/jogl-applet-gearses2-normal.png
deleted file mode 100644
index 58eeda7..0000000
Binary files a/www/media/jogl-applet-gearses2-normal.png and /dev/null differ
diff --git a/www/media/jogl-applet-gearses2-translucent-small.png b/www/media/jogl-applet-gearses2-translucent-small.png
deleted file mode 100644
index f100a11..0000000
Binary files a/www/media/jogl-applet-gearses2-translucent-small.png and /dev/null differ
diff --git a/www/media/jogl-applet-gearses2-translucent.png b/www/media/jogl-applet-gearses2-translucent.png
deleted file mode 100644
index 423830c..0000000
Binary files a/www/media/jogl-applet-gearses2-translucent.png and /dev/null differ
diff --git a/www/media/jogl-applet-graph-text01-small.png b/www/media/jogl-applet-graph-text01-small.png
deleted file mode 100644
index d4c8da8..0000000
Binary files a/www/media/jogl-applet-graph-text01-small.png and /dev/null differ
diff --git a/www/media/jogl-applet-graph-text01.png b/www/media/jogl-applet-graph-text01.png
deleted file mode 100644
index 0bf38d1..0000000
Binary files a/www/media/jogl-applet-graph-text01.png and /dev/null differ
diff --git a/www/media/jogl-applet-graph-uiscene01-small.png b/www/media/jogl-applet-graph-uiscene01-small.png
deleted file mode 100644
index 7d54d7f..0000000
Binary files a/www/media/jogl-applet-graph-uiscene01-small.png and /dev/null differ
diff --git a/www/media/jogl-applet-graph-uiscene01.png b/www/media/jogl-applet-graph-uiscene01.png
deleted file mode 100644
index fa54a84..0000000
Binary files a/www/media/jogl-applet-graph-uiscene01.png and /dev/null differ
diff --git a/www/media/jogl-applet-moviecube01-small.png b/www/media/jogl-applet-moviecube01-small.png
deleted file mode 100644
index 124c88c..0000000
Binary files a/www/media/jogl-applet-moviecube01-small.png and /dev/null differ
diff --git a/www/media/jogl-applet-moviecube01.png b/www/media/jogl-applet-moviecube01.png
deleted file mode 100644
index a22c560..0000000
Binary files a/www/media/jogl-applet-moviecube01.png and /dev/null differ
diff --git a/www/media/jogl-applet-version-small.png b/www/media/jogl-applet-version-small.png
deleted file mode 100644
index 0f5d546..0000000
Binary files a/www/media/jogl-applet-version-small.png and /dev/null differ
diff --git a/www/media/jogl-applet-version.png b/www/media/jogl-applet-version.png
deleted file mode 100644
index 71b38a4..0000000
Binary files a/www/media/jogl-applet-version.png and /dev/null differ
diff --git a/www/media/jreality-logo-discreteksurfaces.png b/www/media/jreality-logo-discreteksurfaces.png
deleted file mode 100644
index 1499545..0000000
Binary files a/www/media/jreality-logo-discreteksurfaces.png and /dev/null differ
diff --git a/www/media/jspatial-1-160x160.png b/www/media/jspatial-1-160x160.png
deleted file mode 100644
index 95b546c..0000000
Binary files a/www/media/jspatial-1-160x160.png and /dev/null differ
diff --git a/www/media/jzy3d-demo-surface-160x160.png b/www/media/jzy3d-demo-surface-160x160.png
deleted file mode 100644
index 7be34e3..0000000
Binary files a/www/media/jzy3d-demo-surface-160x160.png and /dev/null differ
diff --git a/www/media/libgdx.png b/www/media/libgdx.png
deleted file mode 100644
index f801e0b..0000000
Binary files a/www/media/libgdx.png and /dev/null differ
diff --git a/www/media/madlix.png b/www/media/madlix.png
deleted file mode 100644
index 8212497..0000000
Binary files a/www/media/madlix.png and /dev/null differ
diff --git a/www/media/map_of_illarion.png b/www/media/map_of_illarion.png
deleted file mode 100644
index c8bb0c1..0000000
Binary files a/www/media/map_of_illarion.png and /dev/null differ
diff --git a/www/media/mbt.jpg b/www/media/mbt.jpg
deleted file mode 100644
index e3c1479..0000000
Binary files a/www/media/mbt.jpg and /dev/null differ
diff --git a/www/media/nifty-logo-new.png b/www/media/nifty-logo-new.png
deleted file mode 100644
index c8390ce..0000000
Binary files a/www/media/nifty-logo-new.png and /dev/null differ
diff --git a/www/media/pebbles.png b/www/media/pebbles.png
deleted file mode 100644
index 5f4c1de..0000000
Binary files a/www/media/pebbles.png and /dev/null differ
diff --git a/www/media/processing.jpg b/www/media/processing.jpg
deleted file mode 100644
index cf833d4..0000000
Binary files a/www/media/processing.jpg and /dev/null differ
diff --git a/www/media/raceview.jpg b/www/media/raceview.jpg
deleted file mode 100644
index a5c92ab..0000000
Binary files a/www/media/raceview.jpg and /dev/null differ
diff --git a/www/media/scilab.png b/www/media/scilab.png
deleted file mode 100644
index 8e4c6d4..0000000
Binary files a/www/media/scilab.png and /dev/null differ
diff --git a/www/media/sculpteo_3_robot_72dpi_sm.jpg b/www/media/sculpteo_3_robot_72dpi_sm.jpg
deleted file mode 100644
index 02f3d5e..0000000
Binary files a/www/media/sculpteo_3_robot_72dpi_sm.jpg and /dev/null differ
diff --git a/www/media/specksim.jpg b/www/media/specksim.jpg
deleted file mode 100644
index accc705..0000000
Binary files a/www/media/specksim.jpg and /dev/null differ
diff --git a/www/media/strap.jpg b/www/media/strap.jpg
deleted file mode 100644
index 9f33848..0000000
Binary files a/www/media/strap.jpg and /dev/null differ
diff --git a/www/media/ticket2ride_picture5-160x132.jpg b/www/media/ticket2ride_picture5-160x132.jpg
deleted file mode 100644
index 2ab252f..0000000
Binary files a/www/media/ticket2ride_picture5-160x132.jpg and /dev/null differ
diff --git a/www/media/vehicle.jpg b/www/media/vehicle.jpg
deleted file mode 100644
index b1369c9..0000000
Binary files a/www/media/vehicle.jpg and /dev/null differ
diff --git a/www/media/vldocking.jpg b/www/media/vldocking.jpg
deleted file mode 100644
index a4afaaf..0000000
Binary files a/www/media/vldocking.jpg and /dev/null differ
diff --git a/www/media/worldwind.jpg b/www/media/worldwind.jpg
deleted file mode 100644
index 6888b6a..0000000
Binary files a/www/media/worldwind.jpg and /dev/null differ
diff --git a/www/media/zg3d.png b/www/media/zg3d.png
deleted file mode 100644
index 986b894..0000000
Binary files a/www/media/zg3d.png and /dev/null differ
diff --git a/www/sharendipity.gif b/www/sharendipity.gif
deleted file mode 100644
index 95c8187..0000000
Binary files a/www/sharendipity.gif and /dev/null differ
diff --git a/www/ts1361.pdf b/www/ts1361.pdf
deleted file mode 100644
index c405f65..0000000
Binary files a/www/ts1361.pdf and /dev/null differ
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libjogl2-java.git
More information about the pkg-java-commits
mailing list