aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java65
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java144
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java145
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java16
9 files changed, 196 insertions, 200 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 c179aad66..b4661e43d 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
@@ -73,7 +73,6 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
private FloatBuffer gear1Color=GearsObject.red, gear2Color=GearsObject.green, gear3Color=GearsObject.blue;
private float angle = 0.0f;
private int swapInterval = 0;
- private boolean pmvUseBackingArray = true; // the default for PMVMatrix now, since it's faster
// private MouseListener gearsMouse = new TraceMouseAdapter(new GearsMouseAdapter());
public MouseListener gearsMouse = new GearsMouseAdapter();
public KeyListener gearsKeys = new GearsKeyAdapter();
@@ -124,10 +123,6 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
public void setVerbose(boolean v) { verbose = v; }
public void setFlipVerticalInGLOrientation(boolean v) { flipVerticalInGLOrientation=v; }
- public void setPMVUseBackingArray(boolean pmvUseBackingArray) {
- this.pmvUseBackingArray = pmvUseBackingArray;
- }
-
/** float[4] */
public void setClearColor(float[] clearColor) {
this.clearColor = clearColor;
@@ -224,7 +219,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
- pmvMatrix = new PMVMatrix(pmvUseBackingArray);
+ pmvMatrix = new PMVMatrix();
st.attachObject("pmvMatrix", pmvMatrix);
pmvMatrixUniform = new GLUniformData("pmvMatrix", 4, 4, pmvMatrix.glGetPMvMvitMatrixf()); // P, Mv, Mvi and Mvit
st.ownUniform(pmvMatrixUniform);
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 f2fdcb351..db219b116 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
@@ -89,7 +89,6 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean undecorated = false;
static boolean alwaysOnTop = false;
static boolean fullscreen = false;
- static boolean pmvUseBackingArray = true;
static int swapInterval = 1;
static boolean waitForKey = false;
static boolean mouseVisible = true;
@@ -146,7 +145,6 @@ public class TestGearsES2NEWT extends UITestCase {
glWindow.confinePointer(mouseConfined);
final GearsES2 demo = new GearsES2(swapInterval);
- demo.setPMVUseBackingArray(pmvUseBackingArray);
demo.setUseMappedBuffers(useMappedBuffers);
demo.setValidateBuffers(true);
glWindow.addGLEventListener(demo);
@@ -584,8 +582,6 @@ public class TestGearsES2NEWT extends UITestCase {
alwaysOnTop = true;
} else if(args[i].equals("-fullscreen")) {
fullscreen = true;
- } else if(args[i].equals("-pmvDirect")) {
- pmvUseBackingArray = false;
} else if(args[i].equals("-vsync")) {
i++;
swapInterval = MiscUtils.atoi(args[i], swapInterval);
@@ -670,7 +666,6 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("undecorated "+undecorated);
System.err.println("atop "+alwaysOnTop);
System.err.println("fullscreen "+fullscreen);
- System.err.println("pmvDirect "+(!pmvUseBackingArray));
System.err.println("mouseVisible "+mouseVisible);
System.err.println("mouseConfined "+mouseConfined);
System.err.println("pointerIcon "+setPointerIcon);
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 08c81c59e..e4ba5f855 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
@@ -91,7 +91,6 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
static boolean opaque = true;
static int forceAlpha = -1;
static boolean fullscreen = false;
- static boolean pmvUseBackingArray = true;
static int swapInterval = 1;
static boolean showFPS = false;
static int loops = 1;
@@ -260,7 +259,6 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
}
final GearsES2 demo = new GearsES2(swapInterval);
- demo.setPMVUseBackingArray(pmvUseBackingArray);
glWindow.addGLEventListener(demo);
frame.addComponentListener(new ComponentListener() {
@@ -473,8 +471,6 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
forceAlpha = MiscUtils.atoi(args[i], 0);
} else if(args[i].equals("-fullscreen")) {
fullscreen = true;
- } else if(args[i].equals("-pmvDirect")) {
- pmvUseBackingArray = false;
} else if(args[i].equals("-vsync")) {
i++;
swapInterval = MiscUtils.atoi(args[i], swapInterval);
@@ -539,7 +535,6 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
System.err.println("translucent "+(!opaque));
System.err.println("forceAlpha "+forceAlpha);
System.err.println("fullscreen "+fullscreen);
- System.err.println("pmvDirect "+(!pmvUseBackingArray));
System.err.println("loops "+loops);
System.err.println("loop shutdown "+loop_shutdown);
System.err.println("shallUseOffscreenFBOLayer "+shallUseOffscreenFBOLayer);
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 d04846c2a..c667adaba 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
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
import java.io.IOException;
@@ -73,7 +73,7 @@ import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestGearsES2NewtCanvasSWT extends UITestCase {
+public class TestGearsES2NewtCanvasSWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
static DimensionImmutable wsize, rwsize = null;
@@ -82,7 +82,6 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
static boolean opaque = true;
static int forceAlpha = -1;
static boolean fullscreen = false;
- static boolean pmvUseBackingArray = true;
static int swapInterval = 1;
static boolean showFPS = false;
static int loops = 1;
@@ -91,7 +90,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
static boolean forceGL3 = false;
static boolean mainRun = false;
static boolean exclusiveContext = false;
-
+
@BeforeClass
public static void initClass() {
if(null == wsize) {
@@ -107,16 +106,16 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
Shell shell = null;
Composite composite = null;
com.jogamp.newt.Display swtNewtDisplay = null;
-
+
@Before
public void init() {
SWTAccessor.invoke(true, new Runnable() {
- public void run() {
+ public void run() {
display = new Display();
Assert.assertNotNull( display );
}});
display.syncExec(new Runnable() {
- public void run() {
+ public void run() {
shell = new Shell( display );
Assert.assertNotNull( shell );
shell.setLayout( new FillLayout() );
@@ -152,21 +151,20 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
shell = null;
composite = null;
}
-
+
protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException {
System.err.println("requested: vsync "+swapInterval+", "+caps);
com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx);
final GLWindow glWindow = GLWindow.create(screen, caps);
Assert.assertNotNull(glWindow);
-
+
final GearsES2 demo = new GearsES2(swapInterval);
- demo.setPMVUseBackingArray(pmvUseBackingArray);
glWindow.addGLEventListener(demo);
-
+
Animator animator = new Animator();
animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
animator.setExclusiveContext(exclusiveContext);
-
+
QuitAdapter quitAdapter = new QuitAdapter();
//glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
//glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
@@ -179,14 +177,14 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
}
public void windowMoved(WindowEvent e) {
System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
- }
+ }
});
-
+
glWindow.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
- }
+ }
if(e.getKeyChar()=='f') {
new Thread() {
public void run() {
@@ -219,13 +217,13 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
shell.open();
}
});
-
+
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
-
+
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
-
+
if( null != rwsize ) {
for(int i=0; i<50; i++) { // 500 ms dispatched delay
if( !display.readAndDispatch() ) {
@@ -240,7 +238,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
});
System.err.println("window resize pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
}
-
+
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
if( !display.readAndDispatch() ) {
// blocks on linux .. display.sleep();
@@ -253,7 +251,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
Assert.assertFalse(animator.isAnimating());
Assert.assertFalse(animator.isStarted());
Assert.assertEquals(null, glWindow.getExclusiveContextThread());
-
+
canvas1.dispose();
glWindow.destroy();
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
@@ -274,7 +272,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities( glp );
caps.setBackgroundOpaque(opaque);
if(-1 < forceAlpha) {
- caps.setAlphaBits(forceAlpha);
+ caps.setAlphaBits(forceAlpha);
}
runTestGL(caps);
if(loop_shutdown) {
@@ -286,7 +284,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
@Test
public void test02GL3() throws InterruptedException, InvocationTargetException {
if(mainRun) return;
-
+
if( !GLProfile.isAvailable(GLProfile.GL3) ) {
System.err.println("GL3 n/a");
return;
@@ -295,13 +293,13 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities( glp );
runTestGL(caps);
}
-
+
public static void main(String args[]) throws IOException {
mainRun = true;
-
+
int x=0, y=0, w=640, h=480, rw=-1, rh=-1;
boolean usePos = false;
-
+
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
@@ -313,8 +311,6 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
forceAlpha = MiscUtils.atoi(args[i], 0);
} else if(args[i].equals("-fullscreen")) {
fullscreen = true;
- } else if(args[i].equals("-pmvDirect")) {
- pmvUseBackingArray = false;
} else if(args[i].equals("-vsync")) {
i++;
swapInterval = MiscUtils.atoi(args[i], swapInterval);
@@ -360,18 +356,17 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
if( 0 < rw && 0 < rh ) {
rwsize = new Dimension(rw, rh);
}
-
+
if(usePos) {
wpos = new Point(x, y);
}
System.err.println("position "+wpos);
System.err.println("size "+wsize);
- System.err.println("resize "+rwsize);
+ System.err.println("resize "+rwsize);
System.err.println("screen "+screenIdx);
System.err.println("translucent "+(!opaque));
- System.err.println("forceAlpha "+forceAlpha);
+ System.err.println("forceAlpha "+forceAlpha);
System.err.println("fullscreen "+fullscreen);
- System.err.println("pmvDirect "+(!pmvUseBackingArray));
System.err.println("loops "+loops);
System.err.println("loop shutdown "+loop_shutdown);
System.err.println("forceES2 "+forceES2);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
index 79a2911c9..b1a4793ff 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
@@ -74,7 +74,6 @@ public class TestGearsES2SWT extends UITestCase {
static boolean opaque = true;
static int forceAlpha = -1;
static boolean fullscreen = false;
- static boolean pmvUseBackingArray = true;
static int swapInterval = 1;
static boolean showFPS = false;
static int loops = 1;
@@ -149,7 +148,6 @@ public class TestGearsES2SWT extends UITestCase {
Assert.assertNotNull( canvas );
final GearsES2 demo = new GearsES2(swapInterval);
- demo.setPMVUseBackingArray(pmvUseBackingArray);
canvas.addGLEventListener(demo);
Animator animator = new Animator();
@@ -273,8 +271,6 @@ public class TestGearsES2SWT extends UITestCase {
forceAlpha = MiscUtils.atoi(args[i], 0);
} else if(args[i].equals("-fullscreen")) {
fullscreen = true;
- } else if(args[i].equals("-pmvDirect")) {
- pmvUseBackingArray = false;
} else if(args[i].equals("-vsync")) {
i++;
swapInterval = MiscUtils.atoi(args[i], swapInterval);
@@ -331,7 +327,6 @@ public class TestGearsES2SWT extends UITestCase {
System.err.println("translucent "+(!opaque));
System.err.println("forceAlpha "+forceAlpha);
System.err.println("fullscreen "+fullscreen);
- System.err.println("pmvDirect "+(!pmvUseBackingArray));
System.err.println("loops "+loops);
System.err.println("loop shutdown "+loop_shutdown);
System.err.println("forceES2 "+forceES2);
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
index 3f22fec2b..ca8461d6a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java
@@ -75,7 +75,7 @@ public class TestFloatUtil01MatrixMatrixMultNOUI {
float[] r = new float[16];
- FloatUtil.multMatrixf(m1, 0, m2, 0, r, 0);
+ FloatUtil.multMatrix(m1, 0, m2, 0, r, 0);
Assert.assertArrayEquals(m2xm1_RM, r, 0f);
}
@@ -85,7 +85,7 @@ public class TestFloatUtil01MatrixMatrixMultNOUI {
float[] r = new float[16];
- FloatUtil.multMatrixf(m2, 0, m1, 0, r, 0);
+ FloatUtil.multMatrix(m2, 0, m1, 0, r, 0);
Assert.assertArrayEquals(m1xm2_RM, r, 0f);
}
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
index fa18abd6e..464a43ac8 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.jogl.math;
import java.nio.FloatBuffer;
@@ -54,45 +54,45 @@ import com.jogamp.opengl.util.PMVMatrix;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
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,
+ 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,
+ 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,
@@ -115,7 +115,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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: ");
@@ -125,7 +125,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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: ");
@@ -134,9 +134,9 @@ public class TestPMVMatrix01NEWT extends UITestCase {
System.err.println("FLU-C-O 3x2: ");
System.err.println(s3x2Cflu);
System.err.println();
- Assert.assertEquals(s3x2Cflu, s3x2Rflu);
+ Assert.assertEquals(s3x2Cflu, s3x2Rflu);
}
-
+
/**
* Test using traditional access workflow, i.e. 1) operation 2) get-matrix references
* <p>
@@ -149,13 +149,13 @@ public class TestPMVMatrix01NEWT extends UITestCase {
FloatBuffer p, mv, mvi, mvit;
Frustum frustum;
boolean b;
- final PMVMatrix pmv = new PMVMatrix(true);
+ final PMVMatrix pmv = new PMVMatrix();
// 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
//
@@ -164,15 +164,15 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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
//
@@ -182,36 +182,36 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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.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);
+ 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());
+ 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());
//
@@ -223,22 +223,22 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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.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.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
* <p>
@@ -251,13 +251,13 @@ public class TestPMVMatrix01NEWT extends UITestCase {
final FloatBuffer p, mv, mvi, mvit;
Frustum frustum;
boolean b;
- final PMVMatrix pmv = new PMVMatrix(true);
+ final PMVMatrix pmv = new PMVMatrix();
// 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
//
@@ -266,17 +266,17 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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
//
@@ -286,14 +286,14 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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);
+ 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);
+ 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());
@@ -301,7 +301,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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
//
@@ -316,28 +316,28 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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);
+
+ 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());
+ // System.err.println("P2: "+pmv.toString());
}
-
+
@SuppressWarnings("unused")
@Test
public void test03MvTranslate() {
final FloatBuffer pmvMv, pmvMvi, pmvMvit;
{
- final PMVMatrix pmv = new PMVMatrix(true);
+ final PMVMatrix pmv = new PMVMatrix();
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();
@@ -351,32 +351,32 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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));
+ // 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);
+ final PMVMatrix pmv = new PMVMatrix();
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();
@@ -391,21 +391,21 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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));
+ // System.err.println("pmvMvit: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvit));
}
-
+
static DrawableContext dc;
-
+
@BeforeClass
public static void setup() throws Throwable {
try {
@@ -420,7 +420,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
public static void cleanup() {
destroyDrawableContext(dc);
}
-
+
static class DrawableContext {
DrawableContext(GLDrawable d, GLContext glc) {
this.d = d;
@@ -429,7 +429,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
GLDrawable d;
GLContext glc;
}
-
+
private static DrawableContext createOffscreenDrawableAndCurrentFFPContext() throws Throwable {
GLProfile glp = GLProfile.getMaxFixedFunc(true);
GLCapabilities glCaps = new GLCapabilities(glp);
@@ -451,7 +451,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
throw t;
}
}
-
+
private static void destroyDrawableContext(DrawableContext dc) {
if(null != dc.glc) {
dc.glc.destroy();
@@ -462,7 +462,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
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/TestPMVMatrix03NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java
index df149169a..d832dbadf 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java
@@ -16,77 +16,98 @@ import org.junit.runners.MethodSorters;
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();
-
+ final float[] vec4Tmp1 = new float[4];
+ final float[] vec4Tmp2 = new float[4];
+
+ final float[] winA00 = new float[4];
+ final float[] winA01 = new float[4];
+ final float[] winA10 = new float[4];
+ final float[] winA11 = new float[4];
+ final float[] winB00 = new float[4];
+ final float[] winB01 = new float[4];
+ final float[] winB10 = new float[4];
+ final float[] winB11 = new float[4];
+
+ final PMVMatrix m = new PMVMatrix();
+ final float[] mat4PMv = new float[16];
+ m.multPMvMatrixf(mat4PMv, 0);
+ System.err.println(FloatUtil.matrixToString(null, "mat4PMv", "%10.5f", mat4PMv, 0, 4, 4, false /* rowMajorOrder */));
+
m.gluProject(1f, 0f, 0f, viewport, 0, winA00, 0);
- System.out.println("A.0.0 - Project 1,0 -->" + Arrays.toString(winA00));
-
+ System.err.println("A.0.0 - Project 1,0 -->" + Arrays.toString(winA00));
+ FloatUtil.mapObjToWinCoords(1f, 0f, 0f, mat4PMv, viewport, 0, winB00, 0, vec4Tmp1, vec4Tmp2);
+ System.err.println("B.0.0 - Project 1,0 -->" + Arrays.toString(winB00));
+
m.gluProject(0f, 0f, 0f, viewport, 0, winA01, 0);
- System.out.println("A.0.1 - Project 0,0 -->" + Arrays.toString(winA01));
-
+ System.err.println("A.0.1 - Project 0,0 -->" + Arrays.toString(winA01));
+ FloatUtil.mapObjToWinCoords(0f, 0f, 0f, mat4PMv, viewport, 0, winB01, 0, vec4Tmp1, vec4Tmp2);
+ System.err.println("B.0.1 - Project 0,0 -->" + Arrays.toString(winB01));
+
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);
-
+ System.err.println("MATRIX - Ortho 0,0,10,10 - Locate the origin in the bottom left and scale");
+ System.err.println(m);
+ m.multPMvMatrixf(mat4PMv, 0);
+ System.err.println(FloatUtil.matrixToString(null, "mat4PMv", "%10.5f", mat4PMv, 0, 4, 4, false /* rowMajorOrder */));
+
m.gluProject(1f, 0f, 0f, viewport, 0, winA10, 0);
- System.out.println("A.1.0 - Project 1,0 -->" +Arrays.toString(winA10));
-
+ System.err.println("A.1.0 - Project 1,0 -->" +Arrays.toString(winA10));
+ FloatUtil.mapObjToWinCoords(1f, 0f, 0f, mat4PMv, viewport, 0, winB10, 0, vec4Tmp1, vec4Tmp2);
+ System.err.println("B.1.0 - Project 1,0 -->" +Arrays.toString(winB10));
+
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));
-
+ System.err.println("A.1.1 - Project 0,0 -->" +Arrays.toString(winA11));
+ FloatUtil.mapObjToWinCoords(0f, 0f, 0f, mat4PMv, viewport, 0, winB11, 0, vec4Tmp1, vec4Tmp2);
+ System.err.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);
-
+
+ ////////////////////
+ /////////////////////
+
+ float[] winC00 = new float[4];
+ float[] winC01 = new float[4];
+ float[] winC10 = new float[4];
+ float[] winC11 = new float[4];
+ float[] projMatrixC = new float[16];
+ float[] modelMatrixC = new float[16];
+ FloatUtil.makeIdentity(projMatrixC);
+ FloatUtil.makeIdentity(modelMatrixC);
+ final ProjectFloat projectFloat = new ProjectFloat();
+
+ projectFloat.gluProject(1f, 0f, 0f, modelMatrixC, 0, projMatrixC, 0, viewport, 0, winC00, 0);
+ System.err.println("C.0.0 - Project 1,0 -->" +Arrays.toString(winC00));
+
+ projectFloat.gluProject(0f, 0f, 0f, modelMatrixC, 0, projMatrixC, 0, viewport, 0, winC01, 0);
+ System.err.println("C.0.1 - Project 0,0 -->" +Arrays.toString(winC01));
+
+ glOrthof(projMatrixC, 0, 10, 0, 10, 1, -1);
+ System.err.println("FloatUtil - Ortho 0,0,10,10 - Locate the origin in the bottom left and scale");
+ System.err.println("Projection");
+ System.err.println(FloatUtil.matrixToString(null, null, "%10.5f", projMatrixC, 0, 4, 4, false /* rowMajorOrder */));
+ System.err.println("Modelview");
+ System.err.println(FloatUtil.matrixToString(null, null, "%10.5f", modelMatrixC, 0, 4, 4, false /* rowMajorOrder */));
+
+ projectFloat.gluProject(1f, 0f, 0f, modelMatrixC, 0, projMatrixC, 0, viewport, 0, winC10, 0);
+ System.err.println("C.1.0 - Project 1,0 -->" +Arrays.toString(winC10));
+
+ projectFloat.gluProject(0f, 0f, 0f, modelMatrixC, 0, projMatrixC, 0, viewport, 0, winC11, 0);
+ System.err.println("B.1.1 - Project 0,0 -->" +Arrays.toString(winC11));
+
+ Assert.assertArrayEquals("A/C 0.0 Project 1,0 failure", winC00, winA00, epsilon);
+ Assert.assertArrayEquals("A/C 0.1 Project 0,0 failure", winC01, winA01, epsilon);
+ Assert.assertArrayEquals("A/C 1.0 Project 1,0 failure", winC10, winA10, epsilon);
+ Assert.assertArrayEquals("A/C 1.1 Project 0,0 failure", winC11, 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);
@@ -96,9 +117,9 @@ public class TestPMVMatrix03NOUI {
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:
+ // Ortho matrix:
// 2/dx 0 0 tx
// 0 2/dy 0 ty
// 0 0 2/dz tz
@@ -111,7 +132,7 @@ public class TestPMVMatrix03NOUI {
final float tz=-1.0f*(zFar+zNear)/dz;
float[] matrixOrtho = new float[16];
- FloatUtil.makeIdentityf(matrixOrtho, 0);
+ FloatUtil.makeIdentity(matrixOrtho);
matrixOrtho[0+4*0] = 2.0f/dx;
matrixOrtho[1+4*1] = 2.0f/dy;
matrixOrtho[2+4*2] = -2.0f/dz;
@@ -119,9 +140,9 @@ public class TestPMVMatrix03NOUI {
matrixOrtho[1+4*3] = ty;
matrixOrtho[2+4*3] = tz;
- FloatUtil.multMatrixf(m, 0, matrixOrtho, 0);
+ FloatUtil.multMatrix(m, 0, matrixOrtho, 0);
}
-
+
public static void main(String args[]) {
org.junit.runner.JUnitCore.main(TestPMVMatrix03NOUI.class.getName());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
index 97f316cfc..6881dab8f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
@@ -254,7 +254,7 @@ public class TestQuaternion01NOUI {
//
// IDENTITY CHECK
//
- FloatUtil.makeIdentityf(mat1, 0);
+ FloatUtil.makeIdentity(mat1);
quat.set(0, 0, 0, 0);
quat.toMatrix(mat2, 0);
Assert.assertArrayEquals(mat1, mat2, FloatUtil.EPSILON);
@@ -291,7 +291,7 @@ public class TestQuaternion01NOUI {
Assert.assertArrayEquals(mat1, mat2, FloatUtil.EPSILON);
quat.rotateVector(vecHas, 0, NEG_ONE, 0);
- FloatUtil.multMatrixVecf(mat2, NEG_ONE_v4, vecOut2);
+ FloatUtil.multMatrixVec(mat2, NEG_ONE_v4, vecOut2);
Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
//
@@ -325,7 +325,7 @@ public class TestQuaternion01NOUI {
Assert.assertArrayEquals(mat1, mat2, FloatUtil.EPSILON);
quat.rotateVector(vecHas, 0, ONE, 0);
- FloatUtil.multMatrixVecf(mat2, ONE_v4, vecOut2);
+ FloatUtil.multMatrixVec(mat2, ONE_v4, vecOut2);
Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
//
@@ -359,7 +359,7 @@ public class TestQuaternion01NOUI {
Assert.assertArrayEquals(mat1, mat2, FloatUtil.EPSILON);
quat.rotateVector(vecHas, 0, NEG_ONE, 0);
- FloatUtil.multMatrixVecf(mat2, NEG_ONE_v4, vecOut2);
+ FloatUtil.multMatrixVec(mat2, NEG_ONE_v4, vecOut2);
Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
//
@@ -393,7 +393,7 @@ public class TestQuaternion01NOUI {
Assert.assertArrayEquals(mat1, mat2, FloatUtil.EPSILON);
quat.rotateVector(vecHas, 0, ONE, 0);
- FloatUtil.multMatrixVecf(mat2, ONE_v4, vecOut2);
+ FloatUtil.multMatrixVec(mat2, ONE_v4, vecOut2);
Assert.assertEquals( 0f, Math.abs( VectorUtil.distVec3(vecHas, vecOut2) ), Quaternion.ALLOWED_DEVIANCE );
//
@@ -436,7 +436,7 @@ public class TestQuaternion01NOUI {
public void test15aAxesAndMatrix() {
final float[] eulerExp = new float[] { 0f, FloatUtil.HALF_PI, 0f };
final float[] matExp = new float[4*4];
- FloatUtil.makeRotationEuler(eulerExp[0], eulerExp[1], eulerExp[2], matExp, 0); // 45 degr on X, 90 degr on Y
+ FloatUtil.makeRotationEuler(matExp, 0, eulerExp[0], eulerExp[1], eulerExp[2]); // 45 degr on X, 90 degr on Y
final float[] matHas = new float[4*4];
final Quaternion quat1 = new Quaternion();
@@ -465,7 +465,7 @@ public class TestQuaternion01NOUI {
public void test15bAxesAndMatrix() {
final float[] eulerExp = new float[] { FloatUtil.HALF_PI, 0f, 0f };
final float[] matExp = new float[4*4];
- FloatUtil.makeRotationEuler(eulerExp[0], eulerExp[1], eulerExp[2], matExp, 0); // 45 degr on X, 90 degr on Y
+ FloatUtil.makeRotationEuler(matExp, 0, eulerExp[0], eulerExp[1], eulerExp[2]); // 45 degr on X, 90 degr on Y
final float[] matHas = new float[4*4];
final Quaternion quat1 = new Quaternion();
@@ -494,7 +494,7 @@ public class TestQuaternion01NOUI {
public void test15cAxesAndMatrix() {
final float[] eulerExp = new float[] { FloatUtil.QUARTER_PI, FloatUtil.HALF_PI, 0f };
final float[] matExp = new float[4*4];
- FloatUtil.makeRotationEuler(eulerExp[0], eulerExp[1], eulerExp[2], matExp, 0); // 45 degr on X, 90 degr on Y
+ FloatUtil.makeRotationEuler(matExp, 0, eulerExp[0], eulerExp[1], eulerExp[2]); // 45 degr on X, 90 degr on Y
final float[] matHas = new float[4*4];
final Quaternion quat1 = new Quaternion();