From a60e3b1a894c53abe7ab3a19f1f30cfa96886464 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 9 Jun 2013 06:07:15 +0200
Subject: Unit Tests: Group *math* tests in own test package
---
make/scripts/tests.sh | 11 +-
.../acore/TestFloatUtil01MatrixMatrixMultNOUI.java | 113 -----
.../test/junit/jogl/acore/TestPMVMatrix01NEWT.java | 466 ---------------------
.../test/junit/jogl/acore/TestPMVMatrix02NEWT.java | 109 -----
.../junit/jogl/glu/TestGluUnprojectDoubleNOUI.java | 57 ---
.../junit/jogl/glu/TestGluUnprojectFloatNOUI.java | 103 -----
.../math/TestFloatUtil01MatrixMatrixMultNOUI.java | 113 +++++
.../jogl/math/TestGluUnprojectDoubleNOUI.java | 57 +++
.../junit/jogl/math/TestGluUnprojectFloatNOUI.java | 103 +++++
.../test/junit/jogl/math/TestPMVMatrix01NEWT.java | 466 +++++++++++++++++++++
.../test/junit/jogl/math/TestPMVMatrix02NOUI.java | 109 +++++
11 files changed, 855 insertions(+), 852 deletions(-)
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFloatUtil01MatrixMatrixMultNOUI.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix02NEWT.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectDoubleNOUI.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 071c56a9b..d49a0fc33 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -309,9 +309,13 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT
#testnoawt com.jogamp.opengl.JoglVersion $*
#testnoawt com.jogamp.newt.NewtVersion $*
#testnoawt com.jogamp.newt.opengl.GLWindow $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFloatUtil01MatrixMatrixMultNOUI $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestPMVMatrix01NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestPMVMatrix02NEWT $*
+
+#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.TestGluUnprojectFloatNOUI $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestGluUnprojectDoubleNOUI $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestFloatUtil01MatrixMatrixMultNOUI $*
+
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
@@ -376,7 +380,6 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
-#testnoawt com.jogamp.opengl.test.junit.jogl.glu.TestGluUnprojectFloatNOUI $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteWindow01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteGLWindows01NEWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFloatUtil01MatrixMatrixMultNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFloatUtil01MatrixMatrixMultNOUI.java
deleted file mode 100644
index adeb700d7..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFloatUtil01MatrixMatrixMultNOUI.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Copyright 2012 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;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.jogamp.opengl.math.FloatUtil;
-
-public class TestFloatUtil01MatrixMatrixMultNOUI {
-
- final float[] m1 = new float[]{ 1, 3, 4, 0,
- 6, 7, 8, 5,
- 98, 7, 6, 9,
- 54, 3, 2, 5 };
-
- final float[] m2 = new float[]{ 1, 6, 98, 54,
- 3, 7, 7, 3,
- 4, 8, 6, 2,
- 0, 5, 9, 5 };
-
- final float[] m1xm2_RM = // m2xm1_CM
- new float[]{ 26, 59, 143, 71,
- 59, 174, 730, 386,
- 143, 730, 9770, 5370,
- 71, 386, 5370, 2954 };
-
- final float[] m2xm1_RM = // m1xm2_CM
- new float[]{12557, 893, 748, 1182,
- 893, 116, 116, 113,
- 748, 116, 120, 104,
- 1182, 113, 104, 131 };
-
- public static final void multMatrixf_RM(final float[] a, int a_off, final float[] b, int b_off, float[] d, int d_off) {
- for (int i = 0; i < 4; i++) {
- final float ai0=a[a_off+i*4+0], ai1=a[a_off+i*4+1], ai2=a[a_off+i*4+2], ai3=a[a_off+i*4+3];
- d[d_off+i*4+0] = ai0 * b[b_off+0*4+0] + ai1 * b[b_off+1*4+0] + ai2 * b[b_off+2*4+0] + ai3 * b[b_off+3*4+0] ;
- d[d_off+i*4+1] = ai0 * b[b_off+0*4+1] + ai1 * b[b_off+1*4+1] + ai2 * b[b_off+2*4+1] + ai3 * b[b_off+3*4+1] ;
- d[d_off+i*4+2] = ai0 * b[b_off+0*4+2] + ai1 * b[b_off+1*4+2] + ai2 * b[b_off+2*4+2] + ai3 * b[b_off+3*4+2] ;
- d[d_off+i*4+3] = ai0 * b[b_off+0*4+3] + ai1 * b[b_off+1*4+3] + ai2 * b[b_off+2*4+3] + ai3 * b[b_off+3*4+3] ;
- }
- }
-
- @Test
- public void testCM_m1xm2(){
-
- float[] r = new float[16];
-
- FloatUtil.multMatrixf(m1, 0, m2, 0, r, 0);
-
- Assert.assertArrayEquals(m2xm1_RM, r, 0f);
- }
-
- @Test
- public void testCM_m2xm1(){
-
- float[] r = new float[16];
-
- FloatUtil.multMatrixf(m2, 0, m1, 0, r, 0);
-
- Assert.assertArrayEquals(m1xm2_RM, r, 0f);
- }
-
- @Test
- public void testRM_m1xm2(){
-
- float[] r = new float[16];
-
- multMatrixf_RM(m1, 0, m2, 0, r, 0);
-
- Assert.assertArrayEquals(m1xm2_RM, r, 0f);
- }
-
- @Test
- public void testRM_m2xm1(){
-
- float[] r = new float[16];
-
- multMatrixf_RM(m2, 0, m1, 0, r, 0);
-
- Assert.assertArrayEquals(m2xm1_RM, r, 0f);
- }
-
- public static void main(String args[]) {
- org.junit.runner.JUnitCore.main(TestFloatUtil01MatrixMatrixMultNOUI.class.getName());
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java
deleted file mode 100644
index c99bac9a4..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix01NEWT.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/**
- * Copyright 2012 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;
-
-import java.nio.FloatBuffer;
-
-import javax.media.opengl.GL2ES1;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.jogamp.common.os.Platform;
-import com.jogamp.opengl.math.FloatUtil;
-import com.jogamp.opengl.math.geom.Frustum;
-import com.jogamp.opengl.test.junit.util.MiscUtils;
-import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.util.PMVMatrix;
-
-public class TestPMVMatrix01NEWT extends UITestCase {
-
- static final float epsilon = 0.00001f;
-
- // matrix 2 rows x 3 columns - In row major order
- static FloatBuffer matrix2x3R = FloatBuffer.wrap( new float[] { 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f } );
-
- // matrix 2 rows x 3 columns - In column major order
- static FloatBuffer matrix2x3C = FloatBuffer.wrap( new float[] { 1.0f, 4.0f,
- 2.0f, 5.0f,
- 3.0f, 6.0f } );
-
- // matrix 3 rows x 2 columns - In row major order
- static FloatBuffer matrix3x2R = FloatBuffer.wrap( new float[] { 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f } );
-
- // matrix 3 rows x 2 columns - In column major order
- static FloatBuffer matrix3x2C = FloatBuffer.wrap( new float[] { 1.0f, 3.0f, 5.0f,
- 2.0f, 4.0f, 6.0f } );
-
- // Translated xyz 123 - Row - In row major order !
- static FloatBuffer translated123R = FloatBuffer.wrap( new float[] { 1.0f, 0.0f, 0.0f, 1.0f,
- 0.0f, 1.0f, 0.0f, 2.0f,
- 0.0f, 0.0f, 1.0f, 3.0f,
- 0.0f, 0.0f, 0.0f, 1.0f } );
-
- // Translated xyz 123 - Column - In column major order !
- static FloatBuffer translated123C = FloatBuffer.wrap( new float[] { 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- 1.0f, 2.0f, 3.0f, 1.0f } );
-
- // Translated xyz 123 - Inverse - In column major order !
- static FloatBuffer translated123I = FloatBuffer.wrap( new float[] { 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- -1.0f, -2.0f, -3.0f, 1.0f } );
-
- // Translated xyz 123 - Inverse and Transposed - In column major order !
- static FloatBuffer translated123IT = FloatBuffer.wrap( new float[] { 1.0f, 0.0f, 0.0f, -1.0f,
- 0.0f, 1.0f, 0.0f, -2.0f,
- 0.0f, 0.0f, 1.0f, -3.0f,
- 0.0f, 0.0f, 0.0f, 1.0f } );
-
- @Test
- public void test00MatrixToString() {
- final String s4x4Cpmv = PMVMatrix.matrixToString(null, "%10.5f", translated123C).toString();
- final String s4x4Cflu = FloatUtil.matrixToString(null, null, "%10.5f", translated123C, 0, 4, 4, false).toString();
- final String s4x4Rflu = FloatUtil.matrixToString(null, null, "%10.5f", translated123R, 0, 4, 4, true).toString();
- System.err.println("PMV-C-O 4x4: ");
- System.err.println(s4x4Cpmv);
- System.err.println();
- System.err.println("FLU-C-O 4x4: ");
- System.err.println(s4x4Cflu);
- System.err.println();
- System.err.println("FLU-R-O 4x4: ");
- System.err.println(s4x4Rflu);
- System.err.println();
- Assert.assertEquals(s4x4Cpmv, s4x4Cflu);
- Assert.assertEquals(s4x4Cflu, s4x4Rflu);
-
- final String s2x3Rflu = FloatUtil.matrixToString(null, null, "%10.5f", matrix2x3R, 0, 2, 3, true).toString();
- final String s2x3Cflu = FloatUtil.matrixToString(null, null, "%10.5f", matrix2x3C, 0, 2, 3, false).toString();
- System.err.println("FLU-R-O 2x3: ");
- System.err.println(s2x3Rflu);
- System.err.println();
- System.err.println("FLU-C-O 2x3: ");
- System.err.println(s2x3Cflu);
- System.err.println();
- Assert.assertEquals(s2x3Cflu, s2x3Rflu);
-
- final String s3x2Rflu = FloatUtil.matrixToString(null, null, "%10.5f", matrix3x2R, 0, 3, 2, true).toString();
- final String s3x2Cflu = FloatUtil.matrixToString(null, null, "%10.5f", matrix3x2C, 0, 3, 2, false).toString();
- System.err.println("FLU-R-O 3x2: ");
- System.err.println(s3x2Rflu);
- System.err.println();
- System.err.println("FLU-C-O 3x2: ");
- System.err.println(s3x2Cflu);
- System.err.println();
- Assert.assertEquals(s3x2Cflu, s3x2Rflu);
- }
-
- /**
- * Test using traditional access workflow, i.e. 1) operation 2) get-matrix references
- *
- * The Mvi, Mvit and Frustum dirty-bits and request-mask will be validated.
- *
- */
- @SuppressWarnings("deprecation")
- @Test
- public void test01MviUpdateTraditionalAccess() {
- FloatBuffer p, mv, mvi, mvit;
- Frustum frustum;
- boolean b;
- final PMVMatrix pmv = new PMVMatrix(true);
- // System.err.println("P0: "+pmv.toString());
-
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
-
- //
- // Action #0
- //
- final FloatBuffer ident;
- {
- pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmv.glLoadIdentity();
- ident = pmv.glGetPMatrixf();
-
- pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmv.glLoadIdentity();
- }
- Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
-
- //
- // Action #1
- //
- pmv.glTranslatef(1f, 2f, 3f); // all dirty !
- Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
- // System.err.println("P1: "+pmv.toString());
-
- b = pmv.update(); // will not clean dirty bits, since no request has been made -> false
- Assert.assertEquals("Update has been perfomed, but non requested", false, b);
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
- // System.err.println("P2: "+pmv.toString());
-
- //
- // Get
- //
- p = pmv.glGetPMatrixf();
- MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString(), ident, p, epsilon);
- mv = pmv.glGetMvMatrixf();
- MiscUtils.assertFloatBufferEquals("Mv not translated123, "+pmv.toString(), translated123C, mv, epsilon);
- mvi = pmv.glGetMviMatrixf();
- MiscUtils.assertFloatBufferEquals("Mvi not translated123, "+pmv.toString(), translated123I, mvi, epsilon);
- Assert.assertEquals("Request bit Mvi not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW, pmv.getRequestMask());
- Assert.assertEquals("Remaining dirty bits not Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
-
- frustum = pmv.glGetFrustum();
- Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
- Assert.assertEquals("Remaining dirty bits not Mvit, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW, pmv.getDirtyBits());
- Assert.assertEquals("Request bits Mvi|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
- // System.err.println("P3: "+pmv.toString());
-
- mvit = pmv.glGetMvitMatrixf();
- MiscUtils.assertFloatBufferEquals("Mvit not translated123, "+pmv.toString()+pmv.toString(), translated123IT, mvit, epsilon);
- Assert.assertTrue("Dirty bits not clean, "+pmv.toString(), 0 == pmv.getDirtyBits());
- Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
- // System.err.println("P4: "+pmv.toString());
-
- //
- // Action #2
- //
- pmv.glLoadIdentity(); // all dirty
- Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
- MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString(), ident, p, epsilon);
- MiscUtils.assertFloatBufferEquals("Mv not identity, "+pmv.toString(), ident, mv, epsilon);
- MiscUtils.assertFloatBufferNotEqual("Mvi already identity w/o update, "+pmv.toString(), ident, mvi, epsilon);
- MiscUtils.assertFloatBufferNotEqual("Mvit already identity w/o update, "+pmv.toString(), ident, mvit, epsilon);
- MiscUtils.assertFloatBufferEquals("Mvi not translated123, "+pmv.toString()+pmv.toString(), translated123I, mvi, epsilon);
- MiscUtils.assertFloatBufferEquals("Mvit not translated123, "+pmv.toString()+pmv.toString(), translated123IT, mvit, epsilon);
- Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
-
- b = pmv.update(); // will clean dirty bits, since request has been made -> true
- Assert.assertEquals("Update has not been perfomed, but requested", true, b);
- Assert.assertTrue("Dirty bits not clean, "+pmv.toString(), 0 == pmv.getDirtyBits());
- Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
- MiscUtils.assertFloatBufferEquals("Mvi not identity after update, "+pmv.toString(), ident, mvi, epsilon);
- MiscUtils.assertFloatBufferEquals("Mvit not identity after update, "+pmv.toString(), ident, mvit, epsilon);
- Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
- }
-
- /**
- * Test using shader access workflow, i.e. 1) get-matrix references 2) operations
- *
- * The Mvi, Mvit and Frustum dirty-bits and request-mask will be validated.
- *
- */
- @SuppressWarnings("deprecation")
- @Test
- public void test02MviUpdateShaderAccess() {
- final FloatBuffer p, mv, mvi, mvit;
- Frustum frustum;
- boolean b;
- final PMVMatrix pmv = new PMVMatrix(true);
- // System.err.println("P0: "+pmv.toString());
-
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
-
- //
- // Action #0
- //
- final FloatBuffer ident;
- {
- pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmv.glLoadIdentity();
- ident = pmv.glGetPMatrixf();
-
- pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmv.glLoadIdentity();
- }
- // System.err.println("P0: "+pmv.toString());
- Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
- // System.err.println("P1: "+pmv.toString());
-
- //
- // Get
- //
- p = pmv.glGetPMatrixf();
- MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString(), ident, p, epsilon);
- mv = pmv.glGetMvMatrixf();
- MiscUtils.assertFloatBufferEquals("Mv not identity, "+pmv.toString(), ident, mv, epsilon);
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
-
- mvi = pmv.glGetMviMatrixf();
- MiscUtils.assertFloatBufferEquals("Mvi not identity, "+pmv.toString(), ident, mvi, epsilon);
- Assert.assertEquals("Remaining dirty bits not Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bit Mvi not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW, pmv.getRequestMask());
-
- mvit = pmv.glGetMvitMatrixf();
- MiscUtils.assertFloatBufferEquals("Mvi not identity, "+pmv.toString(), ident, mvit, epsilon);
- Assert.assertEquals("Remaining dirty bits not Frustum, "+pmv.toString(), PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- Assert.assertEquals("Request bits Mvi and Mvit not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW, pmv.getRequestMask());
-
- frustum = pmv.glGetFrustum();
- Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
- Assert.assertTrue("Dirty bits not clean, "+pmv.toString(), 0 == pmv.getDirtyBits());
- Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
-
- //
- // Action #1
- //
- pmv.glTranslatef(1f, 2f, 3f); // all dirty !
- Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
- Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
- Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
- MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString()+pmv.toString(), ident, p, epsilon);
- MiscUtils.assertFloatBufferEquals("Mv not translated123, "+pmv.toString()+pmv.toString(), translated123C, mv, epsilon);
- MiscUtils.assertFloatBufferNotEqual("Mvi already translated123 w/o update, "+pmv.toString()+pmv.toString(), translated123I, mvi, epsilon);
- MiscUtils.assertFloatBufferNotEqual("Mvit already translated123 w/o update, "+pmv.toString()+pmv.toString(), translated123IT, mvit, epsilon);
- MiscUtils.assertFloatBufferEquals("Mvi not identity, "+pmv.toString()+pmv.toString(), ident, mvi, epsilon);
- MiscUtils.assertFloatBufferEquals("Mvit not identity, "+pmv.toString()+pmv.toString(), ident, mvit, epsilon);
- Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
-
- b = pmv.update(); // will clean dirty bits, since all requests has been made -> true
- Assert.assertEquals("Update has not been perfomed, but requested", true, b);
- Assert.assertTrue("Dirty bits not clean, "+pmv.toString(), 0 == pmv.getDirtyBits());
- Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
- MiscUtils.assertFloatBufferEquals("Mvi not translated123, "+pmv.toString()+pmv.toString(), translated123I, mvi, epsilon);
- MiscUtils.assertFloatBufferEquals("Mvit not translated123, "+pmv.toString()+pmv.toString(), translated123IT, mvit, epsilon);
- // System.err.println("P2: "+pmv.toString());
- }
-
- @SuppressWarnings("unused")
- @Test
- public void test03MvTranslate() {
- final FloatBuffer pmvMv, pmvMvi, pmvMvit;
- {
- final PMVMatrix pmv = new PMVMatrix(true);
- pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmv.glLoadIdentity();
- pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmv.glLoadIdentity();
- pmv.glTranslatef(5f, 6f, 7f);
-
- pmvMv = pmv.glGetMvMatrixf();
- pmvMvi = pmv.glGetMviMatrixf();
- pmvMvit = pmv.glGetMvitMatrixf();
- }
-
- final FloatBuffer glMv = FloatBuffer.allocate(16);
- {
- GL2ES1 gl = dc.glc.getGL().getGL2ES1();
- gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- gl.glLoadIdentity();
- gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- gl.glLoadIdentity();
- gl.glTranslatef(5f, 6f, 7f);
-
- gl.glGetFloatv(GLMatrixFunc.GL_MODELVIEW_MATRIX, glMv);
- }
- // System.err.println(PMVMatrix.matrixToString(null, "%10.5f", glMv, pmvMv).toString());
-
- MiscUtils.assertFloatBufferEquals("Arrays not equal, expected"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", glMv).toString()+
- ", actual"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMv).toString(),
- glMv, pmvMv, epsilon);
-
- // System.err.println("pmvMvi: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvi));
- // System.err.println("pmvMvit: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvit));
- }
-
- @SuppressWarnings("unused")
- @Test
- public void test04MvTranslateRotate() {
- final FloatBuffer pmvMv, pmvMvi, pmvMvit;
- {
- final PMVMatrix pmv = new PMVMatrix(true);
- pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmv.glLoadIdentity();
- pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmv.glLoadIdentity();
- pmv.glTranslatef(5f, 6f, 7f);
- pmv.glRotatef(90f, 1f, 0f, 0f);
-
- pmvMv = pmv.glGetMvMatrixf();
- pmvMvi = pmv.glGetMviMatrixf();
- pmvMvit = pmv.glGetMvitMatrixf();
- }
-
- final FloatBuffer glMv = FloatBuffer.allocate(16);
- {
- GL2ES1 gl = dc.glc.getGL().getGL2ES1();
- gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- gl.glLoadIdentity();
- gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- gl.glLoadIdentity();
- gl.glTranslatef(5f, 6f, 7f);
- gl.glRotatef(90f, 1f, 0f, 0f);
-
- gl.glGetFloatv(GLMatrixFunc.GL_MODELVIEW_MATRIX, glMv);
- }
- // System.err.println(PMVMatrix.matrixToString(null, "%10.5f", glMv, pmvMv).toString());
-
- MiscUtils.assertFloatBufferEquals("Arrays not equal, expected"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", glMv).toString()+
- ", actual"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMv).toString(),
- glMv, pmvMv, epsilon);
-
- // System.err.println("pmvMvi: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvi));
- // System.err.println("pmvMvit: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvit));
- }
-
- static DrawableContext dc;
-
- @BeforeClass
- public static void setup() throws Throwable {
- try {
- dc = createOffscreenDrawableAndCurrentFFPContext();
- } catch (Throwable t) {
- setTestSupported(false);
- throw t;
- }
- }
-
- @AfterClass
- public static void cleanup() {
- destroyDrawableContext(dc);
- }
-
- static class DrawableContext {
- DrawableContext(GLDrawable d, GLContext glc) {
- this.d = d;
- this.glc = glc;
- }
- GLDrawable d;
- GLContext glc;
- }
-
- private static DrawableContext createOffscreenDrawableAndCurrentFFPContext() throws Throwable {
- GLProfile glp = GLProfile.getMaxFixedFunc(true);
- GLCapabilities glCaps = new GLCapabilities(glp);
- glCaps.setOnscreen(false);
- glCaps.setPBuffer(true);
- GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
- GLDrawable d = factory.createOffscreenDrawable(null, glCaps, null, 64, 64);
- d.setRealized(true);
- GLContext glc = null;
- try {
- glc = d.createContext(null);
- Assert.assertTrue("Context could not be made current", GLContext.CONTEXT_NOT_CURRENT < glc.makeCurrent());
- return new DrawableContext(d, glc);
- } catch (Throwable t) {
- if(null != glc) {
- glc.destroy();
- }
- d.setRealized(false);
- throw t;
- }
- }
-
- private static void destroyDrawableContext(DrawableContext dc) {
- if(null != dc.glc) {
- dc.glc.destroy();
- dc.glc = null;
- }
- if(null != dc.d) {
- dc.d.setRealized(false);
- dc.d = null;
- }
- }
-
- public static void main(String args[]) {
- org.junit.runner.JUnitCore.main(TestPMVMatrix01NEWT.class.getName());
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix02NEWT.java
deleted file mode 100644
index 4e959d460..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPMVMatrix02NEWT.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Copyright 2012 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;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.jogamp.opengl.util.PMVMatrix;
-
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
-import java.nio.FloatBuffer;
-
-import static org.junit.Assert.assertArrayEquals;
-
-/**
- * @author Thomas De Bodt
- */
-public class TestPMVMatrix02NEWT {
-
- private PMVMatrix fMat;
-
- @Before
- public void setUp() throws Exception {
- fMat = new PMVMatrix();
- }
-
- @Test
- public void testLookAtNegZIsNoOp() throws Exception {
- fMat.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- // Look towards -z
- fMat.gluLookAt(
- 0, 0, 0,
- 0, 0, -1,
- 0, 1, 0
- );
- FloatBuffer mvMatrix = fMat.glGetMvMatrixf();
- float[] mvMatrixArr = new float[16];
- mvMatrix.asReadOnlyBuffer().get(mvMatrixArr);
- assertArrayEquals(
- /**
- * The 3 rows of the matrix (= the 3 columns of the array/buffer) should be: side, up, -forward.
- */
- new float[] {
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
- },
- mvMatrixArr,
- 1e-6f
- );
- }
- @Test
- public void testLookAtPosY() throws Exception {
- fMat.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- // Look towards +y
- fMat.gluLookAt(
- 0, 0, 0,
- 0, 1, 0,
- 0, 0, 1
- );
- FloatBuffer mvMatrix = fMat.glGetMvMatrixf();
- float[] mvMatrixArr = new float[16];
- mvMatrix.asReadOnlyBuffer().get(mvMatrixArr);
- assertArrayEquals(
- /**
- * The 3 rows of the matrix (= the 3 columns of the array/buffer) should be: side, up, -forward.
- */
- new float[] {
- 1, 0, 0, 0,
- 0, 0, -1, 0,
- 0, 1, 0, 0,
- 0, 0, 0, 1
- },
- mvMatrixArr,
- 1e-6f
- );
- }
-
- public static void main(String args[]) {
- org.junit.runner.JUnitCore.main(TestPMVMatrix02NEWT.class.getName());
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectDoubleNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectDoubleNOUI.java
deleted file mode 100644
index 34b30f04e..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectDoubleNOUI.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.glu;
-
-import javax.media.opengl.glu.GLU;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * @author Julien Gouesse
- */
-public class TestGluUnprojectDoubleNOUI {
-
- @Test
- public void test(){
- final GLU glu = new GLU();
- final int[] pickedPoint = new int[]{400,300};
- final double pickedPointDepth = 0;
- final double[] sceneModelViewValues = new double[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
- final double[] projectionValues = new double[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
- final int[] viewport = new int[]{0,0,800,600};
- final double[] objCoords = new double[]{Double.NaN,Double.NaN,Double.NaN};
- glu.gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0);
- Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2]));
- }
-
- public static void main(String args[]) {
- org.junit.runner.JUnitCore.main(TestGluUnprojectDoubleNOUI.class.getName());
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java
deleted file mode 100644
index 717d5e4b8..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * 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.glu;
-
-import javax.media.opengl.glu.GLU;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestGluUnprojectFloatNOUI {
-
- @Test
- public void testNaN(){
- final GLU glu = new GLU();
- final int[] pickedPoint = new int[]{400,300};
- final float pickedPointDepth = 0;
- final float[] sceneModelViewValues = new float[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
- final float[] projectionValues = new float[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
- final int[] viewport = new int[]{0,0,800,600};
- final float[] objCoords = new float[]{Float.NaN,Float.NaN,Float.NaN};
- glu.gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0);
- Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2]));
- }
-
- @Test
- public void test01(){
- float[] mv = new float[] { 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1 };
-
- float[] p = new float[] { 2.3464675f, 0, 0, 0,
- 0, 2.4142134f, 0, 0,
- 0, 0, -1.0002f, -1,
- 0, 0, -20.002f, 0 };
-
- int[] v = new int[] { 0, 0, 1000, 1000 };
-
- float[] s = new float[] { 250, 250, 0.5f };
-
- float[] expected = new float[] { -4.2612f, -4.1417f, -19.9980f };
- float[] result = new float[] { 0, 0, 0 };
-
- final GLU glu = new GLU();
- glu.gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0);
-
- Assert.assertArrayEquals(expected, result, 0.0001f);
- }
-
- @Test
- public void test02(){
- float[] mv = new float[] { 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, -200, 1 } ;
-
- float[] p = new float[] { 2.3464675f, 0, 0, 0,
- 0, 2.4142134f, 0, 0,
- 0, 0, -1.0002f, -1,
- 0, 0, -20.002f, 0 };
-
- int[] v = new int[] { 0, 0, 1000, 1000 };
-
- float[] s = new float[] { 250, 250, 0.5f };
- float[] expected = new float[] { -4.2612f, -4.1417f, 180.002f };
- float[] result = new float[] { 0, 0, 0 };
-
- final GLU glu = new GLU();
- glu.gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0);
-
- Assert.assertArrayEquals(expected, result, 0.0001f);
- }
-
- public static void main(String args[]) {
- org.junit.runner.JUnitCore.main(TestGluUnprojectFloatNOUI.class.getName());
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java
new file mode 100644
index 000000000..83a1be456
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java
@@ -0,0 +1,113 @@
+/**
+ * Copyright 2012 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.math;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.jogamp.opengl.math.FloatUtil;
+
+public class TestFloatUtil01MatrixMatrixMultNOUI {
+
+ final float[] m1 = new float[]{ 1, 3, 4, 0,
+ 6, 7, 8, 5,
+ 98, 7, 6, 9,
+ 54, 3, 2, 5 };
+
+ final float[] m2 = new float[]{ 1, 6, 98, 54,
+ 3, 7, 7, 3,
+ 4, 8, 6, 2,
+ 0, 5, 9, 5 };
+
+ final float[] m1xm2_RM = // m2xm1_CM
+ new float[]{ 26, 59, 143, 71,
+ 59, 174, 730, 386,
+ 143, 730, 9770, 5370,
+ 71, 386, 5370, 2954 };
+
+ final float[] m2xm1_RM = // m1xm2_CM
+ new float[]{12557, 893, 748, 1182,
+ 893, 116, 116, 113,
+ 748, 116, 120, 104,
+ 1182, 113, 104, 131 };
+
+ public static final void multMatrixf_RM(final float[] a, int a_off, final float[] b, int b_off, float[] d, int d_off) {
+ for (int i = 0; i < 4; i++) {
+ final float ai0=a[a_off+i*4+0], ai1=a[a_off+i*4+1], ai2=a[a_off+i*4+2], ai3=a[a_off+i*4+3];
+ d[d_off+i*4+0] = ai0 * b[b_off+0*4+0] + ai1 * b[b_off+1*4+0] + ai2 * b[b_off+2*4+0] + ai3 * b[b_off+3*4+0] ;
+ d[d_off+i*4+1] = ai0 * b[b_off+0*4+1] + ai1 * b[b_off+1*4+1] + ai2 * b[b_off+2*4+1] + ai3 * b[b_off+3*4+1] ;
+ d[d_off+i*4+2] = ai0 * b[b_off+0*4+2] + ai1 * b[b_off+1*4+2] + ai2 * b[b_off+2*4+2] + ai3 * b[b_off+3*4+2] ;
+ d[d_off+i*4+3] = ai0 * b[b_off+0*4+3] + ai1 * b[b_off+1*4+3] + ai2 * b[b_off+2*4+3] + ai3 * b[b_off+3*4+3] ;
+ }
+ }
+
+ @Test
+ public void testCM_m1xm2(){
+
+ float[] r = new float[16];
+
+ FloatUtil.multMatrixf(m1, 0, m2, 0, r, 0);
+
+ Assert.assertArrayEquals(m2xm1_RM, r, 0f);
+ }
+
+ @Test
+ public void testCM_m2xm1(){
+
+ float[] r = new float[16];
+
+ FloatUtil.multMatrixf(m2, 0, m1, 0, r, 0);
+
+ Assert.assertArrayEquals(m1xm2_RM, r, 0f);
+ }
+
+ @Test
+ public void testRM_m1xm2(){
+
+ float[] r = new float[16];
+
+ multMatrixf_RM(m1, 0, m2, 0, r, 0);
+
+ Assert.assertArrayEquals(m1xm2_RM, r, 0f);
+ }
+
+ @Test
+ public void testRM_m2xm1(){
+
+ float[] r = new float[16];
+
+ multMatrixf_RM(m2, 0, m1, 0, r, 0);
+
+ Assert.assertArrayEquals(m2xm1_RM, r, 0f);
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestFloatUtil01MatrixMatrixMultNOUI.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java
new file mode 100644
index 000000000..32861f764
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java
@@ -0,0 +1,57 @@
+/**
+ * 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.math;
+
+import javax.media.opengl.glu.GLU;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Julien Gouesse
+ */
+public class TestGluUnprojectDoubleNOUI {
+
+ @Test
+ public void test(){
+ final GLU glu = new GLU();
+ final int[] pickedPoint = new int[]{400,300};
+ final double pickedPointDepth = 0;
+ final double[] sceneModelViewValues = new double[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
+ final double[] projectionValues = new double[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
+ final int[] viewport = new int[]{0,0,800,600};
+ final double[] objCoords = new double[]{Double.NaN,Double.NaN,Double.NaN};
+ glu.gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0);
+ Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2]));
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestGluUnprojectDoubleNOUI.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java
new file mode 100644
index 000000000..9951500fc
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java
@@ -0,0 +1,103 @@
+/**
+ * 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.math;
+
+import javax.media.opengl.glu.GLU;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestGluUnprojectFloatNOUI {
+
+ @Test
+ public void testNaN(){
+ final GLU glu = new GLU();
+ final int[] pickedPoint = new int[]{400,300};
+ final float pickedPointDepth = 0;
+ final float[] sceneModelViewValues = new float[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
+ final float[] projectionValues = new float[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
+ final int[] viewport = new int[]{0,0,800,600};
+ final float[] objCoords = new float[]{Float.NaN,Float.NaN,Float.NaN};
+ glu.gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0);
+ Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2]));
+ }
+
+ @Test
+ public void test01(){
+ float[] mv = new float[] { 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1 };
+
+ float[] p = new float[] { 2.3464675f, 0, 0, 0,
+ 0, 2.4142134f, 0, 0,
+ 0, 0, -1.0002f, -1,
+ 0, 0, -20.002f, 0 };
+
+ int[] v = new int[] { 0, 0, 1000, 1000 };
+
+ float[] s = new float[] { 250, 250, 0.5f };
+
+ float[] expected = new float[] { -4.2612f, -4.1417f, -19.9980f };
+ float[] result = new float[] { 0, 0, 0 };
+
+ final GLU glu = new GLU();
+ glu.gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0);
+
+ Assert.assertArrayEquals(expected, result, 0.0001f);
+ }
+
+ @Test
+ public void test02(){
+ float[] mv = new float[] { 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, -200, 1 } ;
+
+ float[] p = new float[] { 2.3464675f, 0, 0, 0,
+ 0, 2.4142134f, 0, 0,
+ 0, 0, -1.0002f, -1,
+ 0, 0, -20.002f, 0 };
+
+ int[] v = new int[] { 0, 0, 1000, 1000 };
+
+ float[] s = new float[] { 250, 250, 0.5f };
+ float[] expected = new float[] { -4.2612f, -4.1417f, 180.002f };
+ float[] result = new float[] { 0, 0, 0 };
+
+ final GLU glu = new GLU();
+ glu.gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0);
+
+ Assert.assertArrayEquals(expected, result, 0.0001f);
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestGluUnprojectFloatNOUI.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
new file mode 100644
index 000000000..3d9bfed7e
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
@@ -0,0 +1,466 @@
+/**
+ * Copyright 2012 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.math;
+
+import java.nio.FloatBuffer;
+
+import javax.media.opengl.GL2ES1;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.fixedfunc.GLMatrixFunc;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.opengl.math.geom.Frustum;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.PMVMatrix;
+
+public class TestPMVMatrix01NEWT extends UITestCase {
+
+ static final float epsilon = 0.00001f;
+
+ // matrix 2 rows x 3 columns - In row major order
+ static FloatBuffer matrix2x3R = FloatBuffer.wrap( new float[] { 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f } );
+
+ // matrix 2 rows x 3 columns - In column major order
+ static FloatBuffer matrix2x3C = FloatBuffer.wrap( new float[] { 1.0f, 4.0f,
+ 2.0f, 5.0f,
+ 3.0f, 6.0f } );
+
+ // matrix 3 rows x 2 columns - In row major order
+ static FloatBuffer matrix3x2R = FloatBuffer.wrap( new float[] { 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f } );
+
+ // matrix 3 rows x 2 columns - In column major order
+ static FloatBuffer matrix3x2C = FloatBuffer.wrap( new float[] { 1.0f, 3.0f, 5.0f,
+ 2.0f, 4.0f, 6.0f } );
+
+ // Translated xyz 123 - Row - In row major order !
+ static FloatBuffer translated123R = FloatBuffer.wrap( new float[] { 1.0f, 0.0f, 0.0f, 1.0f,
+ 0.0f, 1.0f, 0.0f, 2.0f,
+ 0.0f, 0.0f, 1.0f, 3.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f } );
+
+ // Translated xyz 123 - Column - In column major order !
+ static FloatBuffer translated123C = FloatBuffer.wrap( new float[] { 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 1.0f, 2.0f, 3.0f, 1.0f } );
+
+ // Translated xyz 123 - Inverse - In column major order !
+ static FloatBuffer translated123I = FloatBuffer.wrap( new float[] { 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ -1.0f, -2.0f, -3.0f, 1.0f } );
+
+ // Translated xyz 123 - Inverse and Transposed - In column major order !
+ static FloatBuffer translated123IT = FloatBuffer.wrap( new float[] { 1.0f, 0.0f, 0.0f, -1.0f,
+ 0.0f, 1.0f, 0.0f, -2.0f,
+ 0.0f, 0.0f, 1.0f, -3.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f } );
+
+ @Test
+ public void test00MatrixToString() {
+ final String s4x4Cpmv = PMVMatrix.matrixToString(null, "%10.5f", translated123C).toString();
+ final String s4x4Cflu = FloatUtil.matrixToString(null, null, "%10.5f", translated123C, 0, 4, 4, false).toString();
+ final String s4x4Rflu = FloatUtil.matrixToString(null, null, "%10.5f", translated123R, 0, 4, 4, true).toString();
+ System.err.println("PMV-C-O 4x4: ");
+ System.err.println(s4x4Cpmv);
+ System.err.println();
+ System.err.println("FLU-C-O 4x4: ");
+ System.err.println(s4x4Cflu);
+ System.err.println();
+ System.err.println("FLU-R-O 4x4: ");
+ System.err.println(s4x4Rflu);
+ System.err.println();
+ Assert.assertEquals(s4x4Cpmv, s4x4Cflu);
+ Assert.assertEquals(s4x4Cflu, s4x4Rflu);
+
+ final String s2x3Rflu = FloatUtil.matrixToString(null, null, "%10.5f", matrix2x3R, 0, 2, 3, true).toString();
+ final String s2x3Cflu = FloatUtil.matrixToString(null, null, "%10.5f", matrix2x3C, 0, 2, 3, false).toString();
+ System.err.println("FLU-R-O 2x3: ");
+ System.err.println(s2x3Rflu);
+ System.err.println();
+ System.err.println("FLU-C-O 2x3: ");
+ System.err.println(s2x3Cflu);
+ System.err.println();
+ Assert.assertEquals(s2x3Cflu, s2x3Rflu);
+
+ final String s3x2Rflu = FloatUtil.matrixToString(null, null, "%10.5f", matrix3x2R, 0, 3, 2, true).toString();
+ final String s3x2Cflu = FloatUtil.matrixToString(null, null, "%10.5f", matrix3x2C, 0, 3, 2, false).toString();
+ System.err.println("FLU-R-O 3x2: ");
+ System.err.println(s3x2Rflu);
+ System.err.println();
+ System.err.println("FLU-C-O 3x2: ");
+ System.err.println(s3x2Cflu);
+ System.err.println();
+ Assert.assertEquals(s3x2Cflu, s3x2Rflu);
+ }
+
+ /**
+ * Test using traditional access workflow, i.e. 1) operation 2) get-matrix references
+ *
+ * The Mvi, Mvit and Frustum dirty-bits and request-mask will be validated.
+ *
+ */
+ @SuppressWarnings("deprecation")
+ @Test
+ public void test01MviUpdateTraditionalAccess() {
+ FloatBuffer p, mv, mvi, mvit;
+ Frustum frustum;
+ boolean b;
+ final PMVMatrix pmv = new PMVMatrix(true);
+ // System.err.println("P0: "+pmv.toString());
+
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
+
+ //
+ // Action #0
+ //
+ final FloatBuffer ident;
+ {
+ pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmv.glLoadIdentity();
+ ident = pmv.glGetPMatrixf();
+
+ pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmv.glLoadIdentity();
+ }
+ Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
+
+ //
+ // Action #1
+ //
+ pmv.glTranslatef(1f, 2f, 3f); // all dirty !
+ Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
+ // System.err.println("P1: "+pmv.toString());
+
+ b = pmv.update(); // will not clean dirty bits, since no request has been made -> false
+ Assert.assertEquals("Update has been perfomed, but non requested", false, b);
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
+ // System.err.println("P2: "+pmv.toString());
+
+ //
+ // Get
+ //
+ p = pmv.glGetPMatrixf();
+ MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString(), ident, p, epsilon);
+ mv = pmv.glGetMvMatrixf();
+ MiscUtils.assertFloatBufferEquals("Mv not translated123, "+pmv.toString(), translated123C, mv, epsilon);
+ mvi = pmv.glGetMviMatrixf();
+ MiscUtils.assertFloatBufferEquals("Mvi not translated123, "+pmv.toString(), translated123I, mvi, epsilon);
+ Assert.assertEquals("Request bit Mvi not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW, pmv.getRequestMask());
+ Assert.assertEquals("Remaining dirty bits not Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+
+ frustum = pmv.glGetFrustum();
+ Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
+ Assert.assertEquals("Remaining dirty bits not Mvit, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits Mvi|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
+ // System.err.println("P3: "+pmv.toString());
+
+ mvit = pmv.glGetMvitMatrixf();
+ MiscUtils.assertFloatBufferEquals("Mvit not translated123, "+pmv.toString()+pmv.toString(), translated123IT, mvit, epsilon);
+ Assert.assertTrue("Dirty bits not clean, "+pmv.toString(), 0 == pmv.getDirtyBits());
+ Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
+ // System.err.println("P4: "+pmv.toString());
+
+ //
+ // Action #2
+ //
+ pmv.glLoadIdentity(); // all dirty
+ Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
+ MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString(), ident, p, epsilon);
+ MiscUtils.assertFloatBufferEquals("Mv not identity, "+pmv.toString(), ident, mv, epsilon);
+ MiscUtils.assertFloatBufferNotEqual("Mvi already identity w/o update, "+pmv.toString(), ident, mvi, epsilon);
+ MiscUtils.assertFloatBufferNotEqual("Mvit already identity w/o update, "+pmv.toString(), ident, mvit, epsilon);
+ MiscUtils.assertFloatBufferEquals("Mvi not translated123, "+pmv.toString()+pmv.toString(), translated123I, mvi, epsilon);
+ MiscUtils.assertFloatBufferEquals("Mvit not translated123, "+pmv.toString()+pmv.toString(), translated123IT, mvit, epsilon);
+ Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
+
+ b = pmv.update(); // will clean dirty bits, since request has been made -> true
+ Assert.assertEquals("Update has not been perfomed, but requested", true, b);
+ Assert.assertTrue("Dirty bits not clean, "+pmv.toString(), 0 == pmv.getDirtyBits());
+ Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
+ MiscUtils.assertFloatBufferEquals("Mvi not identity after update, "+pmv.toString(), ident, mvi, epsilon);
+ MiscUtils.assertFloatBufferEquals("Mvit not identity after update, "+pmv.toString(), ident, mvit, epsilon);
+ Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
+ }
+
+ /**
+ * Test using shader access workflow, i.e. 1) get-matrix references 2) operations
+ *
+ * The Mvi, Mvit and Frustum dirty-bits and request-mask will be validated.
+ *
+ */
+ @SuppressWarnings("deprecation")
+ @Test
+ public void test02MviUpdateShaderAccess() {
+ final FloatBuffer p, mv, mvi, mvit;
+ Frustum frustum;
+ boolean b;
+ final PMVMatrix pmv = new PMVMatrix(true);
+ // System.err.println("P0: "+pmv.toString());
+
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
+
+ //
+ // Action #0
+ //
+ final FloatBuffer ident;
+ {
+ pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmv.glLoadIdentity();
+ ident = pmv.glGetPMatrixf();
+
+ pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmv.glLoadIdentity();
+ }
+ // System.err.println("P0: "+pmv.toString());
+ Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
+ // System.err.println("P1: "+pmv.toString());
+
+ //
+ // Get
+ //
+ p = pmv.glGetPMatrixf();
+ MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString(), ident, p, epsilon);
+ mv = pmv.glGetMvMatrixf();
+ MiscUtils.assertFloatBufferEquals("Mv not identity, "+pmv.toString(), ident, mv, epsilon);
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Request bits not zero, "+pmv.toString(), 0, pmv.getRequestMask());
+
+ mvi = pmv.glGetMviMatrixf();
+ MiscUtils.assertFloatBufferEquals("Mvi not identity, "+pmv.toString(), ident, mvi, epsilon);
+ Assert.assertEquals("Remaining dirty bits not Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bit Mvi not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW, pmv.getRequestMask());
+
+ mvit = pmv.glGetMvitMatrixf();
+ MiscUtils.assertFloatBufferEquals("Mvi not identity, "+pmv.toString(), ident, mvit, epsilon);
+ Assert.assertEquals("Remaining dirty bits not Frustum, "+pmv.toString(), PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ Assert.assertEquals("Request bits Mvi and Mvit not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW, pmv.getRequestMask());
+
+ frustum = pmv.glGetFrustum();
+ Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
+ Assert.assertTrue("Dirty bits not clean, "+pmv.toString(), 0 == pmv.getDirtyBits());
+ Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
+
+ //
+ // Action #1
+ //
+ pmv.glTranslatef(1f, 2f, 3f); // all dirty !
+ Assert.assertTrue("Modified bits zero", 0 != pmv.getModifiedBits(true)); // clear & test
+ Assert.assertTrue("Dirty bits clean, "+pmv.toString(), 0 != pmv.getDirtyBits());
+ Assert.assertEquals("Remaining dirty bits not Mvi|Mvit|Frustum, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW|PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getDirtyBits());
+ MiscUtils.assertFloatBufferEquals("P not identity, "+pmv.toString()+pmv.toString(), ident, p, epsilon);
+ MiscUtils.assertFloatBufferEquals("Mv not translated123, "+pmv.toString()+pmv.toString(), translated123C, mv, epsilon);
+ MiscUtils.assertFloatBufferNotEqual("Mvi already translated123 w/o update, "+pmv.toString()+pmv.toString(), translated123I, mvi, epsilon);
+ MiscUtils.assertFloatBufferNotEqual("Mvit already translated123 w/o update, "+pmv.toString()+pmv.toString(), translated123IT, mvit, epsilon);
+ MiscUtils.assertFloatBufferEquals("Mvi not identity, "+pmv.toString()+pmv.toString(), ident, mvi, epsilon);
+ MiscUtils.assertFloatBufferEquals("Mvit not identity, "+pmv.toString()+pmv.toString(), ident, mvit, epsilon);
+ Assert.assertNotNull("Frustum is null"+pmv.toString(), frustum); // FIXME: Test Frustum value!
+
+ b = pmv.update(); // will clean dirty bits, since all requests has been made -> true
+ Assert.assertEquals("Update has not been perfomed, but requested", true, b);
+ Assert.assertTrue("Dirty bits not clean, "+pmv.toString(), 0 == pmv.getDirtyBits());
+ Assert.assertEquals("Request bits Mvi|Mvit|Frustum not set, "+pmv.toString(), PMVMatrix.DIRTY_INVERSE_MODELVIEW | PMVMatrix.DIRTY_INVERSE_TRANSPOSED_MODELVIEW | PMVMatrix.DIRTY_FRUSTUM, pmv.getRequestMask());
+ MiscUtils.assertFloatBufferEquals("Mvi not translated123, "+pmv.toString()+pmv.toString(), translated123I, mvi, epsilon);
+ MiscUtils.assertFloatBufferEquals("Mvit not translated123, "+pmv.toString()+pmv.toString(), translated123IT, mvit, epsilon);
+ // System.err.println("P2: "+pmv.toString());
+ }
+
+ @SuppressWarnings("unused")
+ @Test
+ public void test03MvTranslate() {
+ final FloatBuffer pmvMv, pmvMvi, pmvMvit;
+ {
+ final PMVMatrix pmv = new PMVMatrix(true);
+ pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmv.glLoadIdentity();
+ pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmv.glLoadIdentity();
+ pmv.glTranslatef(5f, 6f, 7f);
+
+ pmvMv = pmv.glGetMvMatrixf();
+ pmvMvi = pmv.glGetMviMatrixf();
+ pmvMvit = pmv.glGetMvitMatrixf();
+ }
+
+ final FloatBuffer glMv = FloatBuffer.allocate(16);
+ {
+ GL2ES1 gl = dc.glc.getGL().getGL2ES1();
+ gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ gl.glLoadIdentity();
+ gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glTranslatef(5f, 6f, 7f);
+
+ gl.glGetFloatv(GLMatrixFunc.GL_MODELVIEW_MATRIX, glMv);
+ }
+ // System.err.println(PMVMatrix.matrixToString(null, "%10.5f", glMv, pmvMv).toString());
+
+ MiscUtils.assertFloatBufferEquals("Arrays not equal, expected"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", glMv).toString()+
+ ", actual"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMv).toString(),
+ glMv, pmvMv, epsilon);
+
+ // System.err.println("pmvMvi: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvi));
+ // System.err.println("pmvMvit: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvit));
+ }
+
+ @SuppressWarnings("unused")
+ @Test
+ public void test04MvTranslateRotate() {
+ final FloatBuffer pmvMv, pmvMvi, pmvMvit;
+ {
+ final PMVMatrix pmv = new PMVMatrix(true);
+ pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmv.glLoadIdentity();
+ pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmv.glLoadIdentity();
+ pmv.glTranslatef(5f, 6f, 7f);
+ pmv.glRotatef(90f, 1f, 0f, 0f);
+
+ pmvMv = pmv.glGetMvMatrixf();
+ pmvMvi = pmv.glGetMviMatrixf();
+ pmvMvit = pmv.glGetMvitMatrixf();
+ }
+
+ final FloatBuffer glMv = FloatBuffer.allocate(16);
+ {
+ GL2ES1 gl = dc.glc.getGL().getGL2ES1();
+ gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ gl.glLoadIdentity();
+ gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glTranslatef(5f, 6f, 7f);
+ gl.glRotatef(90f, 1f, 0f, 0f);
+
+ gl.glGetFloatv(GLMatrixFunc.GL_MODELVIEW_MATRIX, glMv);
+ }
+ // System.err.println(PMVMatrix.matrixToString(null, "%10.5f", glMv, pmvMv).toString());
+
+ MiscUtils.assertFloatBufferEquals("Arrays not equal, expected"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", glMv).toString()+
+ ", actual"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMv).toString(),
+ glMv, pmvMv, epsilon);
+
+ // System.err.println("pmvMvi: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvi));
+ // System.err.println("pmvMvit: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvit));
+ }
+
+ static DrawableContext dc;
+
+ @BeforeClass
+ public static void setup() throws Throwable {
+ try {
+ dc = createOffscreenDrawableAndCurrentFFPContext();
+ } catch (Throwable t) {
+ setTestSupported(false);
+ throw t;
+ }
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ destroyDrawableContext(dc);
+ }
+
+ static class DrawableContext {
+ DrawableContext(GLDrawable d, GLContext glc) {
+ this.d = d;
+ this.glc = glc;
+ }
+ GLDrawable d;
+ GLContext glc;
+ }
+
+ private static DrawableContext createOffscreenDrawableAndCurrentFFPContext() throws Throwable {
+ GLProfile glp = GLProfile.getMaxFixedFunc(true);
+ GLCapabilities glCaps = new GLCapabilities(glp);
+ glCaps.setOnscreen(false);
+ glCaps.setPBuffer(true);
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ GLDrawable d = factory.createOffscreenDrawable(null, glCaps, null, 64, 64);
+ d.setRealized(true);
+ GLContext glc = null;
+ try {
+ glc = d.createContext(null);
+ Assert.assertTrue("Context could not be made current", GLContext.CONTEXT_NOT_CURRENT < glc.makeCurrent());
+ return new DrawableContext(d, glc);
+ } catch (Throwable t) {
+ if(null != glc) {
+ glc.destroy();
+ }
+ d.setRealized(false);
+ throw t;
+ }
+ }
+
+ private static void destroyDrawableContext(DrawableContext dc) {
+ if(null != dc.glc) {
+ dc.glc.destroy();
+ dc.glc = null;
+ }
+ if(null != dc.d) {
+ dc.d.setRealized(false);
+ dc.d = null;
+ }
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestPMVMatrix01NEWT.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java
new file mode 100644
index 000000000..0c66ad237
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java
@@ -0,0 +1,109 @@
+/**
+ * Copyright 2012 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.math;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jogamp.opengl.util.PMVMatrix;
+
+import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import java.nio.FloatBuffer;
+
+import static org.junit.Assert.assertArrayEquals;
+
+/**
+ * @author Thomas De Bodt
+ */
+public class TestPMVMatrix02NOUI {
+
+ private PMVMatrix fMat;
+
+ @Before
+ public void setUp() throws Exception {
+ fMat = new PMVMatrix();
+ }
+
+ @Test
+ public void testLookAtNegZIsNoOp() throws Exception {
+ fMat.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ // Look towards -z
+ fMat.gluLookAt(
+ 0, 0, 0,
+ 0, 0, -1,
+ 0, 1, 0
+ );
+ FloatBuffer mvMatrix = fMat.glGetMvMatrixf();
+ float[] mvMatrixArr = new float[16];
+ mvMatrix.asReadOnlyBuffer().get(mvMatrixArr);
+ assertArrayEquals(
+ /**
+ * The 3 rows of the matrix (= the 3 columns of the array/buffer) should be: side, up, -forward.
+ */
+ new float[] {
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1
+ },
+ mvMatrixArr,
+ 1e-6f
+ );
+ }
+ @Test
+ public void testLookAtPosY() throws Exception {
+ fMat.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ // Look towards +y
+ fMat.gluLookAt(
+ 0, 0, 0,
+ 0, 1, 0,
+ 0, 0, 1
+ );
+ FloatBuffer mvMatrix = fMat.glGetMvMatrixf();
+ float[] mvMatrixArr = new float[16];
+ mvMatrix.asReadOnlyBuffer().get(mvMatrixArr);
+ assertArrayEquals(
+ /**
+ * The 3 rows of the matrix (= the 3 columns of the array/buffer) should be: side, up, -forward.
+ */
+ new float[] {
+ 1, 0, 0, 0,
+ 0, 0, -1, 0,
+ 0, 1, 0, 0,
+ 0, 0, 0, 1
+ },
+ mvMatrixArr,
+ 1e-6f
+ );
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestPMVMatrix02NOUI.class.getName());
+ }
+}
--
cgit v1.2.3
From 70087b3067df7bfe6612af7388f8e86f77b150b4 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 9 Jun 2013 06:08:19 +0200
Subject: ScreenMode Unit Tests: Add wait for screen destroy (off-thread)
---
.../com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java | 2 ++
.../com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java | 2 ++
.../com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java | 2 ++
src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java | 7 ++++++-
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java
index f4eaec5fa..fe5dd93cb 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java
@@ -42,6 +42,7 @@ import com.jogamp.newt.Screen;
import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
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.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -110,6 +111,7 @@ public class TestScreenMode00bNEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
index 2dd16b9d2..a2ce7cec0 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
@@ -261,6 +261,7 @@ public class TestScreenMode01NEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
@@ -363,6 +364,7 @@ public class TestScreenMode01NEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java
index 542297209..58bce4cc9 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java
@@ -49,6 +49,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.UITestCase;
import java.util.List;
import javax.media.nativewindow.util.Dimension;
@@ -167,6 +168,7 @@ public class TestScreenMode02NEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
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 e128123ed..b5f8def3c 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -633,7 +633,12 @@ public class AWTRobotUtil {
*/
public static boolean waitForRealized(Object obj, boolean realized) throws InterruptedException {
int wait;
- if(obj instanceof com.jogamp.newt.Window) {
+ if(obj instanceof com.jogamp.newt.Screen) {
+ com.jogamp.newt.Screen screen = (com.jogamp.newt.Screen) obj;
+ for (wait=0; wait
Date: Sun, 9 Jun 2013 06:11:33 +0200
Subject: Bug 747: Allow usage of IdentityHashMap w/ keys:
AbstractGraphicsDevice.getUniqueID() and
GLContext.getDeviceVersionAvailableKey()
.. both value classes unique, long lived and rare.
---
src/jogl/classes/javax/media/opengl/GLContext.java | 28 ++++++++++++----------
.../media/nativewindow/AbstractGraphicsDevice.java | 12 +++++++---
.../media/nativewindow/DefaultGraphicsDevice.java | 7 +++++-
3 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index abafabb1c..fd3c31b6d 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -42,7 +42,7 @@ package javax.media.opengl;
import java.nio.IntBuffer;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Set;
@@ -1209,12 +1209,12 @@ public abstract class GLContext {
/**
* @see #getDeviceVersionAvailableKey(javax.media.nativewindow.AbstractGraphicsDevice, int, int)
*/
- protected static /*final*/ HashMap deviceVersionAvailable = new HashMap();
+ protected static /*final*/ IdentityHashMap deviceVersionAvailable = new IdentityHashMap();
/**
* @see #getUniqueDeviceString(javax.media.nativewindow.AbstractGraphicsDevice)
*/
- private static /*final*/ HashSet deviceVersionsAvailableSet = new HashSet();
+ private static /*final*/ IdentityHashMap deviceVersionsAvailableSet = new IdentityHashMap();
/** clears the device/context mappings as well as the GL/GLX proc address tables. */
protected static void shutdown() {
@@ -1225,17 +1225,16 @@ public abstract class GLContext {
protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) {
synchronized ( deviceVersionsAvailableSet ) {
- return deviceVersionsAvailableSet.contains(device.getUniqueID());
+ return deviceVersionsAvailableSet.containsKey(device.getUniqueID());
}
}
protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) {
synchronized ( deviceVersionsAvailableSet ) {
- String devKey = device.getUniqueID();
- if ( deviceVersionsAvailableSet.contains(devKey) ) {
+ final String devKey = device.getUniqueID();
+ if( null != deviceVersionsAvailableSet.put(devKey, devKey) ) {
throw new InternalError("Already set: "+devKey);
}
- deviceVersionsAvailableSet.add(devKey);
if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB: SET mappedVersionsAvailableSet "+devKey);
System.err.println(GLContext.dumpAvailableGLVersions(null).toString());
@@ -1243,8 +1242,13 @@ public abstract class GLContext {
}
}
+ /**
+ * Returns a unique String object using {@link String#intern()} for the given arguments,
+ * which object reference itself can be used as a key.
+ */
protected static String getDeviceVersionAvailableKey(AbstractGraphicsDevice device, int major, int profile) {
- return device.getUniqueID() + "-" + toHexString(composeBits(major, profile, 0));
+ final String r = device.getUniqueID() + "-" + toHexString(composeBits(major, profile, 0));
+ return r.intern();
}
/**
@@ -1272,10 +1276,10 @@ public abstract class GLContext {
System.err.println("GLContext.mapAvailableGLVersion: "+device+": "+getGLVersion(reqMajor, 0, profile, null)+" -> "+getGLVersion(resMajor, resMinor, resCtp, null));
// Thread.dumpStack();
}
- final String key = getDeviceVersionAvailableKey(device, reqMajor, profile);
+ final String objectKey = getDeviceVersionAvailableKey(device, reqMajor, profile);
final Integer val = new Integer(composeBits(resMajor, resMinor, resCtp));
synchronized(deviceVersionAvailable) {
- return deviceVersionAvailable.put( key, val );
+ return deviceVersionAvailable.put( objectKey, val );
}
}
@@ -1315,10 +1319,10 @@ public abstract class GLContext {
* @return the available GL version as encoded with {@link #composeBits(int, int, int), otherwise null
*/
protected static Integer getAvailableGLVersion(AbstractGraphicsDevice device, int reqMajor, int reqProfile) {
- String key = getDeviceVersionAvailableKey(device, reqMajor, reqProfile);
+ final String objectKey = getDeviceVersionAvailableKey(device, reqMajor, reqProfile);
Integer val;
synchronized(deviceVersionAvailable) {
- val = deviceVersionAvailable.get( key );
+ val = deviceVersionAvailable.get( objectKey );
}
return val;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index 585cd1f09..ed305d49e 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -89,10 +89,16 @@ public interface AbstractGraphicsDevice extends Cloneable {
public int getUnitID();
/**
- * Returns a unique ID String of this device using {@link #getType() type},
- * {@link #getConnection() connection} and {@link #getUnitID() unitID}.
- * The unique ID does not reflect the instance of the device, hence the handle is not included.
+ * Returns a unique ID object of this device using {@link #getType() type},
+ * {@link #getConnection() connection} and {@link #getUnitID() unitID} as it's key components.
+ *
+ * The unique ID does not reflect the instance of the device, hence the handle is not included.
* The unique ID may be used as a key for semantic device mapping.
+ *
+ *
+ * The returned string object reference is unique using {@link String#intern()}
+ * and hence can be used as a key itself.
+ *
*/
public String getUniqueID();
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index 66b81d7fa..0bf5c2937 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -253,7 +253,12 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
return toolkitLock;
}
+ /**
+ * Returns a unique String object using {@link String#intern()} for the given arguments,
+ * which object reference itself can be used as a key.
+ */
protected static String getUniqueID(String type, String connection, int unitID) {
- return (type + separator + connection + separator + unitID).intern();
+ final String r = (type + separator + connection + separator + unitID).intern();
+ return r.intern();
}
}
--
cgit v1.2.3
From e2b443a61cc9dd3efcaf685163ef9290638bf18e Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 9 Jun 2013 06:12:33 +0200
Subject: Adapt to Gluegen's IOUtil change commit
b98825eb7cfb61aead4a7dff57471cd2d2c26823
---
.../opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java
index 7b53d973c..81f64f0ae 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java
@@ -26,7 +26,7 @@ public class TestPNGImage01NEWT extends UITestCase {
System.err.println("PNGImage - Orig: "+image1);
image1.write(out1_f, true);
{
- Assert.assertEquals(image1.getData(), PNGImage.read(IOUtil.toURL(out1_f).openStream()).getData());
+ Assert.assertEquals(image1.getData(), PNGImage.read(out1_f.toURI().toURL().openStream()).getData());
}
final PNGImage image2 = PNGImage.createFromData(image1.getWidth(), image1.getHeight(),
@@ -34,7 +34,7 @@ public class TestPNGImage01NEWT extends UITestCase {
image1.getBytesPerPixel(), false /* reverseChannels */, image1.isGLOriented(), image1.getData());
image2.write(out2_f, true);
{
- Assert.assertEquals(image1.getData(), PNGImage.read(IOUtil.toURL(out2_f).openStream()).getData());
+ Assert.assertEquals(image1.getData(), PNGImage.read(out2_f.toURI().toURL().openStream()).getData());
}
// flipped
--
cgit v1.2.3
From 81a4f175e3065ea281139d08cc79bcdfb4912ee7 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 9 Jun 2013 08:45:08 +0200
Subject: FloatUtil: Add in-place multMatrixf (since we mult line by line, we
can multiply in place). Will be used by PMVMatrix.
---
.../classes/com/jogamp/opengl/math/FloatUtil.java | 51 ++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
index 9a51c32b3..f3f44f15a 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
@@ -112,6 +112,22 @@ public class FloatUtil {
}
}
+ /**
+ * @param a 4x4 matrix in column-major order (also result)
+ * @param b 4x4 matrix in column-major order
+ */
+ public static final void multMatrixf(final float[] a, int a_off, final float[] b, int b_off) {
+ for (int i = 0; i < 4; i++) {
+ // one row in column-major order
+ final int a_off_i = a_off+i;
+ final float ai0=a[a_off_i+0*4], ai1=a[a_off_i+1*4], ai2=a[a_off_i+2*4], ai3=a[a_off_i+3*4]; // row-i of a
+ a[a_off_i+0*4] = ai0 * b[b_off+0+0*4] + ai1 * b[b_off+1+0*4] + ai2 * b[b_off+2+0*4] + ai3 * b[b_off+3+0*4] ;
+ a[a_off_i+1*4] = ai0 * b[b_off+0+1*4] + ai1 * b[b_off+1+1*4] + ai2 * b[b_off+2+1*4] + ai3 * b[b_off+3+1*4] ;
+ a[a_off_i+2*4] = ai0 * b[b_off+0+2*4] + ai1 * b[b_off+1+2*4] + ai2 * b[b_off+2+2*4] + ai3 * b[b_off+3+2*4] ;
+ a[a_off_i+3*4] = ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] ;
+ }
+ }
+
/**
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
@@ -146,6 +162,23 @@ public class FloatUtil {
d.put(dP+i+3*4 , ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] );
}
}
+
+ /**
+ * @param a 4x4 matrix in column-major order (also result)
+ * @param b 4x4 matrix in column-major order
+ */
+ public static final void multMatrixf(final FloatBuffer a, final float[] b, int b_off) {
+ final int aP = a.position();
+ for (int i = 0; i < 4; i++) {
+ // one row in column-major order
+ final int aP_i = aP+i;
+ final float ai0=a.get(aP_i+0*4), ai1=a.get(aP_i+1*4), ai2=a.get(aP_i+2*4), ai3=a.get(aP_i+3*4); // row-i of a
+ a.put(aP_i+0*4 , ai0 * b[b_off+0+0*4] + ai1 * b[b_off+1+0*4] + ai2 * b[b_off+2+0*4] + ai3 * b[b_off+3+0*4] );
+ a.put(aP_i+1*4 , ai0 * b[b_off+0+1*4] + ai1 * b[b_off+1+1*4] + ai2 * b[b_off+2+1*4] + ai3 * b[b_off+3+1*4] );
+ a.put(aP_i+2*4 , ai0 * b[b_off+0+2*4] + ai1 * b[b_off+1+2*4] + ai2 * b[b_off+2+2*4] + ai3 * b[b_off+3+2*4] );
+ a.put(aP_i+3*4 , ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] );
+ }
+ }
/**
* @param a 4x4 matrix in column-major order
@@ -166,6 +199,24 @@ public class FloatUtil {
}
}
+ /**
+ * @param a 4x4 matrix in column-major order (also result)
+ * @param b 4x4 matrix in column-major order
+ */
+ public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b) {
+ final int aP = a.position();
+ final int bP = b.position();
+ for (int i = 0; i < 4; i++) {
+ // one row in column-major order
+ final int aP_i = aP+i;
+ final float ai0=a.get(aP_i+0*4), ai1=a.get(aP_i+1*4), ai2=a.get(aP_i+2*4), ai3=a.get(aP_i+3*4); // row-i of a
+ a.put(aP_i+0*4 , ai0 * b.get(bP+0+0*4) + ai1 * b.get(bP+1+0*4) + ai2 * b.get(bP+2+0*4) + ai3 * b.get(bP+3+0*4) );
+ a.put(aP_i+1*4 , ai0 * b.get(bP+0+1*4) + ai1 * b.get(bP+1+1*4) + ai2 * b.get(bP+2+1*4) + ai3 * b.get(bP+3+1*4) );
+ a.put(aP_i+2*4 , ai0 * b.get(bP+0+2*4) + ai1 * b.get(bP+1+2*4) + ai2 * b.get(bP+2+2*4) + ai3 * b.get(bP+3+2*4) );
+ a.put(aP_i+3*4 , ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) );
+ }
+ }
+
/**
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
--
cgit v1.2.3
From 50fc55b42f791840ce1ddee943351ccc61285a84 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 9 Jun 2013 08:50:06 +0200
Subject: Fix Bug 748 - PMVMatrix gluProject and gluUnProject broken w/
backingArray (default) ; Also: Use FloatUtil in-place multMatrixf.
PMVMatrix gluProject(..) and gluUnProject(..) don't pass their position (offset)
to the multMatrixf operation - even though they are sliced.
The API doc actually emphasizes this.
---
make/scripts/tests.sh | 3 +-
.../classes/com/jogamp/opengl/util/PMVMatrix.java | 24 ++--
.../test/junit/jogl/math/TestPMVMatrix03NOUI.java | 125 +++++++++++++++++++++
3 files changed, 139 insertions(+), 13 deletions(-)
mode change 100755 => 100644 make/scripts/tests.sh
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
old mode 100755
new mode 100644
index d49a0fc33..693683827
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -281,7 +281,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
-testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
@@ -312,6 +312,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT
#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 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestGluUnprojectFloatNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestGluUnprojectDoubleNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestFloatUtil01MatrixMatrixMultNOUI $*
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index bfc03d019..58151856f 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -488,7 +488,7 @@ public class PMVMatrix implements GLMatrixFunc {
if(matrixGetName==GL_MATRIX_MODE) {
params.put((float)matrixMode);
} else {
- FloatBuffer matrix = glGetMatrixf(matrixGetName);
+ final FloatBuffer matrix = glGetMatrixf(matrixGetName);
params.put(matrix); // matrix -> params
matrix.reset();
}
@@ -500,7 +500,7 @@ public class PMVMatrix implements GLMatrixFunc {
if(matrixGetName==GL_MATRIX_MODE) {
params[params_offset]=(float)matrixMode;
} else {
- FloatBuffer matrix = glGetMatrixf(matrixGetName);
+ final FloatBuffer matrix = glGetMatrixf(matrixGetName);
matrix.get(params, params_offset, 16); // matrix -> params
matrix.reset();
}
@@ -619,15 +619,15 @@ public class PMVMatrix implements GLMatrixFunc {
@Override
public final void glMultMatrixf(final FloatBuffer m) {
if(matrixMode==GL_MODELVIEW) {
- FloatUtil.multMatrixf(matrixMv, m, matrixMv);
+ FloatUtil.multMatrixf(matrixMv, m);
dirtyBits |= DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM ;
modifiedBits |= MODIFIED_MODELVIEW;
} else if(matrixMode==GL_PROJECTION) {
- FloatUtil.multMatrixf(matrixP, m, matrixP);
+ FloatUtil.multMatrixf(matrixP, m);
dirtyBits |= DIRTY_FRUSTUM ;
modifiedBits |= MODIFIED_PROJECTION;
} else if(matrixMode==GL.GL_TEXTURE) {
- FloatUtil.multMatrixf(matrixTex, m, matrixTex);
+ FloatUtil.multMatrixf(matrixTex, m);
modifiedBits |= MODIFIED_TEXTURE;
}
}
@@ -635,15 +635,15 @@ public class PMVMatrix implements GLMatrixFunc {
@Override
public final void glMultMatrixf(float[] m, int m_offset) {
if(matrixMode==GL_MODELVIEW) {
- FloatUtil.multMatrixf(matrixMv, m, m_offset, matrixMv);
+ FloatUtil.multMatrixf(matrixMv, m, m_offset);
dirtyBits |= DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM ;
modifiedBits |= MODIFIED_MODELVIEW;
} else if(matrixMode==GL_PROJECTION) {
- FloatUtil.multMatrixf(matrixP, m, m_offset, matrixP);
+ FloatUtil.multMatrixf(matrixP, m, m_offset);
dirtyBits |= DIRTY_FRUSTUM ;
modifiedBits |= MODIFIED_PROJECTION;
} else if(matrixMode==GL.GL_TEXTURE) {
- FloatUtil.multMatrixf(matrixTex, m, m_offset, matrixTex);
+ FloatUtil.multMatrixf(matrixTex, m, m_offset);
modifiedBits |= MODIFIED_TEXTURE;
}
}
@@ -813,8 +813,8 @@ public class PMVMatrix implements GLMatrixFunc {
float[] win_pos, int win_pos_offset ) {
if(usesBackingArray) {
return projectFloat.gluProject(objx, objy, objz,
- matrixMv.array(), 0,
- matrixP.array(), 0,
+ matrixMv.array(), matrixMv.position(),
+ matrixP.array(), matrixP.position(),
viewport, viewport_offset,
win_pos, win_pos_offset);
} else {
@@ -843,8 +843,8 @@ public class PMVMatrix implements GLMatrixFunc {
float[] obj_pos, int obj_pos_offset) {
if(usesBackingArray) {
return projectFloat.gluUnProject(winx, winy, winz,
- matrixMv.array(), 0,
- matrixP.array(), 0,
+ matrixMv.array(), matrixMv.position(),
+ matrixP.array(), matrixP.position(),
viewport, viewport_offset,
obj_pos, obj_pos_offset);
} else {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java
new file mode 100644
index 000000000..81242ce6e
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java
@@ -0,0 +1,125 @@
+package com.jogamp.opengl.test.junit.jogl.math;
+
+import java.util.Arrays;
+
+import jogamp.opengl.ProjectFloat;
+
+import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.opengl.util.PMVMatrix;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestPMVMatrix03NOUI {
+
+ static final float epsilon = 0.00001f;
+
+ // Simple 10 x 10 view port
+ static final int[] viewport = new int[] { 0,0,10,10};
+
+ @Test
+ public void test01() {
+ float[] winA00 = new float[4];
+ float[] winA01 = new float[4];
+ float[] winA10 = new float[4];
+ float[] winA11 = new float[4];
+ PMVMatrix m = new PMVMatrix();
+
+ m.gluProject(1f, 0f, 0f, viewport, 0, winA00, 0);
+ System.out.println("A.0.0 - Project 1,0 -->" + Arrays.toString(winA00));
+
+ m.gluProject(0f, 0f, 0f, viewport, 0, winA01, 0);
+ System.out.println("A.0.1 - Project 0,0 -->" + Arrays.toString(winA01));
+
+ m.glMatrixMode(PMVMatrix.GL_PROJECTION);
+ m.glOrthof(0, 10, 0, 10, 1, -1);
+ System.out.println("MATRIX - Ortho 0,0,10,10 - Locate the origin in the bottom left and scale");
+ System.out.println(m);
+ float[] projMatrixA = new float[16];
+ float[] modelMatrixA = new float[16];
+ m.glGetFloatv(PMVMatrix.GL_PROJECTION, projMatrixA, 0);
+ m.glGetFloatv(PMVMatrix.GL_MODELVIEW, modelMatrixA, 0);
+
+ m.gluProject(1f, 0f, 0f, viewport, 0, winA10, 0);
+ System.out.println("A.1.0 - Project 1,0 -->" +Arrays.toString(winA10));
+
+ m.gluProject(0f, 0f, 0f, viewport, 0, winA11, 0);
+ System.out.println("A.1.1 - Project 0,0 -->" +Arrays.toString(winA11));
+
+
+ ////////////////////
+ /////////////////////
+
+ float[] winB00 = new float[4];
+ float[] winB01 = new float[4];
+ float[] winB10 = new float[4];
+ float[] winB11 = new float[4];
+ float[] projMatrixB = new float[16];
+ float[] modelMatrixB = new float[16];
+ FloatUtil.makeIdentityf(projMatrixB, 0);
+ FloatUtil.makeIdentityf(modelMatrixB, 0);
+ final ProjectFloat projectFloat = new ProjectFloat(true);
+
+ projectFloat.gluProject(1f, 0f, 0f, modelMatrixB, 0, projMatrixB, 0, viewport, 0, winB00, 0);
+ System.out.println("B.0.0 - Project 1,0 -->" +Arrays.toString(winB00));
+
+ projectFloat.gluProject(0f, 0f, 0f, modelMatrixB, 0, projMatrixB, 0, viewport, 0, winB01, 0);
+ System.out.println("B.0.1 - Project 0,0 -->" +Arrays.toString(winB01));
+
+ glOrthof(projMatrixB, 0, 10, 0, 10, 1, -1);
+ System.out.println("FloatUtil - Ortho 0,0,10,10 - Locate the origin in the bottom left and scale");
+ System.out.println("Projection");
+ System.err.println(FloatUtil.matrixToString(null, null, "%10.5f", projMatrixB, 0, 4, 4, false /* rowMajorOrder */));
+ System.out.println("Modelview");
+ System.err.println(FloatUtil.matrixToString(null, null, "%10.5f", modelMatrixB, 0, 4, 4, false /* rowMajorOrder */));
+
+ projectFloat.gluProject(1f, 0f, 0f, modelMatrixB, 0, projMatrixB, 0, viewport, 0, winB10, 0);
+ System.out.println("B.1.0 - Project 1,0 -->" +Arrays.toString(winB10));
+
+ projectFloat.gluProject(0f, 0f, 0f, modelMatrixB, 0, projMatrixB, 0, viewport, 0, winB11, 0);
+ System.out.println("B.1.1 - Project 0,0 -->" +Arrays.toString(winB11));
+
+ Assert.assertArrayEquals("A/B 0.0 Project 1,0 failure", winB00, winA00, epsilon);
+ Assert.assertArrayEquals("A/B 0.1 Project 0,0 failure", winB01, winA01, epsilon);
+ Assert.assertArrayEquals("A/B 1.0 Project 1,0 failure", winB10, winA10, epsilon);
+ Assert.assertArrayEquals("A/B 1.1 Project 0,0 failure", winB11, winA11, epsilon);
+
+ Assert.assertEquals("A 0.0 Project 1,0 failure X", 10.0, winA00[0], epsilon);
+ Assert.assertEquals("A 0.0 Project 1,0 failure Y", 5.0, winA00[1], epsilon);
+ Assert.assertEquals("A.0.1 Project 0,0 failure X", 5.0, winA01[0], epsilon);
+ Assert.assertEquals("A.0.1 Project 0,0 failure Y", 5.0, winA01[1], epsilon);
+ Assert.assertEquals("A 1.0 Project 1,0 failure X", 1.0, winA10[0], epsilon);
+ Assert.assertEquals("A 1.0 Project 1,0 failure Y", 0.0, winA10[1], epsilon);
+ Assert.assertEquals("A.1.1 Project 0,0 failure X", 0.0, winA11[0], epsilon);
+ Assert.assertEquals("A.1.1 Project 0,0 failure Y", 0.0, winA11[1], epsilon);
+ }
+
+ public final void glOrthof(final float[] m, final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
+ // Ortho matrix:
+ // 2/dx 0 0 tx
+ // 0 2/dy 0 ty
+ // 0 0 2/dz tz
+ // 0 0 0 1
+ final float dx=right-left;
+ final float dy=top-bottom;
+ final float dz=zFar-zNear;
+ final float tx=-1.0f*(right+left)/dx;
+ final float ty=-1.0f*(top+bottom)/dy;
+ final float tz=-1.0f*(zFar+zNear)/dz;
+
+ float[] matrixOrtho = new float[16];
+ FloatUtil.makeIdentityf(matrixOrtho, 0);
+ matrixOrtho[0+4*0] = 2.0f/dx;
+ matrixOrtho[1+4*1] = 2.0f/dy;
+ matrixOrtho[2+4*2] = -2.0f/dz;
+ matrixOrtho[0+4*3] = tx;
+ matrixOrtho[1+4*3] = ty;
+ matrixOrtho[2+4*3] = tz;
+
+ FloatUtil.multMatrixf(m, 0, matrixOrtho, 0);
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestPMVMatrix03NOUI.class.getName());
+ }
+}
--
cgit v1.2.3
From ee3c6d807f24fafc6a79da4d60442f62f6065d39 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 9 Jun 2013 18:50:39 +0200
Subject: HowTo Build: Ubuntu -> Debian
---
doc/HowToBuild.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/HowToBuild.html b/doc/HowToBuild.html
index ad965e194..529d1003b 100644
--- a/doc/HowToBuild.html
+++ b/doc/HowToBuild.html
@@ -76,7 +76,7 @@
GNU Linux x86, 32- and 64-bit
You may have to install a few developer packages ...
-
[K]Ubuntu 10.04 or later
+
Debian 5.00 or later
git
gcc
--
cgit v1.2.3
From 05eef46e33f41f5c234ffb1563fd8f641208fe85 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Tue, 11 Jun 2013 16:29:48 +0200
Subject: Adapt to GlueGen commit 1a01dce6c42b398cdd68d405828774a3ab366456
---
make/config/jogl/cg-common-CustomJavaCode.java | 6 +++++-
make/config/jogl/cg-common.cfg | 2 ++
make/scripts/tests.sh | 4 ++--
.../classes/com/jogamp/graph/font/FontFactory.java | 8 ++++---
.../font/typecast/TypecastFontConstructor.java | 2 +-
src/jogl/classes/jogamp/opengl/Debug.java | 25 ++++++++++------------
.../av/impl/FFMPEGDynamicLibraryBundleInfo.java | 7 +++++-
.../classes/jogamp/nativewindow/Debug.java | 24 +++++++++------------
.../jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 6 ++++--
src/newt/classes/jogamp/newt/Debug.java | 25 ++++++++++------------
10 files changed, 57 insertions(+), 52 deletions(-)
diff --git a/make/config/jogl/cg-common-CustomJavaCode.java b/make/config/jogl/cg-common-CustomJavaCode.java
index 31d1961fc..cc1fefd1a 100644
--- a/make/config/jogl/cg-common-CustomJavaCode.java
+++ b/make/config/jogl/cg-common-CustomJavaCode.java
@@ -6,7 +6,11 @@ static {
if(null==cgProcAddressTable) {
throw new RuntimeException("Couldn't instantiate CgProcAddressTable");
}
- cgDynamicLookupHelper = new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo());
+
+ cgDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction() {
+ public DynamicLibraryBundle run() {
+ return new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo());
+ } } );
if(null==cgDynamicLookupHelper) {
throw new RuntimeException("Null CgDynamicLookupHelper");
}
diff --git a/make/config/jogl/cg-common.cfg b/make/config/jogl/cg-common.cfg
index 35805bf01..d6a5367a6 100644
--- a/make/config/jogl/cg-common.cfg
+++ b/make/config/jogl/cg-common.cfg
@@ -105,6 +105,8 @@ Import jogamp.opengl.*
Import com.jogamp.common.os.DynamicLookupHelper
Import com.jogamp.common.os.DynamicLibraryBundle
Import com.jogamp.opengl.cg.CgDynamicLibraryBundleInfo
+Import java.security.PrivilegedAction
+Import java.security.AccessController
#
# NIODirectOnly directives for routines requiring them for semantic reasons
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 693683827..2a75ffc5b 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -284,7 +284,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
@@ -312,7 +312,7 @@ function testawtswt() {
#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 $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestPMVMatrix03NOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestGluUnprojectFloatNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestGluUnprojectDoubleNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestFloatUtil01MatrixMatrixMultNOUI $*
diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
index 33d487355..33a977bba 100644
--- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
+++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
@@ -33,13 +33,15 @@ import java.net.URLConnection;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.ReflectionUtil;
-import com.jogamp.common.util.SecurityUtil;
import jogamp.graph.font.FontConstructor;
import jogamp.graph.font.JavaFontLoader;
import jogamp.graph.font.UbuntuFontLoader;
public class FontFactory {
+ public static final String FontConstructorPropKey = "jogamp.graph.font.ctor";
+ public static final String DefaultFontConstructor = "jogamp.graph.font.typecast.TypecastFontConstructor";
+
/** Ubuntu is the default font family */
public static final int UBUNTU = 0;
@@ -54,9 +56,9 @@ public class FontFactory {
* "jogamp.graph.font.typecast.TypecastFontFactory" (default)
* "jogamp.graph.font.ttf.TTFFontImpl"
*/
- String fontImplName = PropertyAccess.getProperty("FontImpl", true, SecurityUtil.getCommonAccessControlContext(FontFactory.class));
+ String fontImplName = PropertyAccess.getProperty(FontConstructorPropKey, true);
if(null == fontImplName) {
- fontImplName = "jogamp.graph.font.typecast.TypecastFontConstructor";
+ fontImplName = DefaultFontConstructor;
}
fontConstr = (FontConstructor) ReflectionUtil.createInstance(fontImplName, FontFactory.class.getClassLoader());
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
index 0f762e79c..8479c08ca 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
@@ -71,7 +71,7 @@ public class TypecastFontConstructor implements FontConstructor {
int len=0;
Font f = null;
try {
- tf = IOUtil.createTempFile( "jogl.font", ".ttf", false, null);
+ tf = IOUtil.createTempFile( "jogl.font", ".ttf", false);
len = IOUtil.copyURLConn2File(fconn, tf);
if(len==0) {
tf.delete();
diff --git a/src/jogl/classes/jogamp/opengl/Debug.java b/src/jogl/classes/jogamp/opengl/Debug.java
index 4287c1960..f87f1bb3f 100644
--- a/src/jogl/classes/jogamp/opengl/Debug.java
+++ b/src/jogl/classes/jogamp/opengl/Debug.java
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 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
@@ -39,6 +40,9 @@
package jogamp.opengl;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
import com.jogamp.common.util.PropertyAccess;
/** Helper routines for logging and debugging. */
@@ -49,7 +53,12 @@ public class Debug extends PropertyAccess {
private static final boolean debugAll;
static {
- PropertyAccess.addTrustedPrefix("jogl.", Debug.class);
+ AccessController.doPrivileged(new PrivilegedAction
+ */
+ public void keyReleased(KeyEvent e);
}
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
index 98ba5a24d..629dc50d7 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
@@ -48,9 +48,5 @@ public class TraceKeyAdapter implements KeyListener {
System.err.println(e);
if(null!=downstream) { downstream.keyReleased(e); }
}
- public void keyTyped(KeyEvent e) {
- System.err.println(e);
- if(null!=downstream) { downstream.keyTyped(e); }
- }
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 805ad08ad..dca287c6b 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -2476,7 +2476,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return keyListeners.toArray(new KeyListener[keyListeners.size()]);
}
- @SuppressWarnings("deprecation")
private final boolean propagateKeyEvent(KeyEvent e, KeyListener l) {
switch(e.getEventType()) {
case KeyEvent.EVENT_KEY_PRESSED:
@@ -2485,40 +2484,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
case KeyEvent.EVENT_KEY_RELEASED:
l.keyReleased(e);
break;
- case KeyEvent.EVENT_KEY_TYPED:
- l.keyTyped(e);
- break;
default:
throw new NativeWindowException("Unexpected key event type " + e.getEventType());
}
return e.isConsumed();
}
- @SuppressWarnings("deprecation")
protected void consumeKeyEvent(KeyEvent e) {
- boolean consumedE = false, consumedTyped = false;
- if( KeyEvent.EVENT_KEY_TYPED == e.getEventType() ) {
- throw new InternalError("Deprecated KeyEvent.EVENT_KEY_TYPED is synthesized - don't send/enqueue it!");
- }
-
- // Synthesize deprecated event KeyEvent.EVENT_KEY_TYPED
- final KeyEvent eTyped;
- if( KeyEvent.EVENT_KEY_RELEASED == e.getEventType() && e.isPrintableKey() && !e.isAutoRepeat() ) {
- eTyped = KeyEvent.create(KeyEvent.EVENT_KEY_TYPED, e.getSource(), e.getWhen(), e.getModifiers(), e.getKeyCode(), e.getKeySymbol(), e.getKeyChar());
- } else {
- eTyped = null;
- }
+ boolean consumedE = false;
if(null != keyboardFocusHandler) {
consumedE = propagateKeyEvent(e, keyboardFocusHandler);
if(DEBUG_KEY_EVENT) {
System.err.println("consumeKeyEvent: "+e+", keyboardFocusHandler consumed: "+consumedE);
}
- if( null != eTyped ) {
- consumedTyped = propagateKeyEvent(eTyped, keyboardFocusHandler);
- if(DEBUG_KEY_EVENT) {
- System.err.println("consumeKeyEvent: "+eTyped+", keyboardFocusHandler consumed: "+consumedTyped);
- }
- }
}
if(DEBUG_KEY_EVENT) {
if( !consumedE ) {
@@ -2528,16 +2506,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
for(int i = 0; !consumedE && i < keyListeners.size(); i++ ) {
consumedE = propagateKeyEvent(e, keyListeners.get(i));
}
- if( null != eTyped ) {
- if(DEBUG_KEY_EVENT) {
- if( !consumedTyped ) {
- System.err.println("consumeKeyEvent: "+eTyped);
- }
- }
- for(int i = 0; !consumedTyped && i < keyListeners.size(); i++ ) {
- consumedTyped = propagateKeyEvent(eTyped, keyListeners.get(i));
- }
- }
}
//
diff --git a/src/newt/native/KeyEvent.h b/src/newt/native/KeyEvent.h
index a182db973..59977d565 100644
--- a/src/newt/native/KeyEvent.h
+++ b/src/newt/native/KeyEvent.h
@@ -31,7 +31,6 @@
#define EVENT_KEY_PRESSED 300
#define EVENT_KEY_RELEASED 301
-#define EVENT_KEY_TYPED 302
#define J_VK_UNDEFINED ( 0x0U )
#define J_VK_HOME ( 0x02U )
diff --git a/src/newt/native/X11Event.c b/src/newt/native/X11Event.c
index 770f60e8f..32a55c67c 100644
--- a/src/newt/native/X11Event.c
+++ b/src/newt/native/X11Event.c
@@ -170,15 +170,9 @@ void X11EventPoll(JNIEnv *env, jobject obj, Display *dpy, jlong javaObjectAtom,
#ifdef USE_SENDIO_DIRECT
(*env)->CallVoidMethod(env, jwindow, sendKeyEventID, (jint) EVENT_KEY_RELEASED,
modifiers, keySym, (jchar) -1);
-
- (*env)->CallVoidMethod(env, jwindow, sendKeyEventID, (jint) EVENT_KEY_TYPED,
- modifiers, keySym, (jchar) keyChar);
#else
(*env)->CallVoidMethod(env, jwindow, enqueueKeyEventID, JNI_FALSE, (jint) EVENT_KEY_RELEASED,
modifiers, keySym, (jchar) -1);
-
- (*env)->CallVoidMethod(env, jwindow, enqueueKeyEventID, JNI_FALSE, (jint) EVENT_KEY_TYPED,
- modifiers, keySym, (jchar) keyChar);
#endif
break;
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index e567781cf..3f50f27a4 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -699,7 +699,6 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_WindowDriver_CloseWindow0
XGetWindowAttributes(dpy, w, &xwa); // prefetch colormap to be destroyed after window destruction
XSelectInput(dpy, w, 0);
XUnmapWindow(dpy, w);
- XSync(dpy, False);
// Drain all events related to this window ..
Java_jogamp_newt_driver_x11_DisplayDriver_DispatchMessages0(env, obj, display, javaObjectAtom, windowDeleteAtom /*, kbdHandle */); // XKB disabled for now
diff --git a/src/newt/native/XCBEvent.c b/src/newt/native/XCBEvent.c
index f067f4b7a..d02d5a4ba 100644
--- a/src/newt/native/XCBEvent.c
+++ b/src/newt/native/XCBEvent.c
@@ -176,15 +176,9 @@ void XCBEventPoll(JNIEnv *env, jobject obj, Display *dpy, jlong javaObjectAtom,
#ifdef USE_SENDIO_DIRECT
(*env)->CallVoidMethod(env, jwindow, sendKeyEventID, (jint) EVENT_KEY_RELEASED,
modifiers, X11KeySym2NewtVKey(_evt->state), (jchar) keyChar);
-
- (*env)->CallVoidMethod(env, jwindow, sendKeyEventID, (jint) EVENT_KEY_TYPED,
- modifiers, (jint) -1, (jchar) keyChar);
#else
(*env)->CallVoidMethod(env, jwindow, enqueueKeyEventID, JNI_FALSE, (jint) EVENT_KEY_RELEASED,
modifiers, X11KeySym2NewtVKey(_evt->state), (jchar) keyChar);
-
- (*env)->CallVoidMethod(env, jwindow, enqueueKeyEventID, JNI_FALSE, (jint) EVENT_KEY_TYPED,
- modifiers, (jint) -1, (jchar) keyChar);
#endif
} break;
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
index 6378c1ee3..4ebb937a0 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
@@ -293,7 +293,6 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
}
}
}
- public void keyTyped(KeyEvent arg0) {}
public void keyReleased(KeyEvent arg0) {}
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
index 658d4a4f1..31377025a 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
@@ -295,10 +295,13 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
}
}
- public void keyTyped(KeyEvent arg0) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(userInput) {
- char c = arg0.getKeyChar();
-
+ char c = e.getKeyChar();
+
if(c == 0x0d) {
userInput = false;
setIgnoreInput(false);
@@ -309,6 +312,5 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
}
}
}
- public void keyReleased(KeyEvent arg0) {}
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
index 15daf70cd..c94b63494 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
@@ -317,7 +317,6 @@ public abstract class UIListenerBase01 implements GLEventListener {
}
}
}
- public void keyTyped(KeyEvent arg0) {}
public void keyReleased(KeyEvent arg0) {}
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
index b3c542c63..87d4df342 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
@@ -152,7 +152,10 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
});
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
System.err.println("*** "+e);
if(e.getKeyChar()=='f') {
new Thread() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
index 67e8524a3..f184873be 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
@@ -85,7 +85,10 @@ public class TestTranslucencyNEWT extends UITestCase {
final GLWindow f_glWindow = glWindow;
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java
index 05cc2aeb0..34fa79b5a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java
@@ -84,7 +84,10 @@ public class TestGearsES1NEWT extends UITestCase {
final GLWindow f_glWindow = glWindow;
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java
index b0e6b2b00..478195c99 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java
@@ -82,7 +82,10 @@ public class TestRedSquareES1NEWT extends UITestCase {
final GLWindow f_glWindow = glWindow;
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
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 7f2713354..b7c4e729e 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
@@ -82,7 +82,10 @@ public class MovieCube implements GLEventListener, GLMediaEventListener {
}
private final KeyListener keyAction = new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
System.err.println("MC "+e);
int pts0 = mPlayer.getCurrentPosition();
int pts1 = 0;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
index ed308bdfd..e22b00dff 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
@@ -103,7 +103,10 @@ public class TestElektronenMultipliziererNEWT extends UITestCase {
final GLWindow f_glWindow = glWindow;
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
index bf47109fa..f12f02c5e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
@@ -269,7 +269,10 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
});
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
quitAdapter.enable(false);
new Thread() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
index 9d9e3a876..eed2e1267 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
@@ -178,7 +178,10 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
});
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java
index 4ca70d7d3..281ee54f9 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java
@@ -80,7 +80,10 @@ public class TestLandscapeES2NEWT extends UITestCase {
glWindow.addWindowListener(quitAdapter);
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java
index c1df18c19..72357dc29 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java
@@ -117,7 +117,10 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
});
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
quitAdapter.enable(false);
new Thread() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
index 0e5842b23..b880c2f3b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
@@ -93,7 +93,10 @@ public class TestRedSquareES2NEWT extends UITestCase {
glWindow.addWindowListener(quitAdapter);
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java
index 93dc885b6..3c33a4899 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java
@@ -83,7 +83,10 @@ public class TestGearsNEWT extends UITestCase {
final GLWindow f_glWindow = glWindow;
glWindow.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
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 d1b276105..0f9c50baa 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
@@ -308,7 +308,10 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
glWindow.addGLEventListener( new BigFlashingX() ) ;
glWindow.addKeyListener(new KeyAdapter() {
@Override
- public void keyTyped(com.jogamp.newt.event.KeyEvent e) {
+ public void keyReleased(com.jogamp.newt.event.KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
System.err.print(".");
glWindow.display();
}
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 b075af977..c1b572df3 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
@@ -159,48 +159,40 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
testNewtCanvasAWT_Impl(false);
}
- @SuppressWarnings("deprecation")
static void testKeyCodeModifier(Robot robot, NEWTKeyAdapter keyAdapter, short modifierKey, int modifierMask, short keyCode,
char keyCharOnly, char keyCharMod) {
keyAdapter.reset();
AWTRobotUtil.newtKeyPress(0, robot, true, keyCode, 10); // press keyCode
- AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 100); // release+typed keyCode
+ AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 100); // release keyCode
robot.waitForIdle();
- for(int j=0; j < 100 && keyAdapter.getQueueSize() < 3; j++) { // wait until events are collected
+ for(int j=0; j < 100 && keyAdapter.getQueueSize() < 2; j++) { // wait until events are collected
robot.delay(100);
}
AWTRobotUtil.newtKeyPress(0, robot, true, modifierKey, 10); // press MOD
AWTRobotUtil.newtKeyPress(0, robot, true, keyCode, 10); // press keyCode
- AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 10); // release+typed keyCode
+ AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 10); // release keyCode
AWTRobotUtil.newtKeyPress(0, robot, false, modifierKey, 100); // release MOD
robot.waitForIdle();
- for(int j=0; j < 100 && keyAdapter.getQueueSize() < 3+5; j++) { // wait until events are collected
+ for(int j=0; j < 100 && keyAdapter.getQueueSize() < 2+4; j++) { // wait until events are collected
robot.delay(100);
}
- final int modTypedCount = KeyEvent.NULL_CHAR != keyCharMod ? 2 : -1 ; // ignore due to mods 'isPrintable' impact.
NEWTKeyUtil.validateKeyAdapterStats(keyAdapter,
- 3 /* press-SI */, 3 /* release-SI */, modTypedCount /* typed-SI */,
- 0 /* press-AR */, 0 /* release-AR */, 0 /* typed-AR */ );
+ 3 /* press-SI */, 3 /* release-SI */,
+ 0 /* press-AR */, 0 /* release-AR */ );
final List queue = keyAdapter.getQueued();
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);
- NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_TYPED, 0, keyCode, keyCharOnly);
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, modifierMask, modifierKey, KeyEvent.NULL_CHAR);
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, modifierMask, keyCode, keyCharMod);
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, modifierMask, keyCode, keyCharMod);
KeyEvent e = (KeyEvent) queue.get(i++);
- if( KeyEvent.EVENT_KEY_TYPED == e.getEventType() ) { // optional, due to mods 'isPrintable' impact.
- NEWTKeyUtil.validateKeyEvent(e, KeyEvent.EVENT_KEY_TYPED, modifierMask, keyCode, keyCharMod);
- e = (KeyEvent) queue.get(i++);
- }
NEWTKeyUtil.validateKeyEvent(e, KeyEvent.EVENT_KEY_RELEASED, modifierMask, modifierKey, KeyEvent.NULL_CHAR);
}
- @SuppressWarnings("deprecation")
static void testKeyCodeAllModifierV1(Robot robot, NEWTKeyAdapter keyAdapter) {
final short m1k = KeyEvent.VK_ALT;
final int m1m = InputEvent.ALT_MASK;
@@ -215,18 +207,18 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
AWTRobotUtil.newtKeyPress(0, robot, true, m3k, 10); // press MOD3
AWTRobotUtil.newtKeyPress(0, robot, true, KeyEvent.VK_1, 10); // press P
- AWTRobotUtil.newtKeyPress(0, robot, false, KeyEvent.VK_1, 100); // release+typed P
+ AWTRobotUtil.newtKeyPress(0, robot, false, KeyEvent.VK_1, 100); // release P
AWTRobotUtil.newtKeyPress(0, robot, false, m3k, 10); // release MOD
AWTRobotUtil.newtKeyPress(0, robot, false, m2k, 10); // release MOD
AWTRobotUtil.newtKeyPress(0, robot, false, m1k, 10); // release MOD
robot.waitForIdle();
- for(int j=0; j < 100 && keyAdapter.getQueueSize() < 4+4+1; j++) { // wait until events are collected
+ for(int j=0; j < 100 && keyAdapter.getQueueSize() < 4+4; j++) { // wait until events are collected
robot.delay(100);
}
NEWTKeyUtil.validateKeyAdapterStats(keyAdapter,
- 4 /* press-SI */, 4 /* release-SI */, -1 /* typed-SI - ignored, since unknow whether printable w/ all mods */,
- 0 /* press-AR */, 0 /* release-AR */, 0 /* typed-AR */ );
+ 4 /* press-SI */, 4 /* release-SI */,
+ 0 /* press-AR */, 0 /* release-AR */ );
final List queue = keyAdapter.getQueued();
int i=0;
@@ -237,10 +229,6 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, m1m|m2m|m3m, KeyEvent.VK_1, KeyEvent.NULL_CHAR);
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, m1m|m2m|m3m, KeyEvent.VK_1, KeyEvent.NULL_CHAR);
KeyEvent e = (KeyEvent) queue.get(i++);
- if( KeyEvent.EVENT_KEY_TYPED == e.getEventType() ) { // optional, due to mods 'isPrintable' impact.
- NEWTKeyUtil.validateKeyEvent(e, KeyEvent.EVENT_KEY_TYPED, m1m|m2m|m3m, KeyEvent.VK_1, KeyEvent.NULL_CHAR);
- e = (KeyEvent) queue.get(i++);
- }
NEWTKeyUtil.validateKeyEvent(e, KeyEvent.EVENT_KEY_RELEASED, m1m|m2m|m3m, m3k, KeyEvent.NULL_CHAR);
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, m1m|m2m, m2k, KeyEvent.NULL_CHAR);
NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, m1m, m1k, 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 fb42141ea..a5f47e870 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
@@ -210,9 +210,6 @@ public class TestNewtKeyCodesAWT extends UITestCase {
break;
}
eventCount++;
- if( KeyEvent.isPrintableKey(c, false) ) {
- eventCount++;
- }
robot.waitForIdle();
}
for(int j=0; j < 20 && keyAdapter.getQueueSize() < eventCount; j++) { // wait until events are collected
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 d7de4e735..f3a5c4aa9 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
@@ -153,7 +153,6 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
glWindow.destroy();
}
- @SuppressWarnings("deprecation")
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][3];
@@ -167,8 +166,8 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
robot.waitForIdle();
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_A, 500); // 1s .. no AR anymore
robot.waitForIdle();
- final int minCodeCount = firstIdx + 3;
- final int desiredCodeCount = firstIdx + 6;
+ 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);
}
@@ -206,15 +205,15 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
final int expSI, expAR;
if( hasAR ) {
expSI = perLoopSI * loops;
- expAR = ( keyEvents.size() - expSI*3 ) / 2; // AR: no typed -> 2, SI: typed -> 3
+ expAR = ( keyEvents.size() - expSI*2 ) / 2; // auto-repeat release
} else {
- expSI = keyEvents.size() / 3; // all typed events
+ expSI = keyEvents.size() / 2; // all released events
expAR = 0;
}
NEWTKeyUtil.validateKeyAdapterStats(keyAdapter,
- expSI /* press-SI */, expSI /* release-SI */, expSI /* typed-SI */,
- expAR /* press-AR */, expAR /* release-AR */, 0 /* typed-AR */ );
+ expSI /* press-SI */, expSI /* release-SI */,
+ expAR /* press-AR */, expAR /* release-AR */ );
}
if( !hasAR ) {
@@ -246,17 +245,17 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
e = (KeyEvent) last[i][0];
Assert.assertTrue("last-2 Shall be A, but is "+e, KeyEvent.VK_A == e.getKeyCode() );
- Assert.assertTrue("last-2 Shall be PRESSED, but is "+e, KeyEvent.EVENT_KEY_PRESSED == e.getEventType() );
+ Assert.assertTrue("last-2 Shall be RELEASED, but is "+e, KeyEvent.EVENT_KEY_RELEASED == e.getEventType() );
Assert.assertTrue("last-2 Shall be AR, but is "+e, 0 != ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) );
e = (KeyEvent) last[i][1];
Assert.assertTrue("last-1 Shall be A, but is "+e, KeyEvent.VK_A == e.getKeyCode() );
- Assert.assertTrue("last-1 Shall be RELEASED, but is "+e, KeyEvent.EVENT_KEY_RELEASED == e.getEventType() );
- Assert.assertTrue("last-1 Shall not be AR, but is "+e, 0 == ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) );
+ 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][2];
Assert.assertTrue("last-0 Shall be A, but is "+e, KeyEvent.VK_A == e.getKeyCode() );
- Assert.assertTrue("last-0 Shall be TYPED, but is "+e, KeyEvent.EVENT_KEY_TYPED == e.getEventType() );
+ 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() ) );
}
}
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 bdf932904..68ccecf6b 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
@@ -191,8 +191,8 @@ public class TestNewtKeyEventOrderAWT extends UITestCase {
final int expTotal = 6*loops; // all typed events
NEWTKeyUtil.validateKeyAdapterStats(keyAdapter,
- expTotal /* press-SI */, expTotal /* release-SI */, expTotal /* typed-SI */,
- 0 /* press-AR */, 0 /* release-AR */, 0 /* typed-AR */ );
+ expTotal /* press-SI */, expTotal /* release-SI */,
+ 0 /* press-AR */, 0 /* release-AR */ );
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java
index 2a35a15eb..d70259f13 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java
@@ -215,11 +215,6 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase {
System.err.println(seq+": "+e);
}
}
-
- @Override
- public void keyTyped(KeyEvent e) {
- }
-
}
public static void main(String args[]) throws IOException {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/KeyAction.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/KeyAction.java
index 3313ec65c..0ae94d7af 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/KeyAction.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/KeyAction.java
@@ -38,7 +38,10 @@ class KeyAction extends KeyAdapter {
this.eventFifo = eventFifo;
}
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
eventFifo.put(e);
}
}
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 15393e8ea..9d08d8ff4 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
@@ -47,7 +47,10 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
this.glWindow = glWindow;
}
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='i') {
System.err.println(glWindow);
} else if(e.getKeyChar()=='d') {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java
index a1f07bda6..d340fc280 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java
@@ -146,7 +146,10 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
glWindow1.addGLEventListener(demo1);
glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
glWindow1.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if(e.getKeyChar()=='c') {
System.err.println("Focus Clear");
if(glWindow1.getDelegatedWindow() instanceof DriverClearFocus) {
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 837ba5da1..776c3c7eb 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java
@@ -36,7 +36,7 @@ import java.util.List;
public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEventCountAdapter {
String prefix;
- int keyPressed, keyReleased, keyTyped;
+ int keyPressed, keyReleased;
boolean pressed;
List queue = new ArrayList();
boolean verbose = true;
@@ -53,7 +53,7 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
}
public synchronized int getCount() {
- return keyTyped;
+ return keyReleased;
}
public synchronized int getKeyPressedCount(boolean autoRepeatOnly) {
@@ -64,10 +64,6 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
return keyReleased;
}
- public synchronized int getKeyTypedCount(boolean autoRepeatOnly) {
- return keyTyped;
- }
-
public synchronized List getQueued() {
return queue;
}
@@ -77,7 +73,6 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
}
public synchronized void reset() {
- keyTyped = 0;
keyPressed = 0;
keyReleased = 0;
pressed = false;
@@ -102,14 +97,6 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
}
}
- public synchronized void keyTyped(java.awt.event.KeyEvent e) {
- keyTyped++;
- queue.add(e);
- if( verbose ) {
- System.err.println("KEY AWT TYPED ["+keyTyped+"]: "+prefix+", "+e);
- }
- }
-
- public String toString() { return prefix+"[pressed "+pressed+", typed "+keyTyped+"]"; }
+ public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+"]"; }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/KeyEventCountAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/KeyEventCountAdapter.java
index 832f5ae82..1d6d97a17 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/KeyEventCountAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/KeyEventCountAdapter.java
@@ -31,8 +31,6 @@ package com.jogamp.opengl.test.junit.util;
public interface KeyEventCountAdapter extends InputEventCountAdapter {
public int getKeyPressedCount(boolean autoRepeatOnly);
- public int getKeyReleasedCount(boolean autoRepeatOnly);
-
- public int getKeyTypedCount(boolean autoRepeatOnly);
+ public int getKeyReleasedCount(boolean autoRepeatOnly);
}
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 f19169b42..88ed74a3f 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
@@ -39,8 +39,8 @@ import com.jogamp.newt.event.KeyEvent;
public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
String prefix;
- int keyPressed, keyReleased, keyTyped;
- int keyPressedAR, keyReleasedAR, keyTypedAR;
+ int keyPressed, keyReleased;
+ int keyPressedAR, keyReleasedAR;
boolean pressed;
List queue = new ArrayList();
boolean verbose = true;
@@ -57,7 +57,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
}
public synchronized int getCount() {
- return keyTyped;
+ return keyReleased;
}
public synchronized int getKeyPressedCount(boolean autoRepeatOnly) {
@@ -68,10 +68,6 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
return autoRepeatOnly ? keyReleasedAR: keyReleased;
}
- public synchronized int getKeyTypedCount(boolean autoRepeatOnly) {
- return autoRepeatOnly ? keyTypedAR: keyTyped;
- }
-
public synchronized List getQueued() {
return queue;
}
@@ -81,10 +77,8 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
}
public synchronized void reset() {
- keyTyped = 0;
keyPressed = 0;
keyReleased = 0;
- keyTypedAR = 0;
keyPressedAR = 0;
keyReleasedAR = 0;
pressed = false;
@@ -115,18 +109,6 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
}
}
- @Override
- public synchronized void keyTyped(KeyEvent e) {
- keyTyped++;
- if( 0 != ( e.getModifiers() & InputEvent.AUTOREPEAT_MASK ) ) {
- keyTypedAR++;
- }
- queue.add(e);
- if( verbose ) {
- System.err.println("KEY NEWT TYPED ["+keyTyped+"]: "+prefix+", "+e);
- }
- }
-
- public String toString() { return prefix+"[pressed "+pressed+", typed "+keyTyped+"]"; }
+ public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+"]"; }
}
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 1def57edf..990930994 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java
@@ -104,11 +104,7 @@ public class NEWTKeyUtil {
missCodes.add(new CodeEvent(c, codeSeg.description, e));
misses++;
}
- if( KeyEvent.isPrintableKey(c, false) ) {
- evtIdx += 3; // w/ TYPED
- } else {
- evtIdx += 2;
- }
+ evtIdx += 2;
}
}
final boolean res = evtIdx == keyEvents.size() && 0 == missCodes.size();
@@ -133,16 +129,13 @@ public class NEWTKeyUtil {
}
}
- @SuppressWarnings("deprecation")
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 e.isPrintableKey() && !e.isAutoRepeat() ? KeyEvent.EVENT_KEY_TYPED : KeyEvent.EVENT_KEY_PRESSED;
- case KeyEvent.EVENT_KEY_TYPED:
- return KeyEvent.EVENT_KEY_PRESSED;
+ return KeyEvent.EVENT_KEY_PRESSED;
default:
Assert.assertTrue("Invalid event "+e, false);
return 0;
@@ -168,14 +161,12 @@ public class NEWTKeyUtil {
* @param keyAdapter
* @param expPressedCountSI number of single key press events
* @param expReleasedCountSI number of single key release events
- * @param expTypedCountSI number of single key types events, set to -1 to ignore
* @param expPressedCountAR number of auto-repeat key press events
* @param expReleasedCountAR number of auto-repeat key release events
- * @param expTypedCountAR number of auto-repeat key types events, set to -1 to ignore
*/
public static void validateKeyAdapterStats(NEWTKeyAdapter keyAdapter,
- int expPressedCountSI, int expReleasedCountSI, int expTypedCountSI,
- int expPressedCountAR, int expReleasedCountAR, int expTypedCountAR) {
+ int expPressedCountSI, int expReleasedCountSI,
+ int expPressedCountAR, int expReleasedCountAR) {
final int expPressReleaseCountSI = expPressedCountSI + expReleasedCountSI;
final int expPressReleaseCountAR = expPressedCountAR + expReleasedCountAR;
final int expPressReleaseCountALL = expPressReleaseCountSI + expPressReleaseCountAR;
@@ -184,36 +175,25 @@ public class NEWTKeyUtil {
final int keyPressedAR = keyAdapter.getKeyPressedCount(true);
final int keyReleasedALL = keyAdapter.getKeyReleasedCount(false);
final int keyReleasedAR = keyAdapter.getKeyReleasedCount(true);
- final int keyTypedALL = keyAdapter.getKeyTypedCount(false);
- final int keyTypedAR = keyAdapter.getKeyTypedCount(true);
final int keyPressedSI = keyPressedALL-keyPressedAR;
final int keyReleasedSI = keyReleasedALL-keyReleasedAR;
- final int keyTypedSI = keyTypedALL-keyTypedAR;
final int pressReleaseCountALL = keyPressedALL + keyReleasedALL;
final int pressReleaseCountSI = keyPressedSI + keyReleasedSI;
final int pressReleaseCountAR = keyPressedAR + keyReleasedAR;
- System.err.println("Expec Single Press "+expPressedCountSI +", Release "+expReleasedCountSI +", Typed "+expTypedCountSI);
- System.err.println("Expec AutoRp Press "+expPressedCountAR +", Release "+expReleasedCountAR +", Typed "+expTypedCountAR);
+ 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 +", Typed "+keyTypedSI +", Events "+pressReleaseCountSI);
- System.err.println("Total AutoRp Press "+keyPressedAR +", Release "+keyReleasedAR +", Typed "+keyTypedAR +", Events "+pressReleaseCountAR);
- System.err.println("Total ALL Press "+keyPressedALL +", Release "+keyReleasedALL +", Typed "+keyTypedALL+", Events "+pressReleaseCountALL);
+ 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("Invalid: Has AR Typed events", 0, keyTypedAR);
- if( 0 <= expTypedCountAR ) {
- Assert.assertEquals("Invalid: Exp AR Typed events", 0, expTypedCountAR);
- }
-
Assert.assertEquals("Key press count failure (SI)", expPressedCountSI, keyPressedSI);
Assert.assertEquals("Key released count failure (SI)", expReleasedCountSI, keyReleasedSI);
- if( 0 <= expTypedCountSI ) {
- Assert.assertEquals("Key typed count failure (SI)", expTypedCountSI, keyTypedSI);
- }
Assert.assertEquals("Key press count failure (AR)", expPressedCountAR, keyPressedAR);
Assert.assertEquals("Key released count failure (AR)", expReleasedCountAR, keyReleasedAR);
@@ -224,6 +204,6 @@ public class NEWTKeyUtil {
final List keyEvents = keyAdapter.getQueued();
Assert.assertEquals("Key pressRelease count failure (ALL) w/ list sum ", expPressReleaseCountALL, pressReleaseCountALL);
- Assert.assertEquals("Key total count failure (ALL) w/ list size ", pressReleaseCountALL + keyTypedALL, keyEvents.size());
+ Assert.assertEquals("Key total count failure (ALL) w/ list size ", pressReleaseCountALL, keyEvents.size());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/QuitAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/QuitAdapter.java
index 59e243171..b5864e39c 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/QuitAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/QuitAdapter.java
@@ -47,7 +47,10 @@ public class QuitAdapter extends WindowAdapter implements WindowListener, KeyLis
}
}
- public void keyTyped(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
+ if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ return;
+ }
if( enabled ) {
if(e.getKeyChar()=='q') {
System.err.println("QUIT Key "+Thread.currentThread());
@@ -56,6 +59,5 @@ public class QuitAdapter extends WindowAdapter implements WindowListener, KeyLis
}
}
public void keyPressed(KeyEvent e) {}
- public void keyReleased(KeyEvent e) {}
}
--
cgit v1.2.3
From bdfb74818aa224bd96a15f232f417e921e0d8f63 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 17 Jun 2013 10:00:23 +0200
Subject: Fix Bug 688: Removal of NEWT KeyEvent.EVENT_KEY_TYPED and
KeyListener.keyTyped(KeyEvent) - Part2: API Documentation and Comments
---
.../classes/com/jogamp/newt/event/KeyEvent.java | 24 +++++++++-------------
.../jogamp/newt/driver/macosx/WindowDriver.java | 4 ++--
.../jogamp/newt/driver/windows/WindowDriver.java | 4 +---
.../jogamp/newt/driver/x11/WindowDriver.java | 3 ---
.../jogamp/newt/swt/event/SWTNewtEventFactory.java | 1 -
.../newt/event/TestNewtKeyEventAutoRepeatAWT.java | 7 +++----
.../junit/newt/event/TestNewtKeyEventOrderAWT.java | 1 -
7 files changed, 16 insertions(+), 28 deletions(-)
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
index 683a5ca54..ec05a34ad 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
@@ -43,9 +43,8 @@ import com.jogamp.common.util.IntBitfield;
*
*
* In case the native platform does not
@@ -58,27 +57,24 @@ import com.jogamp.common.util.IntBitfield;
*
* Auto-Repeat shall behave as follow:
*
- P = pressed, R = released, T = typed
+ P = pressed, R = released
0 = normal, 1 = auto-repeat
- P(0), [ R(1), P(1), R(1), ..], R(0) T(0)
+ P(0), [ R(1), P(1), R(1), ..], R(0)
*
* The idea is if you mask out auto-repeat in your event listener
- * or catch {@link #EVENT_KEY_TYPED typed} events only,
- * you just get one long pressed P/R/T triple for {@link #isPrintableKey() printable} keys.
- * {@link #isActionKey() Action} keys would produce one long pressed P/R tuple in case you mask out auto-repeat .
+ * you just get one long pressed P/R tuple for {@link #isPrintableKey() printable} and {@link #isActionKey() Action} keys.
*
*
* {@link #isActionKey() Action} keys will produce {@link #EVENT_KEY_PRESSED pressed}
* and {@link #EVENT_KEY_RELEASED released} events including {@link #isAutoRepeat() auto-repeat}.
*
*
- * {@link #isPrintableKey() Printable} keys will produce {@link #EVENT_KEY_PRESSED pressed},
- * {@link #EVENT_KEY_RELEASED released} and {@link #EVENT_KEY_TYPED typed} events, the latter is excluded for {@link #isAutoRepeat() auto-repeat} events.
+ * {@link #isPrintableKey() Printable} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events.
*
*
- * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed}
- * and {@link #EVENT_KEY_RELEASED released} events excluding {@link #isAutoRepeat() auto-repeat}.
+ * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events
+ * excluding {@link #isAutoRepeat() auto-repeat}.
* They will also influence subsequent event's {@link #getModifiers() modifier} bits while pressed.
*
*
@@ -360,9 +356,9 @@ public class KeyEvent extends InputEvent
private static final byte F_ACTION_MASK = 1 << 1;
private static final byte F_PRINTABLE_MASK = 1 << 2;
- /** A key has been pressed, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. */
+ /** A key has been pressed, excluding {@link #isAutoRepeat() auto-repeat}-{@link #isModifierKey() modifier} keys. */
public static final short EVENT_KEY_PRESSED = 300;
- /** A key has been released, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. */
+ /** A key has been released, excluding {@link #isAutoRepeat() auto-repeat}-{@link #isModifierKey() modifier} keys. */
public static final short EVENT_KEY_RELEASED= 301;
/**
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 6370782df..6aebf0410 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -423,8 +423,8 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
", was: pressed "+isKeyPressed(keyCode)+", isModifierKeyCode "+isModifierKeyCode);
} */
- // 1:1 Order: OSX and NEWT delivery order is PRESSED, RELEASED and TYPED
- // Auto-Repeat: OSX delivers only PRESSED, inject auto-repeat RELEASE and TYPED keys _before_ PRESSED
+ // OSX delivery order is PRESSED (t0), RELEASED (t1) and TYPED (t2) -> NEWT order: PRESSED (t0) and RELEASED (t1)
+ // Auto-Repeat: OSX delivers only PRESSED, inject auto-repeat RELEASE key _before_ PRESSED
switch(eventType) {
case KeyEvent.EVENT_KEY_RELEASED:
if( isKeyCodeTracked(keyCode) ) {
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index ad7e1e8f3..60fc3ec0f 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -288,7 +288,7 @@ public class WindowDriver extends WindowImpl {
// System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar+">, mods "+toHexString(modifiers)+
// ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", repeat "+isKeyInAutoRepeat(keyCode)+", printableKey "+KeyEvent.isPrintableKey(keyCode)+" [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
- // Reorder: WINDOWS delivery order is PRESSED (t0), TYPED (t0) and RELEASED (t1) -> NEWT order: PRESSED (t0), RELEASED (t1) and TYPED (t1)
+ // Reorder: WINDOWS delivery order is PRESSED (t0), TYPED (t0) and RELEASED (t1) -> NEWT order: PRESSED (t0) and RELEASED (t1)
// Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0).
switch(eventType) {
case KeyEvent.EVENT_KEY_RELEASED:
@@ -307,8 +307,6 @@ public class WindowDriver extends WindowImpl {
super.sendKeyEvent(KeyEvent.EVENT_KEY_PRESSED, modifiers, keyCode, keySym, keyChar);
}
break;
- // case KeyEvent.EVENT_KEY_TYPED:
- // break;
}
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 69a09c1f9..2eb07e00b 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -287,9 +287,6 @@ public class WindowDriver extends WindowImpl {
case KeyEvent.EVENT_KEY_RELEASED:
super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar);
break;
-
- // case KeyEvent.EVENT_KEY_TYPED:
- // break;
}
}
}
diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
index 1e99d1ef7..3782a1186 100644
--- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
@@ -56,7 +56,6 @@ public class SWTNewtEventFactory {
case SWT.KeyDown: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED;
case SWT.KeyUp: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED;
- // case SWT.KeyXXX: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_TYPED;
}
return (short)0;
}
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 f3a5c4aa9..fca1a4d93 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
@@ -68,20 +68,19 @@ import com.jogamp.opengl.test.junit.util.*;
*
*
{@link #EVENT_KEY_PRESSED}
*
{@link #EVENT_KEY_RELEASED}
- *
{@link #EVENT_KEY_TYPED}
*
*
*
* Auto-Repeat shall behave as follow:
*
- D = pressed, U = released, T = typed
+ D = pressed, U = released
0 = normal, 1 = auto-repeat
- D(0), [ U(1), T(1), D(1), U(1) T(1) ..], U(0) T(0)
+ D(0), [ U(1), D(1), U(1), D(1) ..], U(0)
*
*
* The idea is if you mask out auto-repeat in your event listener
- * you just get one long pressed key D/U/T triple.
+ * you just get one long pressed key D/U tuple.
*/
public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
static int width, height;
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 68ccecf6b..3a95eacae 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
@@ -65,7 +65,6 @@ import com.jogamp.opengl.test.junit.util.*;
*
*
{@link #EVENT_KEY_PRESSED}
*
{@link #EVENT_KEY_RELEASED}
- *
{@link #EVENT_KEY_TYPED}
*
*
*/
--
cgit v1.2.3
From c7e53e52b03afbaa6fe02a2ee5a4c5b6e5ed9f5a Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 17 Jun 2013 11:19:05 +0200
Subject: Fix TestNewtKeyEventAutoRepeatAWT (Bug 688): Reduce head/tail event
check to 2 events (Windows can't produce AR)
---
make/scripts/tests.sh | 4 ++--
.../newt/event/TestNewtKeyEventAutoRepeatAWT.java | 20 ++++----------------
2 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index bf8615d6e..b5fb6ccb2 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -467,11 +467,11 @@ function testawtswt() {
#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.TestNewtKeyEventAutoRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT $*
-testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNEWTWindowAWT $*
+#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNEWTWindowAWT $*
#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 $*
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 fca1a4d93..b6c15231c 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
@@ -154,8 +154,8 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
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][3];
- EventObject[][] last = new EventObject[loops][3];
+ EventObject[][] first = new EventObject[loops][2];
+ EventObject[][] last = new EventObject[loops][2];
keyAdapter.reset();
int firstIdx = 0;
@@ -175,11 +175,9 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
final List keyEvents = keyAdapter.getQueued();
first[i][0] = (KeyEvent) keyEvents.get(firstIdx+0);
first[i][1] = (KeyEvent) keyEvents.get(firstIdx+1);
- first[i][2] = (KeyEvent) keyEvents.get(firstIdx+2);
- firstIdx = keyEvents.size() - 3;
+ firstIdx = keyEvents.size() - 2;
last[i][0] = (KeyEvent) keyEvents.get(firstIdx+0);
last[i][1] = (KeyEvent) keyEvents.get(firstIdx+1);
- last[i][2] = (KeyEvent) keyEvents.get(firstIdx+2);
System.err.println("+++ KEY Event Auto-Repeat END Input Loop: "+i);
// add a pair of normal press/release in between auto-repeat!
@@ -237,22 +235,12 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
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) first[i][2];
- Assert.assertTrue("3rd Shall be A, but is "+e, KeyEvent.VK_A == e.getKeyCode() );
- Assert.assertTrue("3rd Shall be PRESSED, but is "+e, KeyEvent.EVENT_KEY_PRESSED == e.getEventType() );
- Assert.assertTrue("3rd Shall be AR, but is "+e, 0 != ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) );
-
e = (KeyEvent) last[i][0];
- Assert.assertTrue("last-2 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-2 Shall be AR, but is "+e, 0 != ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) );
-
- e = (KeyEvent) last[i][1];
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][2];
+ 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() ) );
--
cgit v1.2.3
From 343c3b3d0204c678156ce3b1a0a667bf90541c18 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 17 Jun 2013 12:28:09 +0200
Subject: Scripts: Adapt finding gluegen ..
---
make/scripts/setenv-jogl.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/make/scripts/setenv-jogl.sh b/make/scripts/setenv-jogl.sh
index 4067e65c9..0945f44d1 100755
--- a/make/scripts/setenv-jogl.sh
+++ b/make/scripts/setenv-jogl.sh
@@ -35,9 +35,9 @@ else
exit
fi
-gpf=`find ../../gluegen/make -name dynlink-unix.cfg`
+gpf=`find ../../gluegen/make -name jogamp-env.xml`
if [ -z "$gpf" ] ; then
- gpf=`find .. -name dynlink-unix.cfg`
+ gpf=`find .. -name jogamp-env.xml`
fi
if [ -z "$gpf" ] ; then
echo GLUEGEN_BUILDDIR not found
--
cgit v1.2.3
From f2182cfbf4cf77ba3f53b5b3e1c53e9dd42691a5 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 17 Jun 2013 12:59:24 +0200
Subject: Fix regression of 31e72d2f2d953352b2a8c83368039ecca8139d49: Modifier
SHIFT needs to be recognized (-> horiz. scroll)
---
src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 2eb07e00b..c752977a9 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -241,16 +241,17 @@ public class WindowDriver extends WindowImpl {
}
break;
case MouseEvent.EVENT_MOUSE_RELEASED:
+ final boolean shiftPressed = 0 != ( modifiers & InputEvent.SHIFT_MASK );
switch(button) {
case X11_WHEEL_ONE_UP_BUTTON: // vertical scroll up
eventType = MouseEvent.EVENT_MOUSE_WHEEL_MOVED;
button = 1;
- rotationXYZ[1] = 1;
+ rotationXYZ[shiftPressed ? 0 : 1] = 1;
break;
case X11_WHEEL_ONE_DOWN_BUTTON: // vertical scroll down
eventType = MouseEvent.EVENT_MOUSE_WHEEL_MOVED;
button = 1;
- rotationXYZ[1] = -1;
+ rotationXYZ[shiftPressed ? 0 : 1] = -1;
break;
case X11_WHEEL_TWO_UP_BUTTON: // horizontal scroll left
eventType = MouseEvent.EVENT_MOUSE_WHEEL_MOVED;
--
cgit v1.2.3
From d846b04928ecfcfb319e75d7ed114d357edbeb89 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 17 Jun 2013 13:16:40 +0200
Subject: Fix Bug 735: GLAutoDrawable must issue glViewport(..) even w/o
GLEventListener ; Optimize GLDrawableHelper's glViewportCall(..)
GLAutoDrawable must issue glViewport(..) even w/o GLEventListener
- Same behavior w/ or w/o GLEventListener requires to issue glViewport, always.
Optimize GLDrawableHelper's glViewportCall(..)
- 'private void init(..)' receives 'setViewport' argument to be passed to 'private void reshape(..)'
allowing to only the the viewport once @ 'public void init(..)' and display.
---
make/scripts/tests.sh | 8 ++++-
.../classes/jogamp/opengl/GLDrawableHelper.java | 35 +++++++++++++---------
.../opengl/test/bugs/Bug735Inv0AppletAWT.java | 2 --
.../opengl/test/bugs/Bug735Inv1AppletAWT.java | 4 +--
4 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index b5fb6ccb2..8c3b16daa 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -440,6 +440,12 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock01AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock02AWT $*
+testawt com.jogamp.opengl.test.bugs.Bug735Inv0AppletAWT $*
+#testawt com.jogamp.opengl.test.bugs.Bug735Inv1AppletAWT $*
+#testawt com.jogamp.opengl.test.bugs.Bug735Inv2AppletAWT $*
+#testawt com.jogamp.opengl.test.bugs.Bug735Inv3AppletAWT $*
+#testawt com.jogamp.opengl.test.bugs.Bug735Inv4AWT $*
+
#
# swt (testswt)
#
@@ -467,7 +473,7 @@ function testawtswt() {
#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.TestNewtKeyEventAutoRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT $*
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index ed3a1593e..8be910c1a 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -531,10 +531,10 @@ public class GLDrawableHelper {
}
}
- private final void init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape) {
+ private final void init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape, boolean setViewport) {
l.init(drawable);
if(sendReshape) {
- reshape(l, drawable, 0, 0, drawable.getWidth(), drawable.getHeight(), true /* setViewport */, false /* checkInit */);
+ reshape(l, drawable, 0, 0, drawable.getWidth(), drawable.getHeight(), setViewport, false /* checkInit */);
}
}
@@ -545,14 +545,20 @@ public class GLDrawableHelper {
public final void init(GLAutoDrawable drawable, boolean sendReshape) {
synchronized(listenersLock) {
final ArrayList _listeners = listeners;
- for (int i=0; i < _listeners.size(); i++) {
- final GLEventListener listener = _listeners.get(i) ;
-
- // If make ctx current, invoked by invokGL(..), results in a new ctx, init gets called.
- // This may happen not just for initial setup, but for ctx recreation due to resource change (drawable/window),
- // hence it must be called unconditional, always.
- listenersToBeInit.remove(listener); // remove if exist, avoiding dbl init
- init( listener, drawable, sendReshape);
+ final int listenerCount = _listeners.size();
+ if( listenerCount > 0 ) {
+ for (int i=0; i < listenerCount; i++) {
+ final GLEventListener listener = _listeners.get(i) ;
+
+ // If make ctx current, invoked by invokGL(..), results in a new ctx, init gets called.
+ // This may happen not just for initial setup, but for ctx recreation due to resource change (drawable/window),
+ // hence it must be called unconditional, always.
+ listenersToBeInit.remove(listener); // remove if exist, avoiding dbl init
+ init( listener, drawable, sendReshape, 0==i /* setViewport */);
+ }
+ } else {
+ // Expose same GL initialization if not using GLEventListener
+ drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
}
}
}
@@ -566,12 +572,13 @@ public class GLDrawableHelper {
private final void displayImpl(GLAutoDrawable drawable) {
synchronized(listenersLock) {
final ArrayList _listeners = listeners;
- for (int i=0; i < _listeners.size(); i++) {
+ final int listenerCount = _listeners.size();
+ for (int i=0; i < listenerCount; i++) {
final GLEventListener listener = _listeners.get(i) ;
// GLEventListener may need to be init,
// in case this one is added after the realization of the GLAutoDrawable
if( listenersToBeInit.remove(listener) ) {
- init( listener, drawable, true /* sendReshape */) ;
+ init( listener, drawable, true /* sendReshape */, listenersToBeInit.size() + 1 == listenerCount /* setViewport if 1st init */ );
}
listener.display(drawable);
}
@@ -585,7 +592,7 @@ public class GLDrawableHelper {
// in case this one is added after the realization of the GLAutoDrawable
synchronized(listenersLock) {
if( listenersToBeInit.remove(listener) ) {
- init( listener, drawable, false /* sendReshape */) ;
+ listener.init(drawable);
}
}
}
@@ -598,7 +605,7 @@ public class GLDrawableHelper {
public final void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
synchronized(listenersLock) {
for (int i=0; i < listeners.size(); i++) {
- reshape((GLEventListener) listeners.get(i), drawable, x, y, width, height, 0==i, true);
+ reshape((GLEventListener) listeners.get(i), drawable, x, y, width, height, 0==i /* setViewport */, true /* checkInit */);
}
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
index 1f98964c6..f443459c3 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
@@ -309,8 +309,6 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
// Disables vsync
gl.setSwapInterval(0);
}
- gl.glViewport(0, 0, width, height);
-
glu = new GLU();
vertShader = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true);
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
index 2b277dba0..e8cef5e16 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
@@ -307,9 +307,7 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
if (60 < TARGET_FPS) {
// Disables vsync
gl.setSwapInterval(0);
- }
- gl.glViewport(0, 0, width, height);
-
+ }
glu = new GLU();
vertShader = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true);
--
cgit v1.2.3
From 6944d3485ad005c6cd69a3122479f1fbaef26dfc Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Tue, 18 Jun 2013 01:44:39 +0200
Subject: GLDynamicLibraryBundleInfo.shallLinkGlobal(): Defaults to 'true' now,
allowing to remove specialized values.
- Windows always used global
- The OpenGL library is always available by all processes system wide.
- Tested on OSX (was using local, previously).
---
.../jogamp/opengl/GLDynamicLibraryBundleInfo.java | 20 +++++++++++++++-----
.../egl/DesktopES2DynamicLibraryBundleInfo.java | 10 ----------
.../opengl/egl/EGLDynamicLibraryBundleInfo.java | 14 ++++----------
.../x11/glx/X11GLXDynamicLibraryBundleInfo.java | 9 ---------
4 files changed, 19 insertions(+), 34 deletions(-)
diff --git a/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java
index 4c82fc2b3..a2e3b3175 100644
--- a/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java
@@ -36,11 +36,21 @@ public abstract class GLDynamicLibraryBundleInfo implements DynamicLibraryBundle
protected GLDynamicLibraryBundleInfo() {
}
- /** default **/
- @Override
- public boolean shallLinkGlobal() { return false; }
-
- /** default **/
+ /**
+ * Returns true,
+ * since we might load a desktop GL library and allow symbol access to subsequent libs.
+ *
- */
- public boolean shallLinkGlobal() { return true; }
-
public final List getToolGetProcAddressFuncNameList() {
List res = new ArrayList();
res.add("eglGetProcAddress");
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
index fe9d7573d..26b199ea2 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
@@ -29,6 +29,7 @@
package jogamp.opengl.egl;
import com.jogamp.common.os.AndroidVersion;
+import com.jogamp.common.os.Platform;
import java.util.*;
@@ -52,19 +53,12 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle
}
/**
- * Might be a desktop GL library, and might need to allow symbol access to subsequent libs.
- *
- * This respects old DRI requirements:
- *
+ * Mesa >= 9.0 (?), AMD driver, OpenGL 3.1 core and compatibility context is not compliant:
+ *
+ * GL_RENDERER: 'Gallium 0.4 on AMD RS880'
*
*
*/
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 6254b6f44..d6f97662e 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1515,6 +1515,8 @@ public abstract class GLContextImpl extends GLContext {
int i = 0;
final String MesaSP = "Mesa ";
+ final String MesaRendererAMDsp = " AMD ";
+ final String MesaRendererIntelsp = "Intel(R)";
final boolean hwAccel = 0 == ( ctp & GLContext.CTX_IMPL_ACCEL_SOFT );
final boolean compatCtx = 0 != ( ctp & GLContext.CTX_PROFILE_COMPAT );
final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ");
@@ -1639,7 +1641,7 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
- if( hwAccel /* glRenderer.contains("Intel(R)") || glRenderer.contains("AMD ") */ )
+ if( hwAccel /* glRenderer.contains( MesaRendererIntelsp ) || glRenderer.contains( MesaRendererAMDsp ) */ )
{
final int quirk = GLRendererQuirks.NoDoubleBufferedPBuffer;
if(DEBUG) {
@@ -1647,7 +1649,9 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
- if( glRenderer.contains("Intel(R)") && compatCtx && ( major > 3 || major == 3 && minor >= 1 ) )
+ if( ( (glRenderer.contains( MesaRendererIntelsp ) && compatCtx) || glRenderer.contains( MesaRendererAMDsp ) ) &&
+ ( major > 3 || major == 3 && minor >= 1 )
+ )
{
// FIXME: Apply vendor version constraints!
final int quirk = GLRendererQuirks.GLNonCompliant;
--
cgit v1.2.3
From cdeee16cdb14a6977e6c2344ba16a2d9a02759ce Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 00:56:00 +0200
Subject: AnimatorBase.setModeBits(..): Only issue initImpl() if required - and
throw 'is started' exception in such case; Cleanup brackets.
---
.../com/jogamp/opengl/util/AWTAnimatorImpl.java | 2 +-
.../classes/com/jogamp/opengl/util/AnimatorBase.java | 18 +++++++++++-------
.../com/jogamp/opengl/util/DefaultAnimatorImpl.java | 2 +-
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
index 26d299663..8de178e49 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
@@ -165,6 +165,6 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl {
};
public boolean blockUntilDone(Thread thread) {
- return ((Thread.currentThread() != thread) && !EventQueue.isDispatchThread());
+ return Thread.currentThread() != thread && !EventQueue.isDispatchThread();
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index 837fc84bd..ef92100ad 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -115,6 +115,10 @@ public abstract class AnimatorBase implements GLAnimatorControl {
drawablesEmpty = true;
}
+ private static final boolean useAWTAnimatorImpl(int modeBits) {
+ return 0 != ( MODE_EXPECT_AWT_RENDERING_THREAD & modeBits ) && null != awtAnimatorImplClazz;
+ }
+
/**
* Initializes implementation details post setup,
* invoked at {@link #add(GLAutoDrawable)}, {@link #start()}, ..
@@ -125,9 +129,9 @@ public abstract class AnimatorBase implements GLAnimatorControl {
*
* @throws GLException if Animator is {@link #isStarted()}
*/
- protected void initImpl(boolean force) {
+ protected synchronized void initImpl(boolean force) {
if( force || null == impl ) {
- if( 0 != ( MODE_EXPECT_AWT_RENDERING_THREAD & modeBits ) && null != awtAnimatorImplClazz ) {
+ if( useAWTAnimatorImpl( modeBits ) ) {
try {
impl = (AnimatorImpl) awtAnimatorImplClazz.newInstance();
baseName = getBaseName("AWT");
@@ -150,20 +154,20 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* @param enable
* @param bitValues
*
- * @throws GLException if Animator is {@link #isStarted()}
+ * @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 {
- if( isStarted() ) {
- throw new GLException("Animator already started");
- }
final int _oldModeBits = modeBits;
if(enable) {
modeBits |= bitValues;
} else {
modeBits &= ~bitValues;
}
- if( _oldModeBits != modeBits ) {
+ if( useAWTAnimatorImpl( _oldModeBits ) != useAWTAnimatorImpl( modeBits ) ) {
+ if( isStarted() ) {
+ throw new GLException("Animator already started");
+ }
initImpl(true);
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
index 23b0845ee..bbd2951b9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
@@ -61,6 +61,6 @@ class DefaultAnimatorImpl implements AnimatorBase.AnimatorImpl {
}
public boolean blockUntilDone(Thread thread) {
- return (Thread.currentThread() != thread);
+ return Thread.currentThread() != thread;
}
}
--
cgit v1.2.3
From 455c305ef9ca3db975de589dc4b9d078f2b5cc7a Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 01:00:52 +0200
Subject: X11Util: Fix comment on markAllDisplaysUnclosable semantics, add
'final', reorder globalLock/isJVMShuttingDown branch/sync
---
.../classes/jogamp/nativewindow/x11/X11Util.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index 2d9c42e09..bbc58b73a 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -98,10 +98,10 @@ public class X11Util implements ToolkitProperties {
private static final boolean TRACE_DISPLAY_LIFECYCLE = Debug.isPropertyDefined("nativewindow.debug.X11Util.TraceDisplayLifecycle", true);
private static String nullDisplayName = null;
private static volatile boolean isInit = false;
- private static boolean markAllDisplaysUnclosable = false; // ATI/AMD X11 driver issues
+ private static boolean markAllDisplaysUnclosable = false; // ATI/AMD X11 driver issues, or GLRendererQuirks.DontCloseX11Display
private static boolean hasThreadingIssues = false; // ATI/AMD X11 driver issues
- private static Object setX11ErrorHandlerLock = new Object();
+ private static final Object setX11ErrorHandlerLock = new Object();
private static final String X11_EXTENSION_ATIFGLRXDRI = "ATIFGLRXDRI";
private static final String X11_EXTENSION_ATIFGLEXTENSION = "ATIFGLEXTENSION";
@@ -207,12 +207,12 @@ public class X11Util implements ToolkitProperties {
}
}
- synchronized(globalLock) {
- // Only at JVM shutdown time, since AWT impl. seems to
- // dislike closing of X11 Display's (w/ ATI driver).
- if( isJVMShuttingDown ) {
- isInit = false;
- closePendingDisplayConnections();
+ // Only at JVM shutdown time, since AWT impl. seems to
+ // dislike closing of X11 Display's (w/ ATI driver).
+ if( isJVMShuttingDown ) {
+ synchronized(globalLock) {
+ isInit = false;
+ closePendingDisplayConnections();
openDisplayList.clear();
reusableDisplayList.clear();
pendingDisplayList.clear();
--
cgit v1.2.3
From e2c641bfbf9c2796b02edd3ef15444ce58b42be0 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 01:01:23 +0200
Subject: NEWT/X11: Proper static initSingleton() sequence.
---
src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java | 6 ++----
src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java | 3 +++
src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
index 4fe025ec4..88d06f69c 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
@@ -57,10 +57,8 @@ public class DisplayDriver extends DisplayImpl {
}
}
- public static void initSingleton() {
- // just exist to ensure static init has been run
- }
-
+ /** Ensure static init has been run. */
+ /* pp */static void initSingleton() { }
public DisplayDriver() {
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
index b8b13939b..e1373bba5 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
@@ -60,6 +60,9 @@ public class ScreenDriver extends ScreenImpl {
DisplayDriver.initSingleton();
}
+ /** Ensure static init has been run. */
+ /* pp */static void initSingleton() { }
+
public ScreenDriver() {
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index c752977a9..786587d65 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -59,7 +59,7 @@ public class WindowDriver extends WindowImpl {
private static final int X11_WHEEL_TWO_DOWN_BUTTON = 7;
static {
- DisplayDriver.initSingleton();
+ ScreenDriver.initSingleton();
}
public WindowDriver() {
--
cgit v1.2.3
From e5df5210e059ef597c1c05942cf7dcc0327730cd Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 01:02:44 +0200
Subject: GLWindow: Mention GLStateKeeper's GL state preservation in API doc
---
src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 1500d48e6..345d92bc1 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -79,11 +79,16 @@ import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.WindowUpdateEvent;
import com.jogamp.opengl.JoglVersion;
+import com.jogamp.opengl.GLStateKeeper;
/**
* An implementation of {@link GLAutoDrawable} and {@link Window} interface,
* using a delegated {@link Window} instance, which may be an aggregation (lifecycle: created and destroyed).
*
+ * This implementation supports {@link GLStateKeeper GL state preservation},
+ * hence {@link #isGLStatePreservationSupported()} returns true.
+ *
+ *
* This implementation does not make the OpenGL context current
* before calling the various input EventListener callbacks, ie {@link com.jogamp.newt.event.MouseListener} etc.
* This design decision is made in favor of a more performant and simplified
@@ -433,8 +438,8 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
protected class GLLifecycleHook implements WindowImpl.LifecycleHook {
@Override
- public void preserveGLStateAtDestroy() {
- GLWindow.this.preserveGLStateAtDestroy(true);
+ public void preserveGLStateAtDestroy(boolean value) {
+ GLWindow.this.preserveGLStateAtDestroy(value);
}
@Override
@@ -579,6 +584,12 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
}
+ /**
+ * {@inheritDoc}
+ *
+ */
@Override
public final boolean isGLStatePreservationSupported() { return true; }
--
cgit v1.2.3
From 41c626d8a27981e694b3b728a9a2f2bc8def939d Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 01:10:04 +0200
Subject: Fix Bug 761 (part 1/2): Move GLDrawableFactory.shutdownHook ->
NativeWindowFactory.shutdownHook, the latter handles customShutdownHooks for
NativeWindow, JOGL and NEWT.
Unifying our shutdown mechanism is required to provide a controlled shutdown sequence.
NativeWindowFactory is chosen to be the new central entry point, since it is the lowest denominator (common module).
- Move GLDrawableFactory.shutdownHook -> NativeWindowFactory.shutdownHook
Reverse the shutdown dependency for clarity and availability to all modules,
i.e. NEWT may not know about JOGL.
Remove the 'gamma' shutdown hook,
instead simply call GLDrawableFactoryImpl.resetDisplayGamma() before destroy.
NativeWindowFactory.shutdownHook handles customShutdownHooks for NativeWindow, JOGL and NEWT
- Modules can register their shutdown runnable at head or tail of list.
- Allows controlled shutdown across all modules.
---
.../javax/media/opengl/GLDrawableFactory.java | 56 +++++--------
.../jogamp/opengl/GLDrawableFactoryImpl.java | 43 ++--------
.../media/nativewindow/NativeWindowFactory.java | 98 +++++++++++++++++-----
3 files changed, 104 insertions(+), 93 deletions(-)
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 55ad85c9c..f1d8ff95e 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -40,8 +40,6 @@
package javax.media.opengl;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.List;
@@ -118,13 +116,8 @@ public abstract class GLDrawableFactory {
private static GLDrawableFactory eglFactory;
private static GLDrawableFactory nativeOSFactory;
- protected static ArrayList glDrawableFactories = new ArrayList();
-
- // Shutdown hook mechanism for the factory
- private static boolean factoryShutdownHookRegistered = false;
- private static Thread factoryShutdownHook = null;
- private static volatile boolean isJVMShuttingDown = false;
-
+ private static ArrayList glDrawableFactories = new ArrayList();
+
/**
* Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones.
*/
@@ -139,7 +132,12 @@ public abstract class GLDrawableFactory {
}
}
private static final void initSingletonImpl() {
- registerFactoryShutdownHook();
+ NativeWindowFactory.initSingleton();
+ NativeWindowFactory.addCustomShutdownHook(false /* head */, new Runnable() {
+ public void run() {
+ shutdown0();
+ }
+ });
final String nwt = NativeWindowFactory.getNativeWindowType(true);
GLDrawableFactory tmp = null;
@@ -199,23 +197,31 @@ public abstract class GLDrawableFactory {
synchronized (GLDrawableFactory.class) {
if (isInit) {
isInit=false;
- shutdownImpl();
+ shutdown0();
}
}
}
}
- private static void shutdownImpl() {
+ private static void shutdown0() {
// Following code will _always_ remain in shutdown hook
// due to special semantics of native utils, i.e. X11Utils.
// The latter requires shutdown at JVM-Shutdown only.
synchronized(glDrawableFactories) {
- for(int i=0; i() {
- public Object run() {
- Runtime.getRuntime().addShutdownHook(factoryShutdownHook);
- return null;
- }
- });
- factoryShutdownHookRegistered = true;
- }
-
protected GLDrawableFactory() {
synchronized(glDrawableFactories) {
glDrawableFactories.add(this);
@@ -266,6 +252,8 @@ public abstract class GLDrawableFactory {
protected abstract void destroy();
+ public abstract void resetDisplayGamma();
+
/**
* Retrieve the default device {@link AbstractGraphicsDevice#getConnection() connection},
* {@link AbstractGraphicsDevice#getUnitID() unit ID} and {@link AbstractGraphicsDevice#getUniqueID() unique ID name}. for this factory
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index 06e856d41..4ac413545 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -575,16 +575,16 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
rampEntry = 0.0f;
gammaRamp[i] = rampEntry;
}
- registerGammaShutdownHook();
+ needsGammaRampReset = true;
return setGammaRamp(gammaRamp);
}
+ @Override
public synchronized void resetDisplayGamma() {
- if (gammaShutdownHook == null) {
- throw new IllegalArgumentException("Should not call this unless setDisplayGamma called first");
+ if( needsGammaRampReset ) {
+ resetGammaRamp(originalGammaRamp);
+ needsGammaRampReset = false;
}
- resetGammaRamp(originalGammaRamp);
- unregisterGammaShutdownHook();
}
//------------------------------------------------------
@@ -616,35 +616,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
// Shutdown hook mechanism for resetting gamma
- private boolean gammaShutdownHookRegistered;
- private Thread gammaShutdownHook;
- private Buffer originalGammaRamp;
- private synchronized void registerGammaShutdownHook() {
- if (gammaShutdownHookRegistered)
- return;
- if (gammaShutdownHook == null) {
- gammaShutdownHook = new Thread(new Runnable() {
- @Override
- public void run() {
- synchronized (GLDrawableFactoryImpl.this) {
- resetGammaRamp(originalGammaRamp);
- }
- }
- });
- originalGammaRamp = getGammaRamp();
- }
- Runtime.getRuntime().addShutdownHook(gammaShutdownHook);
- gammaShutdownHookRegistered = true;
- }
-
- private synchronized void unregisterGammaShutdownHook() {
- if (!gammaShutdownHookRegistered)
- return;
- if (gammaShutdownHook == null) {
- throw new InternalError("Error in gamma shutdown hook logic");
- }
- Runtime.getRuntime().removeShutdownHook(gammaShutdownHook);
- gammaShutdownHookRegistered = false;
- // Leave the original gamma ramp data alone
- }
+ private volatile Buffer originalGammaRamp;
+ private volatile boolean needsGammaRampReset = false;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index b6a052253..bf37b8d0c 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -37,8 +37,10 @@ import java.io.File;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import jogamp.nativewindow.Debug;
@@ -108,7 +110,9 @@ public abstract class NativeWindowFactory {
private static boolean requiresToolkitLock;
private static boolean desktopHasThreadingIssues;
+ // Shutdown hook mechanism for the factory
private static volatile boolean isJVMShuttingDown = false;
+ private static final List customShutdownHooks = new ArrayList();
/** Creates a new NativeWindowFactory instance. End users do not
need to call this method. */
@@ -160,6 +164,11 @@ public abstract class NativeWindowFactory {
Platform.initSingleton(); // last resort ..
_DEBUG[0] = Debug.debug("NativeWindow");
_tmp[0] = Debug.getProperty("nativewindow.ws.name", true);
+ Runtime.getRuntime().addShutdownHook(
+ new Thread(new Runnable() {
+ public void run() {
+ NativeWindowFactory.shutdown(true);
+ } }, "NativeWindowFactory_ShutdownHook" ) ) ;
return null;
} } ) ;
@@ -204,6 +213,72 @@ public abstract class NativeWindowFactory {
}
}
+ /** Returns true if the JVM is shutting down, otherwise false. */
+ public static final boolean isJVMShuttingDown() { return isJVMShuttingDown; }
+
+ /**
+ * Add a custom shutdown hook to be performed at JVM shutdown before shutting down NativeWindowFactory instance.
+ *
+ * @param head if true add runnable at the start, otherwise at the end
+ * @param runnable runnable to be added.
+ */
+ public static void addCustomShutdownHook(boolean head, Runnable runnable) {
+ synchronized( customShutdownHooks ) {
+ if( !customShutdownHooks.contains( runnable ) ) {
+ if( head ) {
+ customShutdownHooks.add(0, runnable);
+ } else {
+ customShutdownHooks.add( runnable );
+ }
+ }
+ }
+ }
+
+ /**
+ * Cleanup resources at JVM shutdown
+ */
+ public static synchronized void shutdown(boolean _isJVMShuttingDown) {
+ isJVMShuttingDown = _isJVMShuttingDown;
+ if(DEBUG) {
+ System.err.println("NativeWindowFactory.shutdown() START: JVM Shutdown "+isJVMShuttingDown+", on thread "+Thread.currentThread().getName());
+ }
+ synchronized(customShutdownHooks) {
+ final int cshCount = customShutdownHooks.size();
+ for(int i=0; i < cshCount; i++) {
+ try {
+ if( DEBUG ) {
+ System.err.println("NativeWindowFactory.shutdown - customShutdownHook #"+(i+1)+"/"+cshCount);
+ }
+ customShutdownHooks.get(i).run();
+ } catch(Throwable t) {
+ System.err.println("NativeWindowFactory.shutdown: Catched "+t.getClass().getName()+" during customShutdownHook #"+(i+1)+"/"+cshCount);
+ if( DEBUG ) {
+ t.printStackTrace();
+ }
+ }
+ }
+ customShutdownHooks.clear();
+ }
+ if(DEBUG) {
+ System.err.println("NativeWindowFactory.shutdown(): Post customShutdownHook");
+ }
+
+ if(initialized) {
+ initialized = false;
+ if(null != registeredFactories) {
+ registeredFactories.clear();
+ registeredFactories = null;
+ }
+ GraphicsConfigurationFactory.shutdown();
+ }
+
+ shutdownNativeImpl(NativeWindowFactory.class.getClassLoader()); // always re-shutdown
+ // SharedResourceToolkitLock.shutdown(DEBUG); // not used yet
+ if(DEBUG) {
+ System.err.println(Thread.currentThread().getName()+" - NativeWindowFactory.shutdown() END JVM Shutdown "+isJVMShuttingDown);
+ }
+ }
+
private static void shutdownNativeImpl(final ClassLoader cl) {
final String clazzName;
if( TYPE_X11 == nativeWindowingTypePure ) {
@@ -310,29 +385,6 @@ public abstract class NativeWindowFactory {
}
}
- public static synchronized void shutdown(boolean _isJVMShuttingDown) {
- isJVMShuttingDown = _isJVMShuttingDown;
- if(DEBUG) {
- System.err.println(Thread.currentThread().getName()+" - NativeWindowFactory.shutdown() START: JVM Shutdown "+isJVMShuttingDown);
- }
- if(initialized) {
- initialized = false;
- if(null != registeredFactories) {
- registeredFactories.clear();
- registeredFactories = null;
- }
- GraphicsConfigurationFactory.shutdown();
- }
- shutdownNativeImpl(NativeWindowFactory.class.getClassLoader()); // always re-shutdown
- // SharedResourceToolkitLock.shutdown(DEBUG); // not used yet
- if(DEBUG) {
- System.err.println(Thread.currentThread().getName()+" - NativeWindowFactory.shutdown() END JVM Shutdown "+isJVMShuttingDown);
- }
- }
-
- /** Returns true if the JVM is shutting down, otherwise false. */
- public static final boolean isJVMShuttingDown() { return isJVMShuttingDown; }
-
/** @return true if the underlying toolkit requires locking, otherwise false. */
public static boolean requiresToolkitLock() {
return requiresToolkitLock;
--
cgit v1.2.3
From 2d32b056c7b1b6b3d071d79fb4c2d4e9113b59d5 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 01:21:30 +0200
Subject: Fix Bug 761 (part 2/2): NEWT registers one customShutdownHook @
NativeWindowFactory.shutdownHook head, allowing proper resource cleanup.
1 WindowImpl.shutdownAll():
- For all instances:
- mark invalid (causes any user thread to disregard the window)
2 ScreenImpl.shutdownAll():
- Removed own shutdown-hook!
- For all instances:
- Reset ScreenMonitorState
3 DisplayImpl.shutdownAll():
- For all instances:
- Remove EDT
- closeNativeImpl
Manually tested on X11 w/ NV and ATI Catalyst (fglrx)
- DFLAGS="-Djogl.debug.GLDrawable -Dnativewindow.debug.X11Util -Dnativewindow.debug.NativeWindow -Dnewt.debug.Display -Dnewt.debug.Screen -Dnewt.debug.Window"
- java $DFLAGS com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -time 2000 -sysExit testExit
- valid arguments for sysExit: testExit, testError, displayExit, displayError
---
make/scripts/tests.sh | 6 +--
src/newt/classes/com/jogamp/newt/Display.java | 2 +-
src/newt/classes/jogamp/newt/DisplayImpl.java | 45 ++++++++++++++++--
src/newt/classes/jogamp/newt/ScreenImpl.java | 45 ++++++++----------
src/newt/classes/jogamp/newt/WindowImpl.java | 53 ++++++++++++++++++++--
.../jogl/demos/es2/newt/TestGearsES2NEWT.java | 46 +++++++++++++++++++
6 files changed, 158 insertions(+), 39 deletions(-)
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 46d7876d3..97fe1d2c9 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -109,7 +109,7 @@ function jrun() {
#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="-Dnativewindow.debug.X11Util"
+ 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"
#D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
@@ -286,7 +286,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $*
@@ -307,7 +307,7 @@ 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.MovieCube $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#
diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java
index 993aa33eb..d6ddd9613 100644
--- a/src/newt/classes/com/jogamp/newt/Display.java
+++ b/src/newt/classes/com/jogamp/newt/Display.java
@@ -178,7 +178,7 @@ public abstract class Display {
public abstract void dispatchMessages();
// Global Displays
- protected static ArrayList displayList = new ArrayList();
+ protected static final ArrayList displayList = new ArrayList();
protected static int displaysActive = 0;
public static void dumpDisplayList(String prefix) {
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java
index d4842ba2f..3edb532db 100644
--- a/src/newt/classes/jogamp/newt/DisplayImpl.java
+++ b/src/newt/classes/jogamp/newt/DisplayImpl.java
@@ -45,10 +45,24 @@ import java.util.ArrayList;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.NativeWindowFactory;
public abstract class DisplayImpl extends Display {
private static int serialno = 1;
+ static {
+ NativeWindowFactory.addCustomShutdownHook(true /* head */, new Runnable() {
+ public void run() {
+ WindowImpl.shutdownAll();
+ ScreenImpl.shutdownAll();
+ DisplayImpl.shutdownAll();
+ }
+ });
+ }
+
+ /** Ensure static init has been run. */
+ /* pp */static void initSingleton() { }
+
private static Class> getDisplayClass(String type)
throws ClassNotFoundException
{
@@ -232,11 +246,10 @@ public abstract class DisplayImpl extends Display {
if(DEBUG) {
System.err.println("Display.destroy(): "+this+" "+getThreadName());
}
- final AbstractGraphicsDevice f_aDevice = aDevice;
final DisplayImpl f_dpy = this;
- removeEDT( new Runnable() {
+ removeEDT( new Runnable() { // blocks!
public void run() {
- if ( null != f_aDevice ) {
+ if ( null != aDevice ) {
f_dpy.closeNativeImpl();
}
}
@@ -247,6 +260,32 @@ public abstract class DisplayImpl extends Display {
dumpDisplayList("Display.destroy("+getFQName()+") END");
}
}
+
+ /** Maybe utilized at a shutdown hook, impl. does not synchronize, however the EDT removal blocks. */
+ /* pp */ static final void shutdownAll() {
+ final int dCount = displayList.size();
+ if(DEBUG) {
+ dumpDisplayList("Display.shutdownAll "+dCount+" instances, on thread "+getThreadName());
+ }
+ for(int i=0; i0; i++) { // be safe ..
+ final DisplayImpl d = (DisplayImpl) displayList.remove(0);
+ if(0 < displaysActive) {
+ displaysActive--;
+ }
+ if(DEBUG) {
+ System.err.println("Display.shutdownAll["+(i+1)+"/"+dCount+"]: "+d);
+ }
+ d.removeEDT( new Runnable() {
+ public void run() {
+ if ( null != d.getGraphicsDevice() ) {
+ d.closeNativeImpl();
+ }
+ }
+ } );
+ d.aDevice = null;
+ d.refCount=0;
+ }
+ }
public synchronized final int addReference() {
if(DEBUG) {
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index 7edf7b63a..f63d1499e 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -34,8 +34,6 @@
package jogamp.newt;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -64,6 +62,13 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
public static final int default_sm_rate = 60;
public static final int default_sm_rotation = 0;
+ static {
+ DisplayImpl.initSingleton();
+ }
+
+ /** Ensure static init has been run. */
+ /* pp */static void initSingleton() { }
+
protected DisplayImpl display;
protected int screen_idx;
protected String fqname;
@@ -77,15 +82,6 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
private long tCreated; // creationTime
- static {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- registerShutdownHook();
- return null;
- }
- });
- }
-
private static Class> getScreenClass(String type) throws ClassNotFoundException
{
final Class> screenClass = NewtFactory.getCustomClass(type, "ScreenDriver");
@@ -660,23 +656,18 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
ScreenMonitorState.unmapScreenMonitorStateUnlocked(getFQName());
}
}
- private static final void shutdownAll() {
- for(int i=0; i < screenList.size(); i++) {
- ((ScreenImpl)screenList.get(i)).shutdown();
- }
- }
- private static synchronized void registerShutdownHook() {
- final Thread shutdownHook = new Thread(new Runnable() {
- public void run() {
- ScreenImpl.shutdownAll();
- }
- });
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- Runtime.getRuntime().addShutdownHook(shutdownHook);
- return null;
+ /** pp */ static final void shutdownAll() {
+ final int sCount = screenList.size();
+ if(DEBUG) {
+ System.err.println("Screen.shutdownAll "+sCount+" instances, on thread "+Display.getThreadName());
+ }
+ for(int i=0; i0; i++) { // be safe ..
+ final ScreenImpl s = (ScreenImpl) screenList.remove(0);
+ if(DEBUG) {
+ System.err.println("Screen.shutdownAll["+(i+1)+"/"+sCount+"]: "+s);
}
- });
+ s.shutdown();
+ }
}
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index dca287c6b..1ac97b07c 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -82,6 +82,27 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
{
public static final boolean DEBUG_TEST_REPARENT_INCOMPATIBLE = Debug.isPropertyDefined("newt.test.Window.reparent.incompatible", true);
+ protected static final ArrayList windowList = new ArrayList();
+
+ static {
+ ScreenImpl.initSingleton();
+ }
+
+ /** Maybe utilized at a shutdown hook, impl. does not synchronize, however the Window destruction and EDT removal blocks. */
+ public static final void shutdownAll() {
+ final int wCount = windowList.size();
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("Window.shutdownAll "+wCount+" instances, on thread "+getThreadName());
+ }
+ for(int i=0; i0; i++) { // be safe ..
+ final WindowImpl w = windowList.remove(0);
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("Window.shutdownAll["+(i+1)+"/"+wCount+"]: "+toHexString(w.getWindowHandle()));
+ }
+ w.markInvalid();
+ }
+ }
+
/** Timeout of queued events (repaint and resize) */
static final long QUEUED_EVENT_TO = 1200; // ms
@@ -186,6 +207,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
window.screen = (ScreenImpl) screen;
window.capsRequested = (CapabilitiesImmutable) caps.cloneMutable();
window.instantiationFinished();
+ synchronized( windowList ) {
+ windowList.add(window);
+ }
return window;
} catch (Throwable t) {
t.printStackTrace();
@@ -207,12 +231,27 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
WindowImpl window = (WindowImpl) ReflectionUtil.createInstance( windowClass, cstrArgumentTypes, cstrArguments ) ;
window.screen = (ScreenImpl) screen;
window.capsRequested = (CapabilitiesImmutable) caps.cloneMutable();
+ window.instantiationFinished();
+ synchronized( windowList ) {
+ windowList.add(window);
+ }
return window;
} catch (Throwable t) {
throw new NativeWindowException(t);
}
}
+ /** Fast invalidation of instance w/o any blocking function call. */
+ private final void markInvalid() {
+ setWindowHandle(0);
+ visible = false;
+ fullscreen = false;
+ fullscreenMonitors = null;
+ fullscreenUseMainMonitor = true;
+ hasFocus = false;
+ parentWindowHandle = 0;
+ }
+
protected final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) {
config = cfg;
}
@@ -233,9 +272,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* Notifies the receiver to preserve resources (GL, ..)
- * for the next destroy*() calls (only).
+ * for the next destroy*() calls (only), if supported and if value is true, otherwise clears preservation flag.
+ * @param value true to set the one-shot preservation if supported, otherwise clears it.
*/
- void preserveGLStateAtDestroy();
+ void preserveGLStateAtDestroy(boolean value);
/**
* Invoked before Window destroy action,
@@ -995,13 +1035,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public void destroy() {
+ synchronized( windowList ) {
+ windowList.remove(this);
+ }
visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation
runOnEDTIfAvail(true, destroyAction);
}
protected void destroy(boolean preserveResources) {
- if( preserveResources && null != WindowImpl.this.lifecycleHook ) {
- WindowImpl.this.lifecycleHook.preserveGLStateAtDestroy();
+ if( null != lifecycleHook ) {
+ lifecycleHook.preserveGLStateAtDestroy( preserveResources );
}
destroy();
}
@@ -1108,7 +1151,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( false );
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
} else if(newParentWindow != getParent()) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index 0756399c1..a876b5c96 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -90,6 +90,8 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean mainRun = false;
static boolean exclusiveContext = false;
static boolean useAnimator = true;
+ static enum SysExit { none, testExit, testError, displayExit, displayError };
+ static SysExit sysExit = SysExit.none;
@BeforeClass
public static void initClass() {
@@ -272,6 +274,36 @@ public class TestGearsES2NEWT extends UITestCase {
Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread());
}
+ if( SysExit.displayError == sysExit || SysExit.displayExit == sysExit ) {
+ glWindow.addGLEventListener(new GLEventListener() {
+
+ @Override
+ public void init(GLAutoDrawable drawable) {}
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) { }
+
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ final GLAnimatorControl anim = drawable.getAnimator();
+ if( null != anim && anim.isAnimating() ) {
+ if( anim.getTotalFPSDuration() >= duration/2 ) {
+ if( SysExit.displayError == sysExit ) {
+ throw new Error("test error send from GLEventListener");
+ } else if ( SysExit.displayExit == sysExit ) {
+ System.err.println("exit(0) send from GLEventListener");
+ System.exit(0);
+ }
+ }
+ } else {
+ System.exit(0);
+ }
+ }
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ });
+ }
+
glWindow.setVisible(true);
if( useAnimator ) {
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
@@ -296,6 +328,16 @@ public class TestGearsES2NEWT extends UITestCase {
while(!quitAdapter.shouldQuit() && t1-t0= duration/2 ) {
+ if( SysExit.testError == sysExit || SysExit.testExit == sysExit ) {
+ if( SysExit.testError == sysExit ) {
+ throw new Error("test error send from test thread");
+ } else if ( SysExit.testExit == sysExit ) {
+ System.err.println("exit(0) send from test thread");
+ System.exit(0);
+ }
+ }
+ }
}
if( useAnimator ) {
@@ -429,6 +471,9 @@ public class TestGearsES2NEWT extends UITestCase {
loops = MiscUtils.atoi(args[i], 1);
} else if(args[i].equals("-loop-shutdown")) {
loop_shutdown = true;
+ } else if(args[i].equals("-sysExit")) {
+ i++;
+ sysExit = SysExit.valueOf(args[i]);
}
}
wsize = new Dimension(w, h);
@@ -458,6 +503,7 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("swapInterval "+swapInterval);
System.err.println("exclusiveContext "+exclusiveContext);
System.err.println("useAnimator "+useAnimator);
+ System.err.println("sysExitWithin "+sysExit);
if(waitForKey) {
UITestCase.waitForKey("Start");
--
cgit v1.2.3
From 305cdc83f78a5ac63d5ca1e56538a1eade62bb23 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 15:27:48 +0200
Subject: Fix Regression of 889ba9488ca07b59fdcc378642a2dc20676d69a3:
GLDebugMessageHandler GL Profile criteria for availability is wrong
---
src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
index 4c7f414ca..10cdd512e 100644
--- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
+++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
@@ -160,7 +160,7 @@ public class GLDebugMessageHandler {
}
final ProcAddressTable procAddressTable = ctx.getGLProcAddressTable();
- if( ctx.isGL4() ) {
+ if( !ctx.isGLES1() && !ctx.isGLES2() ) {
switch(extType) {
case EXT_ARB:
glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallbackARB");
@@ -170,6 +170,7 @@ public class GLDebugMessageHandler {
break;
}
} else {
+ glDebugMessageCallbackProcAddress = 0;
if(DEBUG) {
System.err.println("Non desktop context not supported");
}
--
cgit v1.2.3
From 698834f062759c7fae342a84af2953e9550c0078 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 16:21:02 +0200
Subject: GLEmitter: Better use of priviledged block in generated
GL*ProcAddressTable's isFunctionAvailableImpl(..), getAddressFor(..)
---
.../com/jogamp/gluegen/opengl/GLEmitter.java | 44 ++++++++++------------
1 file changed, 20 insertions(+), 24 deletions(-)
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
index 7c49b62d7..075c8bfd8 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
@@ -465,22 +465,20 @@ public class GLEmitter extends ProcAddressEmitter {
w.println(" protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException {");
w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);");
w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;");
- w.println(" java.lang.reflect.Field addressField = null;");
- w.println(" int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
- w.println(" for(int i = 0; null==addressField && i < funcNamePermNum; i++) {");
- w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
- w.println(" addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {");
- w.println(" public java.lang.reflect.Field run() {");
+ w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
+ w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {");
+ w.println(" public final java.lang.reflect.Field run() {");
+ w.println(" java.lang.reflect.Field addressField = null;");
+ w.println(" for(int i = 0; i < funcNamePermNum; i++) {");
+ w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
w.println(" try {");
- w.println(" final java.lang.reflect.Field addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
+ w.println(" addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
w.println(" addressField.setAccessible(true); // we need to read the protected value!");
w.println(" return addressField;");
- w.println(" } catch (NoSuchFieldException ex) {");
- w.println(" return null;");
- w.println(" }");
+ w.println(" } catch (NoSuchFieldException ex) { }");
w.println(" }");
- w.println(" } );");
- w.println(" }");
+ w.println(" return null;");
+ w.println(" } } );");
w.println();
w.println(" if(null==addressField) {");
w.println(" // The user is calling a bogus function or one which is not");
@@ -505,22 +503,20 @@ public class GLEmitter extends ProcAddressEmitter {
w.println(" SecurityUtil.checkAllLinkPermission();");
w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);");
w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;");
- w.println(" java.lang.reflect.Field addressField = null;");
- w.println(" int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
- w.println(" for(int i = 0; null==addressField && i < funcNamePermNum; i++) {");
- w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
- w.println(" addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {");
- w.println(" public java.lang.reflect.Field run() {");
+ w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
+ w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {");
+ w.println(" public final java.lang.reflect.Field run() {");
+ w.println(" java.lang.reflect.Field addressField = null;");
+ w.println(" for(int i = 0; i < funcNamePermNum; i++) {");
+ w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);");
w.println(" try {");
- w.println(" final java.lang.reflect.Field addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
+ w.println(" addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );");
w.println(" addressField.setAccessible(true); // we need to read the protected value!");
w.println(" return addressField;");
- w.println(" } catch (NoSuchFieldException ex) {");
- w.println(" return null;");
- w.println(" }");
+ w.println(" } catch (NoSuchFieldException ex) { }");
w.println(" }");
- w.println(" } );");
- w.println(" }");
+ w.println(" return null;");
+ w.println(" } } );");
w.println();
w.println(" if(null==addressField) {");
w.println(" // The user is calling a bogus function or one which is not");
--
cgit v1.2.3
From 70bf3a4ec44504b86294a332255aaae8d2e86bf4 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 18:55:21 +0200
Subject: Fix NewtCanvasAWT focus traversal for Java7: All unit tests fail w/
Java7, i.e. AWT Component's transferFocus() does nothing if component does
not hold the focus.
.. this seems to be violating the AWT 'spec' .. however.
Workaround: Request focus before transfering it to the next/previous element.
---
make/scripts/tests.sh | 9 ++++-----
src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 12 ++++++++++--
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 97fe1d2c9..eb88ba3ab 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -109,7 +109,7 @@ function jrun() {
#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.GLDrawable -Dnativewindow.debug.X11Util -Dnativewindow.debug.NativeWindow -Dnewt.debug.Display -Dnewt.debug.Screen -Dnewt.debug.Window"
#D_ARGS="-Djogl.debug.Animator"
#D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
@@ -181,7 +181,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug=all"
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug.JAWT -Djogl.debug.Animator"
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.GLDrawable"
- #D_ARGS="-Dnewt.debug.Window"
+ D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Xprof"
#D_ARGS="-Dnativewindow.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel"
@@ -286,7 +286,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $*
@@ -513,7 +513,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#
#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.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 $*
@@ -523,7 +523,6 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
#testawtswt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01aSWT $*
#testawtswt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04SWT $*
-#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentParentingAWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentChildWindowBug632NEWT $*
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 65b44b141..e5db8fd14 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -223,16 +223,24 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
final Set bwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
if(fwdKeys.contains(ks)) {
if(DEBUG) {
- System.err.println("NewtCanvasAWT.focusKey (fwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner());
+ System.err.println("NewtCanvasAWT.focusKey (fwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner()+", hasFocus: "+hasFocus());
}
// 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();
+ }
NewtCanvasAWT.this.transferFocus();
suppress = true;
} else if(bwdKeys.contains(ks)) {
if(DEBUG) {
- System.err.println("NewtCanvasAWT.focusKey (bwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner());
+ System.err.println("NewtCanvasAWT.focusKey (bwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner()+", hasFocus: "+hasFocus());
}
// 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();
+ }
NewtCanvasAWT.this.transferFocusBackward();
suppress = true;
}
--
cgit v1.2.3
From cb7118fc875b6722803e4b11d5681671962a8d3a Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sun, 23 Jun 2013 20:15:38 +0200
Subject: Fix NewtCanvasAWT focus traversal for Java7 (Take 2): Commit
70bf3a4ec44504b86294a332255aaae8d2e86bf4 was not sufficient.
Commit 70bf3a4ec44504b86294a332255aaae8d2e86bf4 did not work out on Windows.
Solution now gathers the next or previous 'to be focused' component,
using the FocusTraversalPolicy of the visible/focusable/enabled container.
Then we simply request it's focus.
Works w/ Java7 on Linux and Windows.
---
make/scripts/tests-win.bat | 4 +--
make/scripts/tests-x64-dbg.bat | 3 +-
.../classes/jogamp/nativewindow/awt/AWTMisc.java | 39 ++++++++++++++++++++++
.../classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 19 ++++-------
4 files changed, 50 insertions(+), 15 deletions(-)
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index bcec0c5b6..bdef9cc10 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -55,7 +55,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestIsRealizedCon
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 %*
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
@@ -84,7 +84,7 @@ 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 %*
+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 %*
diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat
index a370ebfc8..cb40125f2 100755
--- a/make/scripts/tests-x64-dbg.bat
+++ b/make/scripts/tests-x64-dbg.bat
@@ -27,7 +27,7 @@ REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all"
REM set D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser -Djogl.debug.GLProfile"
REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogl.debug.GLSLCode" "-Djogl.debug.GLMediaPlayer"
REM set D_ARGS="-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true" "-Djogl.debug.GLSLCode"
-set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.ProcAddressHelper" "-Djogamp.debug.NativeLibrary" "-Djogamp.debug.NativeLibrary.Lookup" "-Djogamp.debug.JNILibLoader" "-Djogamp.debug.TempJarCache" "-Djogamp.debug.JarUtil"
+REM set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.ProcAddressHelper" "-Djogamp.debug.NativeLibrary" "-Djogamp.debug.NativeLibrary.Lookup" "-Djogamp.debug.JNILibLoader" "-Djogamp.debug.TempJarCache" "-Djogamp.debug.JarUtil"
REM set D_ARGS="-Djogl.debug.ExtensionAvailabilityCache" "-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.ProcAddressHelper=true" "-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true"
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.NativeLibrary=true"
REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.ExtensionAvailabilityCache" "-Djogamp.debug.ProcAddressHelper=true"
@@ -41,6 +41,7 @@ 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" "-Djogl.windows.useWGLVersionOf5WGLGDIFuncSet"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch"
REM set D_ARGS="-Dnewt.debug.Window"
+set D_ARGS="-Dnewt.debug.Window.KeyEvent" "-Dnewt.debug.Window"
REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
REM set D_ARGS="-Dnewt.debug.Window.MouseEvent"
REM set D_ARGS="-Dnewt.debug.Window.MouseEvent" "-Dnewt.debug.Window.KeyEvent"
diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
index d77cd75ef..2524f107a 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
@@ -27,6 +27,7 @@
*/
package jogamp.nativewindow.awt;
+import java.awt.FocusTraversalPolicy;
import java.awt.Window;
import java.awt.Component;
import java.awt.Container;
@@ -68,6 +69,44 @@ public class AWTMisc {
return (Container) c;
}
+ public static Component getNextFocus(Component comp) {
+ Container focusContainer = comp.getFocusCycleRootAncestor();
+ while ( focusContainer != null &&
+ ( !focusContainer.isShowing() || !focusContainer.isFocusable() || !focusContainer.isEnabled() ) )
+ {
+ comp = focusContainer;
+ focusContainer = comp.getFocusCycleRootAncestor();
+ }
+ Component next = null;
+ if (focusContainer != null) {
+ final FocusTraversalPolicy policy = focusContainer.getFocusTraversalPolicy();
+ next = policy.getComponentAfter(focusContainer, comp);
+ if (next == null) {
+ next = policy.getDefaultComponent(focusContainer);
+ }
+ }
+ return next;
+ }
+
+ public static Component getPrevFocus(Component comp) {
+ Container focusContainer = comp.getFocusCycleRootAncestor();
+ while ( focusContainer != null &&
+ ( !focusContainer.isShowing() || !focusContainer.isFocusable() || !focusContainer.isEnabled() ) )
+ {
+ comp = focusContainer;
+ focusContainer = comp.getFocusCycleRootAncestor();
+ }
+ Component prev = null;
+ if (focusContainer != null) {
+ final FocusTraversalPolicy policy = focusContainer.getFocusTraversalPolicy();
+ prev = policy.getComponentBefore(focusContainer, comp);
+ if (prev == null) {
+ prev = policy.getDefaultComponent(focusContainer);
+ }
+ }
+ return prev;
+ }
+
/**
* Issue this when your non AWT toolkit gains focus to clear AWT menu path
*/
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index e5db8fd14..dd8939e43 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -31,6 +31,7 @@ package com.jogamp.newt.awt;
import java.awt.AWTKeyStroke;
import java.awt.Canvas;
+import java.awt.Component;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.KeyboardFocusManager;
@@ -222,26 +223,20 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
final Set fwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
final Set bwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
if(fwdKeys.contains(ks)) {
+ final Component nextFocus = AWTMisc.getNextFocus(NewtCanvasAWT.this);
if(DEBUG) {
- System.err.println("NewtCanvasAWT.focusKey (fwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner()+", hasFocus: "+hasFocus());
+ System.err.println("NewtCanvasAWT.focusKey (fwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner()+", hasFocus: "+hasFocus()+", nextFocus "+nextFocus);
}
// 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();
- }
- NewtCanvasAWT.this.transferFocus();
+ nextFocus.requestFocus();
suppress = true;
} else if(bwdKeys.contains(ks)) {
+ final Component prevFocus = AWTMisc.getPrevFocus(NewtCanvasAWT.this);
if(DEBUG) {
- System.err.println("NewtCanvasAWT.focusKey (bwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner()+", hasFocus: "+hasFocus());
+ System.err.println("NewtCanvasAWT.focusKey (bwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner()+", hasFocus: "+hasFocus()+", prevFocus "+prevFocus);
}
// 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();
- }
- NewtCanvasAWT.this.transferFocusBackward();
+ prevFocus.requestFocus();
suppress = true;
}
}
--
cgit v1.2.3
From 85f4b824dcf1ff6ebb658ffd242eea2f9d8cd087 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 06:17:46 +0200
Subject: Tests: Remove subsequent exceptions .. (not original issue, but
annoying while analyzing)
---
.../test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java | 4 +++-
.../junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java | 4 +++-
.../newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java | 10 +++++++---
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
index a847ca671..1504c948e 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
@@ -85,7 +85,9 @@ public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers {
public static void afterClass() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
- _testFrame.dispose() ;
+ if( null != _testFrame ) {
+ _testFrame.dispose() ;
+ }
}
}) ;
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
index 968d1af79..e0bc847a7 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
@@ -98,7 +98,9 @@ public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers
public static void afterClass() throws Exception {
SwingUtilities.invokeAndWait( new Runnable() {
public void run() {
- _testFrame.dispose() ;
+ if( null != _testFrame ) {
+ _testFrame.dispose() ;
+ }
}
} ) ;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java
index cc32d5331..86e336e53 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java
@@ -146,9 +146,13 @@ public class TestNewtEventModifiersNewtCanvasSWTAWT extends BaseNewtEventModifie
try {
SWTAccessor.invoke(_display, true, new Runnable() {
public void run() {
- _composite.dispose();
- _shell.dispose();
- if(!_display.isDisposed()) {
+ if( null != _composite ) {
+ _composite.dispose();
+ }
+ if( null != _shell ) {
+ _shell.dispose();
+ }
+ if( null != _display && !_display.isDisposed()) {
_display.dispose();
}
}});
--
cgit v1.2.3
From 62f9525a9caba51fc4484c2ab47d64b516dc9d43 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 06:50:40 +0200
Subject: Refine cb7118fc875b6722803e4b11d5681671962a8d3a: Unify get next/prev
focus component method.
---
.../classes/jogamp/nativewindow/awt/AWTMisc.java | 31 +++++++---------------
.../classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 4 +--
2 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
index 2524f107a..66be82a44 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
@@ -69,7 +69,15 @@ public class AWTMisc {
return (Container) c;
}
- public static Component getNextFocus(Component comp) {
+ /**
+ * Traverse to the next forward or backward component using the
+ * container's FocusTraversalPolicy.
+ *
+ * @param comp the assumed current focuse component
+ * @param forward if true, returns the next focus component, otherwise the previous one.
+ * @return
+ */
+ public static Component getNextFocus(Component comp, boolean forward) {
Container focusContainer = comp.getFocusCycleRootAncestor();
while ( focusContainer != null &&
( !focusContainer.isShowing() || !focusContainer.isFocusable() || !focusContainer.isEnabled() ) )
@@ -80,7 +88,7 @@ public class AWTMisc {
Component next = null;
if (focusContainer != null) {
final FocusTraversalPolicy policy = focusContainer.getFocusTraversalPolicy();
- next = policy.getComponentAfter(focusContainer, comp);
+ next = forward ? policy.getComponentAfter(focusContainer, comp) : policy.getComponentBefore(focusContainer, comp);
if (next == null) {
next = policy.getDefaultComponent(focusContainer);
}
@@ -88,25 +96,6 @@ public class AWTMisc {
return next;
}
- public static Component getPrevFocus(Component comp) {
- Container focusContainer = comp.getFocusCycleRootAncestor();
- while ( focusContainer != null &&
- ( !focusContainer.isShowing() || !focusContainer.isFocusable() || !focusContainer.isEnabled() ) )
- {
- comp = focusContainer;
- focusContainer = comp.getFocusCycleRootAncestor();
- }
- Component prev = null;
- if (focusContainer != null) {
- final FocusTraversalPolicy policy = focusContainer.getFocusTraversalPolicy();
- prev = policy.getComponentBefore(focusContainer, comp);
- if (prev == null) {
- prev = policy.getDefaultComponent(focusContainer);
- }
- }
- return prev;
- }
-
/**
* Issue this when your non AWT toolkit gains focus to clear AWT menu path
*/
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index dd8939e43..6ba7a1a61 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -223,7 +223,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
final Set fwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
final Set bwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
if(fwdKeys.contains(ks)) {
- final Component nextFocus = AWTMisc.getNextFocus(NewtCanvasAWT.this);
+ final Component nextFocus = AWTMisc.getNextFocus(NewtCanvasAWT.this, true /* forward */);
if(DEBUG) {
System.err.println("NewtCanvasAWT.focusKey (fwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner()+", hasFocus: "+hasFocus()+", nextFocus "+nextFocus);
}
@@ -231,7 +231,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
nextFocus.requestFocus();
suppress = true;
} else if(bwdKeys.contains(ks)) {
- final Component prevFocus = AWTMisc.getPrevFocus(NewtCanvasAWT.this);
+ final Component prevFocus = AWTMisc.getNextFocus(NewtCanvasAWT.this, false /* forward */);
if(DEBUG) {
System.err.println("NewtCanvasAWT.focusKey (bwd): "+ks+", current focusOwner "+keyboardFocusManager.getFocusOwner()+", hasFocus: "+hasFocus()+", prevFocus "+prevFocus);
}
--
cgit v1.2.3
From e5dd5757379353a9dd10248136afef65c33f6420 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 06:51:16 +0200
Subject: GearsES2/RedSquareES2: Detect !GLSL and don't attempt to render in
such case.
---
.../opengl/test/junit/jogl/demos/es2/GearsES2.java | 21 +++++++++++++++++----
.../test/junit/jogl/demos/es2/RedSquareES2.java | 22 +++++++++++++++++-----
2 files changed, 34 insertions(+), 9 deletions(-)
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 66a8082a6..7e86db972 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
@@ -124,7 +124,7 @@ public class GearsES2 implements GLEventListener {
public void init(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES2.init ...");
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
if(verbose) {
System.err.println("GearsES2 init on "+Thread.currentThread());
@@ -138,6 +138,10 @@ public class GearsES2 implements GLEventListener {
System.err.println("GL Profile: "+gl.getGLProfile());
System.err.println("GL Renderer Quirks:" + gl.getContext().getRendererQuirks().toString());
System.err.println("GL:" + gl + ", " + gl.getContext().getGLVersion());
+ }
+ if( !gl.hasGLSL() ) {
+ System.err.println("No GLSL available, no rendering.");
+ return;
}
gl.glEnable(GL.GL_DEPTH_TEST);
@@ -228,11 +232,14 @@ public class GearsES2 implements GLEventListener {
drawableHeight = height;
// Thread.dumpStack();
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
if(-1 != swapInterval) {
gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
}
+ if( !gl.hasGLSL() ) {
+ return;
+ }
st.useProgram(gl, true);
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
@@ -264,7 +271,10 @@ public class GearsES2 implements GLEventListener {
window.removeMouseListener(gearsMouse);
window.removeKeyListener(gearsKeys);
}
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ if( !gl.hasGLSL() ) {
+ return;
+ }
st.useProgram(gl, false);
gear1.destroy(gl);
gear1 = null;
@@ -291,7 +301,7 @@ public class GearsES2 implements GLEventListener {
}
// Get the GL corresponding to the drawable we are animating
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
final boolean hasFocus;
final Object upstreamWidget = drawable.getUpstreamWidget();
@@ -320,6 +330,9 @@ public class GearsES2 implements GLEventListener {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
}
}
+ if( !gl.hasGLSL() ) {
+ return;
+ }
gl.glEnable(GL.GL_CULL_FACE);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
index 3f092e341..b7f989637 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
@@ -64,7 +64,7 @@ public class RedSquareES2 implements GLEventListener {
public void init(GLAutoDrawable glad) {
System.err.println(Thread.currentThread()+" RedSquareES2.init ...");
- GL2ES2 gl = glad.getGL().getGL2ES2();
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
System.err.println("RedSquareES2 init on "+Thread.currentThread());
System.err.println("Chosen GLCapabilities: " + glad.getChosenGLCapabilities());
@@ -77,7 +77,10 @@ public class RedSquareES2 implements GLEventListener {
System.err.println("GL Profile: "+gl.getGLProfile());
System.err.println("GL Renderer Quirks:" + gl.getContext().getRendererQuirks().toString());
System.err.println("GL:" + gl + ", " + gl.getContext().getGLVersion());
-
+ if( !gl.hasGLSL() ) {
+ System.err.println("No GLSL available, no rendering.");
+ return;
+ }
st = new ShaderState();
st.setVerbose(true);
final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shader",
@@ -132,11 +135,14 @@ public class RedSquareES2 implements GLEventListener {
public void display(GLAutoDrawable glad) {
long t1 = System.currentTimeMillis();
- GL2ES2 gl = glad.getGL().getGL2ES2();
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
if( clearBuffers ) {
gl.glClearColor(0, 0, 0, 0);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
}
+ if( !gl.hasGLSL() ) {
+ return;
+ }
st.useProgram(gl, true);
// One rotation every four seconds
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
@@ -161,7 +167,10 @@ public class RedSquareES2 implements GLEventListener {
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(glad.getHandle()));
// Thread.dumpStack();
- GL2ES2 gl = glad.getGL().getGL2ES2();
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
+ if( !gl.hasGLSL() ) {
+ return;
+ }
if(-1 != swapInterval) {
gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
@@ -181,7 +190,10 @@ public class RedSquareES2 implements GLEventListener {
public void dispose(GLAutoDrawable glad) {
System.err.println(Thread.currentThread()+" RedSquareES2.dispose ... ");
- GL2ES2 gl = glad.getGL().getGL2ES2();
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
+ if( !gl.hasGLSL() ) {
+ return;
+ }
st.destroy(gl);
st = null;
pmvMatrix.destroy();
--
cgit v1.2.3
From 3e528a69db38711c789a08d1d7335e5a7739f780 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 06:53:05 +0200
Subject: TestGearsES2GLJPanel*: Use GearsES1 is using bitmap - On Windows GDI
would be returned!
We still have to solve the GL renderer selection / probing problem, i.e. in such cases
we don't know before context realization which GL renderer we actually receive.
---
.../jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java | 7 ++++++-
.../jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java | 18 ++++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
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 3484ffa1d..f15065525 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
@@ -49,6 +49,7 @@ import com.jogamp.newt.event.TraceKeyAdapter;
import com.jogamp.newt.event.TraceWindowAdapter;
import com.jogamp.newt.event.awt.AWTKeyAdapter;
import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
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.QuitAdapter;
@@ -103,7 +104,11 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
glJPanel.setMinimumSize(wsize);
glJPanel.setPreferredSize(wsize);
glJPanel.setSize(wsize);
- glJPanel.addGLEventListener(new GearsES2(swapInterval));
+ if( caps.isBitmap() ) {
+ glJPanel.addGLEventListener(new GearsES1(swapInterval));
+ } else {
+ glJPanel.addGLEventListener(new GearsES2(swapInterval));
+ }
final SnapshotGLEventListener snap = new SnapshotGLEventListener();
glJPanel.addGLEventListener(snap);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java
index 54dfe6726..2fb30a7ed 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java
@@ -40,6 +40,7 @@ import java.nio.FloatBuffer;
import javax.media.opengl.GLAnimatorControl;
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.GLJPanel;
import javax.swing.JComponent;
@@ -54,6 +55,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
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.QuitAdapter;
@@ -118,10 +120,18 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase {
if ( !useInterPanel ) {
canvas.setBounds(x, y, w, h);
}
- GearsES2 demo = new GearsES2(swapInterval);
- demo.setIgnoreFocus(true);
- demo.setGearsColors(color, color, color);
- demo.setClearColor(clearColor);
+ final GLEventListener demo;
+ if( caps.isBitmap() ) {
+ GearsES1 gdemo = new GearsES1(swapInterval);
+ gdemo.setGearsColors(color, color, color);
+ demo = gdemo;
+ } else {
+ GearsES2 gdemo = new GearsES2(swapInterval);
+ gdemo.setIgnoreFocus(true);
+ gdemo.setGearsColors(color, color, color);
+ gdemo.setClearColor(clearColor);
+ demo = gdemo;
+ }
canvas.addGLEventListener(demo);
if( null != anim ) {
anim.add(canvas);
--
cgit v1.2.3
From 00f82fde560306891823a1273baf50264dca3d05 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 07:00:42 +0200
Subject: TestGearsES2GLJPanel*: Use Gears (GL 1 based) if using bitmap - On
Windows GDI would be returned and neither ES1 nor ES2 features are available.
Fixes commit 3e528a69db38711c789a08d1d7335e5a7739f780
---
.../test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java | 4 ++--
.../test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java | 6 ++----
2 files changed, 4 insertions(+), 6 deletions(-)
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 f15065525..e3be7b8b7 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
@@ -49,8 +49,8 @@ import com.jogamp.newt.event.TraceKeyAdapter;
import com.jogamp.newt.event.TraceWindowAdapter;
import com.jogamp.newt.event.awt.AWTKeyAdapter;
import com.jogamp.newt.event.awt.AWTWindowAdapter;
-import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -105,7 +105,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
glJPanel.setPreferredSize(wsize);
glJPanel.setSize(wsize);
if( caps.isBitmap() ) {
- glJPanel.addGLEventListener(new GearsES1(swapInterval));
+ glJPanel.addGLEventListener(new Gears(swapInterval));
} else {
glJPanel.addGLEventListener(new GearsES2(swapInterval));
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java
index 2fb30a7ed..4668603d8 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java
@@ -55,8 +55,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
import com.jogamp.common.nio.Buffers;
-import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -122,9 +122,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase {
}
final GLEventListener demo;
if( caps.isBitmap() ) {
- GearsES1 gdemo = new GearsES1(swapInterval);
- gdemo.setGearsColors(color, color, color);
- demo = gdemo;
+ demo = new Gears(swapInterval);
} else {
GearsES2 gdemo = new GearsES2(swapInterval);
gdemo.setIgnoreFocus(true);
--
cgit v1.2.3
From f857d3f86be221fb5f8488a8419c4cac8d65fc89 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 09:48:11 +0200
Subject: scripts: osx make/test java7/6 fixes
---
make/scripts/make.jogl.all.macosx-java7.sh | 6 ------
make/scripts/tests-osx-x64-java6.sh | 12 ++++++++++++
make/scripts/tests-osx-x64-java7.sh | 12 ------------
make/scripts/tests-osx-x64-java7OnJava6build.sh | 12 ------------
make/scripts/tests-osx-x64-java7u12ea.sh | 12 ------------
make/scripts/tests-osx-x64-java7u12eaOnJava6Build.sh | 12 ------------
make/scripts/tests-osx-x64.sh | 4 ++--
7 files changed, 14 insertions(+), 56 deletions(-)
create mode 100755 make/scripts/tests-osx-x64-java6.sh
delete mode 100755 make/scripts/tests-osx-x64-java7.sh
delete mode 100755 make/scripts/tests-osx-x64-java7OnJava6build.sh
delete mode 100755 make/scripts/tests-osx-x64-java7u12ea.sh
delete mode 100755 make/scripts/tests-osx-x64-java7u12eaOnJava6Build.sh
diff --git a/make/scripts/make.jogl.all.macosx-java7.sh b/make/scripts/make.jogl.all.macosx-java7.sh
index ad1e7afe1..ee82bbc91 100755
--- a/make/scripts/make.jogl.all.macosx-java7.sh
+++ b/make/scripts/make.jogl.all.macosx-java7.sh
@@ -9,9 +9,6 @@ fi
# -Djavacdebug="true" \
# -Djavacdebuglevel="source,lines,vars" \
#
-# -Dtarget.sourcelevel=1.6 \
-# -Dtarget.targetlevel=1.6 \
-# -Dtarget.rt.jar=/opt-share/jre1.6.0_30/lib/rt.jar \
JAVA_HOME=`/usr/libexec/java_home -version 1.7`
PATH=$JAVA_HOME/bin:$PATH
@@ -21,8 +18,5 @@ export JAVA_HOME PATH
export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
ant \
- -Dtarget.sourcelevel=1.6 \
- -Dtarget.targetlevel=1.6 \
- -Dtarget.rt.jar=/opt-share/jre1.6.0_30/lib/rt.jar \
-Drootrel.build=build-macosx-java7 \
$* 2>&1 | tee make.jogl.all.macosx-java7.log
diff --git a/make/scripts/tests-osx-x64-java6.sh b/make/scripts/tests-osx-x64-java6.sh
new file mode 100755
index 000000000..fe2d2c4ec
--- /dev/null
+++ b/make/scripts/tests-osx-x64-java6.sh
@@ -0,0 +1,12 @@
+#! /bin/bash
+
+export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
+
+JAVA_HOME=`/usr/libexec/java_home -version 1.6`
+PATH=$JAVA_HOME/bin:$PATH
+export JAVA_HOME PATH
+
+spath=`dirname $0`
+
+. $spath/tests.sh /usr/bin/java -d64 ../build-macosx $*
+
diff --git a/make/scripts/tests-osx-x64-java7.sh b/make/scripts/tests-osx-x64-java7.sh
deleted file mode 100755
index e870d0752..000000000
--- a/make/scripts/tests-osx-x64-java7.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /bin/bash
-
-export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
-
-JAVA_HOME=`/usr/libexec/java_home -version 1.7`
-PATH=$JAVA_HOME/bin:$PATH
-export JAVA_HOME PATH
-
-spath=`dirname $0`
-
-. $spath/tests.sh $JAVA_HOME/bin/java -d64 ../build-macosx-java7 $*
-
diff --git a/make/scripts/tests-osx-x64-java7OnJava6build.sh b/make/scripts/tests-osx-x64-java7OnJava6build.sh
deleted file mode 100755
index e1b07202b..000000000
--- a/make/scripts/tests-osx-x64-java7OnJava6build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /bin/bash
-
-export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
-
-JAVA_HOME=`/usr/libexec/java_home -version 1.7`
-PATH=$JAVA_HOME/bin:$PATH
-export JAVA_HOME PATH
-
-spath=`dirname $0`
-
-. $spath/tests.sh $JAVA_HOME/bin/java -d64 ../build-macosx $*
-
diff --git a/make/scripts/tests-osx-x64-java7u12ea.sh b/make/scripts/tests-osx-x64-java7u12ea.sh
deleted file mode 100755
index a8c9bed77..000000000
--- a/make/scripts/tests-osx-x64-java7u12ea.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /bin/bash
-
-export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
-
-JAVA_HOME=`/usr/libexec/java_home -version 1.7.0_12`
-PATH=$JAVA_HOME/bin:$PATH
-export JAVA_HOME PATH
-
-spath=`dirname $0`
-
-. $spath/tests.sh $JAVA_HOME/bin/java -d64 ../build-macosx-java7 $*
-
diff --git a/make/scripts/tests-osx-x64-java7u12eaOnJava6Build.sh b/make/scripts/tests-osx-x64-java7u12eaOnJava6Build.sh
deleted file mode 100755
index dad9c430e..000000000
--- a/make/scripts/tests-osx-x64-java7u12eaOnJava6Build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /bin/bash
-
-export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
-
-JAVA_HOME=`/usr/libexec/java_home -version 1.7.0_12`
-PATH=$JAVA_HOME/bin:$PATH
-export JAVA_HOME PATH
-
-spath=`dirname $0`
-
-. $spath/tests.sh $JAVA_HOME/bin/java -d64 ../build-macosx $*
-
diff --git a/make/scripts/tests-osx-x64.sh b/make/scripts/tests-osx-x64.sh
index fe2d2c4ec..e1b07202b 100755
--- a/make/scripts/tests-osx-x64.sh
+++ b/make/scripts/tests-osx-x64.sh
@@ -2,11 +2,11 @@
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
-JAVA_HOME=`/usr/libexec/java_home -version 1.6`
+JAVA_HOME=`/usr/libexec/java_home -version 1.7`
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH
spath=`dirname $0`
-. $spath/tests.sh /usr/bin/java -d64 ../build-macosx $*
+. $spath/tests.sh $JAVA_HOME/bin/java -d64 ../build-macosx $*
--
cgit v1.2.3
From 835cea627f80d8f8a851514734f53e6336d9d6d9 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 09:48:56 +0200
Subject: TestSWTAccessor03AWTGLn: Fix SWT deadlock on Java7/Windows: Must
perform AWT frame close on current thread ..
---
make/scripts/tests-win.bat | 12 ++++++++----
make/scripts/tests.sh | 6 +++---
.../opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java | 8 ++++++--
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index bdef9cc10..dfe7b2887 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -59,7 +59,8 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGe
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.gl2.awt.TestGearsGLJPanelAWT %*
+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.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
@@ -77,14 +78,16 @@ 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.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.TestNewtEventModifiersNewtCanvasSWT %*
+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.parenting.TestParenting01NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting01bAWT %*
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
-scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT %*
+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 %*
@@ -92,11 +95,12 @@ 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.TestTranslucentParentingAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentChildWindowBug632NEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn %*
+scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTGLn %*
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.newt.TestWindows01NEWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index eb88ba3ab..defb61e50 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -181,7 +181,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug=all"
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug.JAWT -Djogl.debug.Animator"
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.GLDrawable"
- D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.KeyEvent"
+ #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Xprof"
#D_ARGS="-Dnativewindow.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel"
@@ -465,7 +465,7 @@ function testawtswt() {
# with OSX: -XstartOnFirstThread
#
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTEclipseGLCanvas01GLn $*
-#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn $*
+testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTGLn $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTBug628ResizeDeadlockAWT $*
@@ -513,7 +513,7 @@ function testawtswt() {
#
#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.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 $*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java
index 5803a1675..ee5dc7fea 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java
@@ -120,14 +120,18 @@ public class TestSWTAccessor03AWTGLn extends UITestCase {
Assert.assertNotNull( shell );
Assert.assertNotNull( composite );
Assert.assertNotNull( glcanvas );
- javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ final Runnable releaseAWT = new Runnable() {
public void run() {
+ // deadlocks Java7 on Windows
frame.setVisible(false);
frame.remove(glcanvas);
frame.dispose();
frame = null;
glcanvas = null;
- }});
+ } };
+ // Deadlocks Java7 on Windows
+ // javax.swing.SwingUtilities.invokeAndWait( releaseAWT );
+ releaseAWT.run();
SWTAccessor.invoke(true, new Runnable() {
public void run() {
--
cgit v1.2.3
From c27157bf7fa9776b0f212c2ccfcf80c4e734eedc Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 11:53:59 +0200
Subject: UITestCase: Increase SINGLE_INSTANCE_LOCK_TO from 3 to 6 minutes!
---
src/test/com/jogamp/opengl/test/junit/util/UITestCase.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
index a81dec874..82a80ff49 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
@@ -62,7 +62,7 @@ public abstract class UITestCase {
public static final String SINGLE_INSTANCE_LOCK_FILE = "UITestCase.lock";
public static final int SINGLE_INSTANCE_LOCK_PORT = 59999;
- public static final long SINGLE_INSTANCE_LOCK_TO = 3*60*1000; // wait up to 3 min
+ public static final long SINGLE_INSTANCE_LOCK_TO = 6*60*1000; // wait up to 6 mins
public static final long SINGLE_INSTANCE_LOCK_POLL = 1000; // poll every 1s
private static volatile SingletonInstance singletonInstance;
--
cgit v1.2.3
From 8f3b2a4cc14be60681a7bfae0507655cc5702836 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 15:50:27 +0200
Subject: Workaroung a Java7 AWT EDT/Robot bug: Validate whether AWT-EDT is
alive before certain robot ops.
We have experienced that w/o utilizing AWT components, i.e. NEWT tests,
the AWT-EDT 'sometimes' dies.
Performing AWT robot's waitForIdle() in this situation causes a deadlock,
since the call will never complete it's EventQueue.invokeAndWait() call.
While analyzing this issue, we created a test tool whether the the AWT EDT is still alive.
This test issues EventQueue.invokeLater( .. { flag=true; } ); and polls up until 2s
for the result.
Turns out that the sporadic AWT-EDT issues are solved by this test itself,
i.e. it probably cause it to be reinstated. (?!)
We have to observe this behavior.
Another proof that quantum mechanic rules also apply in the macro cosmos :)
---
make/scripts/tests-win.bat | 4 +-
make/scripts/tests.sh | 4 +-
.../junit/newt/event/BaseNewtEventModifiers.java | 9 +++-
.../opengl/test/junit/util/AWTRobotUtil.java | 53 +++++++++++++++++++++-
4 files changed, 63 insertions(+), 7 deletions(-)
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index dfe7b2887..f8cecf46b 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -72,7 +72,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventOrderAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventAutoRepeatAWT %*
+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 $*
@@ -95,7 +95,7 @@ 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.TestTranslucentParentingAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentChildWindowBug632NEWT %*
-scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTGLn %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTBug628ResizeDeadlock %*
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index defb61e50..247cf9d2d 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -465,7 +465,7 @@ function testawtswt() {
# with OSX: -XstartOnFirstThread
#
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTEclipseGLCanvas01GLn $*
-testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn $*
+#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTGLn $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTBug628ResizeDeadlockAWT $*
@@ -479,7 +479,7 @@ testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn $*
#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.TestNewtKeyEventAutoRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT $*
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 3a2c4cc81..e6edd0da5 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
@@ -39,6 +39,7 @@ import org.junit.Test ;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.newt.event.MouseEvent;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase ;
/**
@@ -519,7 +520,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) {
@@ -561,7 +562,7 @@ 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 ) ;
{
@@ -634,6 +635,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
////////////////////////////////////////////////////////////////////////////
private void _doKeyPress( int keyCode ) {
+ AWTRobotUtil.validateAWTEDTIsAlive();
if( keyCode != 0 ) {
boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ;
_testMouseListener.setModifierCheckEnabled( false ) ;
@@ -646,6 +648,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
////////////////////////////////////////////////////////////////////////////
private void _doKeyRelease( int keyCode ) {
+ AWTRobotUtil.validateAWTEDTIsAlive();
if( keyCode != 0 ) {
boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ;
_testMouseListener.setModifierCheckEnabled( false ) ;
@@ -697,6 +700,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
private void _releaseModifiers() {
if (_robot != null) {
+ AWTRobotUtil.validateAWTEDTIsAlive();
_robot.setAutoDelay( MS_ROBOT_AUTO_DELAY ) ;
@@ -721,6 +725,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
private void _escape() {
if (_robot != null) {
+ AWTRobotUtil.validateAWTEDTIsAlive();
_robot.keyPress( java.awt.event.KeyEvent.VK_ESCAPE ) ;
_robot.keyRelease( java.awt.event.KeyEvent.VK_ESCAPE ) ;
}
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 b5f8def3c..8a73d3363 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -31,8 +31,10 @@ package com.jogamp.opengl.test.junit.util;
import jogamp.newt.WindowImplAccess;
import jogamp.newt.awt.event.AWTNewtEventFactory;
+import java.lang.Thread.UncaughtExceptionHandler;
import java.lang.reflect.InvocationTargetException;
import java.awt.AWTException;
+import java.awt.EventQueue;
import java.awt.Robot;
import javax.media.nativewindow.NativeWindow;
@@ -56,6 +58,50 @@ 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) {
+ System.err.println("*** AWTRobotUtil: UncaughtException (this Thread "+Thread.currentThread().getName()+") : Thread <"+t.getName()+">, "+e.getClass().getName()+": "+e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ static {
+ Thread.setDefaultUncaughtExceptionHandler( new OurUncaughtExceptionHandler() );
+ // System.err.println("AWT EDT alive: "+isAWTEDTAlive());
+ }
+
+ public static boolean isAWTEDTAlive() {
+ if( EventQueue.isDispatchThread() ) {
+ return true;
+ }
+ synchronized ( awtEDTAliveSync ) {
+ awtEDTAliveFlag = false;
+ EventQueue.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ awtEDTAliveFlag = true;
+ }
+ });
+ for (int wait=0; wait
Date: Mon, 24 Jun 2013 17:12:02 +0200
Subject: Apply workaround of Java7 AWT Robot.waitForIdle()/EDT bug for all
Robot.waitForIdle() calls.
See commit 8f3b2a4cc14be60681a7bfae0507655cc5702836
---
.../newt/event/TestNewtKeyCodeModifiersAWT.java | 6 +++---
.../test/junit/newt/event/TestNewtKeyCodesAWT.java | 2 +-
.../newt/event/TestNewtKeyEventAutoRepeatAWT.java | 8 ++++----
.../junit/newt/event/TestNewtKeyEventOrderAWT.java | 8 ++++----
.../opengl/test/junit/util/AWTRobotUtil.java | 24 +++++++++++++---------
5 files changed, 26 insertions(+), 22 deletions(-)
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 c1b572df3..19d739a75 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
@@ -164,7 +164,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
keyAdapter.reset();
AWTRobotUtil.newtKeyPress(0, robot, true, keyCode, 10); // press keyCode
AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 100); // release keyCode
- robot.waitForIdle();
+ AWTRobotUtil.waitForIdle(robot);
for(int j=0; j < 100 && keyAdapter.getQueueSize() < 2; j++) { // wait until events are collected
robot.delay(100);
}
@@ -173,7 +173,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
AWTRobotUtil.newtKeyPress(0, robot, true, keyCode, 10); // press keyCode
AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 10); // release keyCode
AWTRobotUtil.newtKeyPress(0, robot, false, modifierKey, 100); // release MOD
- robot.waitForIdle();
+ AWTRobotUtil.waitForIdle(robot);
for(int j=0; j < 100 && keyAdapter.getQueueSize() < 2+4; j++) { // wait until events are collected
robot.delay(100);
}
@@ -212,7 +212,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
AWTRobotUtil.newtKeyPress(0, robot, false, m2k, 10); // release MOD
AWTRobotUtil.newtKeyPress(0, robot, false, m1k, 10); // release MOD
- robot.waitForIdle();
+ AWTRobotUtil.waitForIdle(robot);
for(int j=0; j < 100 && keyAdapter.getQueueSize() < 4+4; j++) { // wait until events are collected
robot.delay(100);
}
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 a5f47e870..e1254ae6d 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
@@ -210,7 +210,7 @@ public class TestNewtKeyCodesAWT extends UITestCase {
break;
}
eventCount++;
- robot.waitForIdle();
+ AWTRobotUtil.waitForIdle(robot);
}
for(int j=0; j < 20 && keyAdapter.getQueueSize() < eventCount; j++) { // wait until events are collected
robot.delay(100);
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 b6c15231c..508ad2cbf 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
@@ -162,9 +162,9 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
for(int i=0; i
Date: Mon, 24 Jun 2013 19:28:05 +0200
Subject: NEWT Windows WindowDriver: Suppress LOCK_SURFACE_CHANGED, no
semantics in GLDrawable on Windows.
FIXME: Validate against EGL surface creation: ANGLE uses HWND -> fine!
---
src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index 60fc3ec0f..7a8e683af 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -79,6 +79,11 @@ public class WindowDriver extends WindowImpl {
}
hmon = MonitorFromWindow0(hWnd);
+ // Let's not trigger on HDC change, GLDrawableImpl.'s destroy/create is a nop here anyways.
+ // FIXME: Validate against EGL surface creation: ANGLE uses HWND -> fine!
+ return LOCK_SUCCESS;
+
+ /**
if( hdc_old == hdc ) {
return LOCK_SUCCESS;
}
@@ -86,7 +91,7 @@ public class WindowDriver extends WindowImpl {
System.err.println("WindowsWindow: surface change "+toHexString(hdc_old)+" -> "+toHexString(hdc));
// Thread.dumpStack();
}
- return LOCK_SURFACE_CHANGED;
+ return LOCK_SURFACE_CHANGED; */
}
@Override
--
cgit v1.2.3
From 9a033994da76e9998ff20d875658b953e70bf664 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 19:28:49 +0200
Subject: Tests NEWTKeyAdapter: Fix log string
---
src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 88ed74a3f..d143b3ca1 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
@@ -93,7 +93,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
}
queue.add(e);
if( verbose ) {
- System.err.println("NEWT AWT PRESSED ["+pressed+"]: "+prefix+", "+e);
+ System.err.println("KEY NEWT PRESSED ["+pressed+"]: "+prefix+", "+e);
}
}
@@ -105,7 +105,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
}
queue.add(e);
if( verbose ) {
- System.err.println("NEWT AWT RELEASED ["+pressed+"]: "+prefix+", "+e);
+ System.err.println("KEY NEWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
--
cgit v1.2.3
From 45952a0fa4c30e9fcd49414581e4c81688c50e48 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 19:30:06 +0200
Subject: TestFocus0[12]SwingAWTRobot: Fix Java7 'changed behavior': Relax
focus traversal validation checks.
- Remove Frame lost detection
- Allow to have NEWT and it's NewtCanvasAWT claiming to have the focus
---
make/scripts/tests-win.bat | 4 ++--
make/scripts/tests.sh | 4 ++--
.../opengl/test/junit/newt/TestFocus01SwingAWTRobot.java | 13 ++++++++-----
.../opengl/test/junit/newt/TestFocus02SwingAWTRobot.java | 16 ++++++++--------
4 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index f8cecf46b..954d1663d 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -72,7 +72,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventOrderAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT %*
-scripts\java-win.bat com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventAutoRepeatAWT %*
+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 $*
@@ -106,7 +106,7 @@ 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 %*
+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.nativewindow.TestRecursiveToolkitLockCORE
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 247cf9d2d..70139b6c1 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -476,10 +476,10 @@ function testawtswt() {
#
#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.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.TestNewtKeyEventAutoRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java
index 672a44154..78be14dc6 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java
@@ -127,8 +127,6 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
// Add the canvas to a frame, and make it all visible.
final JFrame frame1 = new JFrame("Swing AWT Parent Frame: "
+ glWindow1.getTitle());
- AWTFocusAdapter frame1FA = new AWTFocusAdapter("frame1");
- frame1.addFocusListener(frame1FA);
frame1.getContentPane().add(newtCanvasAWT, BorderLayout.CENTER);
final Button button = new Button("Click me ..");
AWTFocusAdapter buttonFA = new AWTFocusAdapter("Button");
@@ -168,7 +166,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
System.err.println("FOCUS AWT Button request");
EventCountAdapterUtil.reset(eventCountAdapters);
- AWTRobotUtil.assertRequestFocusAndWait(robot, button, button, buttonFA, frame1FA); // OSX sporadically button did not gain - major UI failure
+ AWTRobotUtil.assertRequestFocusAndWait(robot, button, button, buttonFA, null); // OSX sporadically button did not gain - major UI failure
Assert.assertEquals(false, glWindow1FA.focusGained());
Assert.assertEquals(false, newtCanvasAWTFA.focusGained());
System.err.println("FOCUS AWT Button sync");
@@ -183,8 +181,13 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
System.err.println("FOCUS NEWT Canvas/GLWindow request");
EventCountAdapterUtil.reset(eventCountAdapters);
AWTRobotUtil.assertRequestFocusAndWait(robot, newtCanvasAWT, newtCanvasAWT.getNEWTChild(), glWindow1FA, buttonFA); // OSX sporadically button did not loose - minor UI failure
- Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA,
- AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA));
+ // 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,
+ // 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());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java
index 5d0a0fbb5..a1f4221db 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java
@@ -157,8 +157,6 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
jPanel1.add(container1, BorderLayout.CENTER);
final JFrame jFrame1 = new JFrame("Swing Parent JFrame");
- AWTFocusAdapter jFrame1FA = new AWTFocusAdapter("JFrame1");
- jFrame1.addFocusListener(jFrame1FA);
// jFrame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame1.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // equivalent to Frame, use windowClosing event!
jFrame1.setContentPane(jPanel1);
@@ -188,7 +186,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
Thread.sleep(100); // allow event sync
System.err.println("FOCUS AWT Button Outer request");
EventCountAdapterUtil.reset(eventCountAdapters);
- AWTRobotUtil.assertRequestFocusAndWait(robot, buttonNorthOuter, buttonNorthOuter, buttonNorthOuterFA, jFrame1FA); // OSX sporadically buttonNorthOuter did not gain - major UI failure
+ AWTRobotUtil.assertRequestFocusAndWait(robot, buttonNorthOuter, buttonNorthOuter, buttonNorthOuterFA, null); // OSX sporadically buttonNorthOuter did not gain - major UI failure
Assert.assertEquals(false, glWindow1FA.focusGained());
Assert.assertEquals(false, newtCanvasAWTFA.focusGained());
Assert.assertEquals(false, buttonNorthInnerFA.focusGained());
@@ -206,7 +204,6 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
AWTRobotUtil.assertRequestFocusAndWait(robot, newtCanvasAWT, newtCanvasAWT.getNEWTChild(), glWindow1FA, buttonNorthOuterFA);
Assert.assertEquals(false, newtCanvasAWTFA.focusGained());
Assert.assertEquals(false, buttonNorthInnerFA.focusGained());
- Assert.assertEquals(false, jFrame1FA.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());
@@ -223,7 +220,6 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
AWTRobotUtil.assertRequestFocusAndWait(robot, buttonNorthInner, buttonNorthInner, buttonNorthInnerFA, glWindow1FA);
Assert.assertEquals(false, newtCanvasAWTFA.focusGained());
Assert.assertEquals(false, buttonNorthOuterFA.focusGained());
- Assert.assertEquals(false, jFrame1FA.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,
@@ -236,12 +232,16 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
System.err.println("FOCUS NEWT Canvas/GLWindow request");
EventCountAdapterUtil.reset(eventCountAdapters);
AWTRobotUtil.assertRequestFocusAndWait(robot, newtCanvasAWT, newtCanvasAWT.getNEWTChild(), glWindow1FA, buttonNorthInnerFA);
- Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA,
- AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA));
+ // 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,
+ // 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, newtCanvasAWTFA.focusGained());
Assert.assertEquals(false, buttonNorthOuterFA.focusGained());
- Assert.assertEquals(false, jFrame1FA.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());
--
cgit v1.2.3
From 415f5c29ffae7cf5a26737da38e31cb84b652539 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 24 Jun 2013 19:47:06 +0200
Subject: NEWT: Don't invoke external keyboardFocusHandler for auto-repeat keys
(NewtCanvasAWT, ..)
.. otherwise an auto repeated key would cause fast focus traversal, not intended.
---
make/scripts/tests-win.bat | 4 ++--
make/scripts/tests.sh | 4 ++--
src/newt/classes/com/jogamp/newt/Window.java | 6 +++++-
src/newt/classes/jogamp/newt/WindowImpl.java | 6 +++---
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index 954d1663d..ed0241035 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -87,7 +87,7 @@ 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 %*
+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 %*
@@ -106,7 +106,7 @@ 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 $*
-scripts\java-win.bat com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot %*
+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.nativewindow.TestRecursiveToolkitLockCORE
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 70139b6c1..c50877d78 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -476,7 +476,7 @@ function testawtswt() {
#
#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.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 $*
@@ -513,7 +513,7 @@ testawt com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot $*
#
#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.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 $*
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 0bebf330a..f63c03738 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -406,7 +406,11 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Sets a {@link KeyListener} allowing focus traversal with a covered window toolkit like AWT.
*
* The {@link KeyListener} methods are invoked prior to all other {@link KeyListener}'s
- * allowing to suppress the {@link KeyEvent} via the {@link InputEvent#consumedTag}.
+ * allowing to suppress the {@link KeyEvent} via the {@link InputEvent#consumedTag}
+ * and to perform focus traversal with a 3rd party toolkit.
+ *
+ *
+ * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events.
*
The following are a few examples of projects and products using
@@ -118,6 +134,20 @@
+
+ C3D's
+ product palette
+ includes C3D Studio and C3D Viewer.
+ C3D Studio
+ 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.
+ C3D Viewer
+ is the visualization tool for the 3D Model and related data. The user can either manually load 3D models and connect
+ them to data sources, or execute Studio designed rich clients ( timelines) Where 3D and related data are loaded,
+ linked and displayed for navigation and updates.
+
+
Processing is an open
@@ -129,6 +159,23 @@
domain. It uses JOGL for its hardware accelerated 3D rendering
support.
+
+
+
+
+ NASA World Wind
+ Java provides next-generation 3-D virtual globe technology for
+ applications written in the Java programming language. It supplies a
+ suite of open-source components that developers include in their own
+ applications, providing virtual globe functionality to any application
+ that can benefit from it. World Wind Java's components perform as well
+ as, or better than, any other known implementation and utilize the
+ OpenGL API for 3-D graphics via JOGL.
+ F-16 Flight Simulator
+ built using World Wind Java.
+
- C3D's
- product palette
- includes C3D Studio and C3D Viewer.
- C3D Studio
- 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.
- C3D Viewer
- is the visualization tool for the 3D Model and related data. The user can either manually load 3D models and connect
- them to data sources, or execute Studio designed rich clients ( timelines) Where 3D and related data are loaded,
- linked and displayed for navigation and updates.
+
+ Scilab 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.
@@ -176,32 +222,31 @@
-
- Scilab 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.
+ The
+ BioJava
+ is an open-source 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.
+ The RCSB Viewers suite 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 RCSB Protein Data Bank (Example) and
+ Epitode Database
+ (Example).
-
-
- OneStone® Pebbles are a new series of calculus visualization tools developed
- by Bright Ideas Software®.
- 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
- Curve Families and
- Surfaces of Revolution examples!
+
+
+ Jzy3d
+ 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.
@@ -227,21 +272,6 @@
-
-
-
- Jzy3d
- 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.
-
Volume Viewer
@@ -249,8 +279,35 @@
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.
+
+
+
+
+ OneStone® Pebbles are a new series of calculus visualization tools developed
+ by Bright Ideas Software®.
+ 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
+ Curve Families and
+ Surfaces of Revolution examples!
+
+
+
+
+ Impact 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.
+
+
Insparia was created to help people
@@ -316,6 +373,33 @@
Javadocs, wiki, forum, and more!
+
+
+
+ jspatial
+ 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.
+
+
+
+
+ GL Studio 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 F-16 Flight Simulator using NASA World Wind is demonstrated.
+
- Ticket to Ride
+ Ticket to Ride
and Memoir '44 are boardgames published by
Days of Wonder.
They also make digital versions of these games since 2006. These are available on all desktops computers (Windows, MacOS and Linux),
@@ -395,7 +476,7 @@
- Jake2 is a port
+ Jake2 is a port
of id Software's GPL'd Quake II engine from C to Java done by bytonic software.
Jake2 has been ported to the current JOGL version for desktop OpenGL and mobile OpenGL ES1 and ES2 use
@@ -435,19 +516,6 @@
- NASA World Wind
- Java provides next-generation 3-D virtual globe technology for
- applications written in the Java programming language. It supplies a
- suite of open-source components that developers include in their own
- applications, providing virtual globe functionality to any application
- that can benefit from it. World Wind Java's components perform as well
- as, or better than, any other known implementation and utilize the
- OpenGL API for 3-D graphics via JOGL. See WWJ Technical Lead Tom
- Gaskins' JavaOne
- 2007 presentation on World Wind Java and the DiSTI Corporation's
- F-16 flight simulator
- built using World Wind Java.
@@ -488,33 +556,6 @@
-
-
- The
- Molecular Biology Toolkit is a
- Java-based protein visualization and analysis toolkit. The toolkit
- provides classes for efficiently loading, managing and manipulating
- protein structure and sequence data. The MBT also provides a rich set
- of graphical 3D and 2D visualization components which can be easily
- "plugged together" to produce applications having sophisticated
- graphical user interfaces. Some MBT-based visualization tools are ProteinWorkshop (webstart
- demo), EpitopeViewer
- (webstart demo), and Sirius.
-
-
-
-
- Impact 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.
-
-
-
- The NetBeans OpenGL Pack provides an easy to use OpenGL development
- environment integrated into NetBeans. It supplies modules like an GLSL
- shader editor, hardware compiler/linker integration and tools for
- displaying hardware information. The pack ships ready to run JOGL (JSR
- 231) demo projects and all OpenGL samples of the OpenGL Programming
- Guide (also known as the Red Book).
-
@@ -599,7 +624,16 @@
characteristics, placement and motion; visualisation rendering and
interaction and statistic generation.
-
+
+
+
+
+ The NetBeans OpenGL Pack provides an easy to use OpenGL development
+ environment integrated into NetBeans. It supplies modules like an GLSL
+ shader editor, hardware compiler/linker integration and tools for
+ displaying hardware information. The pack ships ready to run JOGL (JSR
+ 231) demo projects and all OpenGL samples of the OpenGL Programming
+ Guide (also known as the Red Book).
@@ -634,35 +668,6 @@
-
-
-
- GL Studio 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 generated with GL Studio can be deployed using
- javax.swing.JPanel, java.awt.Canvas and JavaBeans. GL Studio uses
- OpenGL for rendering and GL Studio for Java uses the JOGL API.
-
-
-
-
-
- VLDocking is
- a set of Java components that helps the Swing developer to build
- applications with Docking capabilities, and even raise existing
- applications to higher standards. It supports docking via drag and
- drop, enhanced toolbars, closable tabs, and more. It fully supports
- heavyweight components such as JOGL's GLCanvas in a docking
- environment.
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index b0815a5a6..da531dd66 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -61,7 +61,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGe
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 %*
-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.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 %*
@@ -118,7 +118,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00bN
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01bNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01dNEWT %*
+scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01dNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02aNEWT %*
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 %*
diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat
index d0108fdf8..c8b1ef5b0 100755
--- a/make/scripts/tests-x64-dbg.bat
+++ b/make/scripts/tests-x64-dbg.bat
@@ -40,8 +40,8 @@ REM set D_ARGS="-Djogl.debug=all"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.windows.useWGLVersionOf5WGLGDIFuncSet"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch"
-REM set D_ARGS="-Dnewt.debug.Window"
-set D_ARGS="-Dnewt.debug.Window.KeyEvent"
+set D_ARGS="-Dnewt.debug.Window"
+REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
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"
@@ -54,6 +54,7 @@ REM set D_ARGS="-Dnewt.debug.Display" "-Dnewt.debug.EDT" "-Dnewt.debug.Window"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.debug.EDT" "-Djogl.debug.GLContext"
REM set D_ARGS="-Dnewt.debug.Screen" "-Dnewt.debug.EDT" "-Dnativewindow.debug=all"
REM set D_ARGS="-Dnewt.debug.Screen"
+REM set D_ARGS="-Dnewt.debug.Screen" "-Dnewt.debug.Window"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.test.Window.reparent.incompatible=true"
REM set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.java2d.opengl=true" "-Dsun.awt.noerasebackground=true"
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 2e741b353..640e6a01d 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -136,7 +136,7 @@ function jrun() {
#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.Window"
+ D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Dnewt.test.Screen.disableRandR13"
#D_ARGS="-Dnewt.test.Screen.disableScreenMode -Dnewt.debug.Screen"
#D_ARGS="-Dnewt.debug.Screen -Djogl.debug.Animator"
@@ -176,7 +176,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext"
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen"
#D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window"
- D_ARGS="-Dnewt.debug.Window.KeyEvent"
+ #D_ARGS="-Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Dnewt.debug.Window.MouseEvent"
#D_ARGS="-Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug=all"
@@ -285,7 +285,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NEWT $*
@@ -406,7 +406,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasA
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01bNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT $*
-#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01dNEWT $*
+testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01dNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02aNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02bNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.ManualScreenMode03aNEWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
index f431e099b..8846812e5 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
@@ -46,6 +46,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.UITestCase;
import java.util.List;
@@ -105,16 +106,16 @@ public class TestScreenMode01aNEWT extends UITestCase {
public void testScreenModeChange01() throws InterruptedException {
Thread.sleep(waitTimeShort);
- GLCapabilities caps = new GLCapabilities(glp);
+ final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
- Display display = NewtFactory.createDisplay(null); // local display
+ final Display display = NewtFactory.createDisplay(null); // local display
Assert.assertNotNull(display);
- Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ final Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
- Window window0 = createWindow(screen, caps, "win0", 0, 0, width, height);
+ final Window window0 = createWindow(screen, caps, "win0", 0, 0, width, height);
Assert.assertNotNull(window0);
- List allMonitorModes = screen.getMonitorModes();
+ final List allMonitorModes = screen.getMonitorModes();
Assert.assertTrue(allMonitorModes.size()>0);
if(allMonitorModes.size()==1) {
// no support ..
@@ -123,7 +124,7 @@ public class TestScreenMode01aNEWT extends UITestCase {
return;
}
- MonitorDevice monitor = window0.getMainMonitor();
+ final MonitorDevice monitor = screen.getMonitorDevices().get(0);
List monitorModes = monitor.getSupportedModes();
Assert.assertTrue(monitorModes.size()>0);
@@ -135,13 +136,13 @@ public class TestScreenMode01aNEWT extends UITestCase {
}
Assert.assertTrue(allMonitorModes.containsAll(monitorModes));
- MonitorMode mmCurrent = monitor.queryCurrentMode();
- Assert.assertNotNull(mmCurrent);
- MonitorMode mmOrig = monitor.getOriginalMode();
+ final MonitorMode mmSet0 = monitor.queryCurrentMode();
+ Assert.assertNotNull(mmSet0);
+ final MonitorMode mmOrig = monitor.getOriginalMode();
Assert.assertNotNull(mmOrig);
System.err.println("[0] orig : "+mmOrig);
- System.err.println("[0] current: "+mmCurrent);
- Assert.assertEquals(mmCurrent, mmOrig);
+ System.err.println("[0] current: "+mmSet0);
+ Assert.assertEquals(mmSet0, mmOrig);
monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc
@@ -171,44 +172,43 @@ public class TestScreenMode01aNEWT extends UITestCase {
Thread.sleep(waitTimeShort);
- // check manual reset ..
-
Assert.assertEquals(true,display.isNativeValid());
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window0.isNativeValid());
Assert.assertEquals(true,window0.isVisible());
- screen.addReference(); // keep it alive !
- Assert.assertTrue(monitor.setCurrentMode(mmOrig));
- Assert.assertFalse(monitor.isModeChangedByUs());
- Assert.assertEquals(mmOrig, monitor.getCurrentMode());
- Assert.assertNotSame(mm, monitor.getCurrentMode());
- Assert.assertEquals(mmOrig, monitor.queryCurrentMode());
-
+ // Auto reset by destruction!
destroyWindow(window0);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window0, false));
+
Assert.assertEquals(false,window0.isVisible());
Assert.assertEquals(false,window0.isNativeValid());
- Assert.assertEquals(true,screen.isNativeValid()); // alive !
- Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertEquals(false,screen.isNativeValid());
+ Assert.assertEquals(false,display.isNativeValid());
Thread.sleep(waitTimeShort);
-
- Window window1 = createWindow(screen, caps, "win1",
- width+window0.getInsets().getTotalWidth(), 0,
- width, height);
- Assert.assertNotNull(window1);
- Assert.assertEquals(true,window1.isNativeValid());
- Assert.assertEquals(true,window1.isVisible());
- Thread.sleep(waitTimeShort);
+ validateScreenModeReset(mmOrig, 0);
+ }
+
+ void validateScreenModeReset(final MonitorMode mmOrig, int mmIdx) {
+ final Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ final Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+ Assert.assertEquals(false,display.isNativeValid());
+ Assert.assertEquals(false,screen.isNativeValid());
+ screen.addReference();
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertEquals(true,screen.isNativeValid());
- destroyWindow(window1);
- Assert.assertEquals(false,window1.isNativeValid());
- Assert.assertEquals(false,window1.isVisible());
+ final MonitorDevice monitor = screen.getMonitorDevices().get(0);
+ Assert.assertEquals(mmOrig, monitor.getCurrentMode());
screen.removeReference();
+ Assert.assertEquals(false,display.isNativeValid());
Assert.assertEquals(false,screen.isNativeValid());
- Assert.assertEquals(false,display.isNativeValid());
}
public static void main(String args[]) throws IOException {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
index c80760c1f..fbd08b619 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
@@ -46,6 +46,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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;
import com.jogamp.opengl.util.Animator;
@@ -230,6 +231,8 @@ public class TestScreenMode01bNEWT extends UITestCase {
Thread.sleep(duration);
anim.stop();
destroyWindow(window0);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window0, false));
+
Assert.assertEquals(false,window0.isVisible());
Assert.assertEquals(false,window0.isNativeValid());
Assert.assertEquals(true,display.isNativeValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
index 48ebaf86e..afb26d75c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
@@ -53,11 +53,17 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import java.util.List;
import javax.media.nativewindow.util.Dimension;
+import javax.media.nativewindow.util.Rectangle;
+import javax.media.nativewindow.util.RectangleImmutable;
/**
* Demonstrates fullscreen without MonitorMode change
* and fullscreen before and after MonitorMode change.
*
+ * Also tests MonitorMode reset, by destroying the last Screen (reference),
+ * i.e. the original MonitorMode should get reinstated!
+ *
+ *
* Also documents NV RANDR/GL bug, see {@link TestScreenMode01dNEWT#cleanupGL()}.