aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java47
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java41
2 files changed, 71 insertions, 17 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
index 6221a1029..728b040af 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
@@ -107,7 +107,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
} } ) ;
if( useAnimator ) {
- animator.setUpdateFPSFrames(1, null);
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
Assert.assertEquals(true, animator.isAnimating());
}
@@ -117,13 +117,18 @@ public class TestGearsGLJPanelAWT extends UITestCase {
new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel);
new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
- snap.setMakeSnapshot();
-
final long t0 = System.currentTimeMillis();
long t1 = t0;
+ boolean triggerSnap = false;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
Thread.sleep(100);
t1 = System.currentTimeMillis();
+ snap.getDisplayCount();
+ if( !triggerSnap && snap.getDisplayCount() > 1 ) {
+ // Snapshot only after one frame has been rendered to suite FBO MSAA!
+ snap.setMakeSnapshot();
+ triggerSnap = true;
+ }
}
Assert.assertNotNull(frame);
@@ -145,7 +150,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
}
@Test
- public void test01_default()
+ public void test01_DefaultNorm()
throws AWTException, InterruptedException, InvocationTargetException
{
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
@@ -163,7 +168,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
}
@Test
- public void test02_msaa()
+ public void test02_DefaultMsaa()
throws AWTException, InterruptedException, InvocationTargetException
{
if( manualTest ) {
@@ -176,25 +181,53 @@ public class TestGearsGLJPanelAWT extends UITestCase {
}
@Test
- public void test03_pbuffer()
+ public void test03_PbufferNorm()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( manualTest ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ caps.setPBuffer(true);
+ runTestGL(caps);
+ }
+
+ @Test
+ public void test04_PbufferMsaa()
throws AWTException, InterruptedException, InvocationTargetException
{
if( manualTest ) {
return;
}
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ caps.setNumSamples(4);
+ caps.setSampleBuffers(true);
caps.setPBuffer(true);
runTestGL(caps);
}
@Test
- public void test04_bitmap()
+ public void test05_BitmapNorm()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( manualTest ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ caps.setBitmap(true);
+ runTestGL(caps);
+ }
+
+ @Test
+ public void test06_BitmapMsaa()
throws AWTException, InterruptedException, InvocationTargetException
{
if( manualTest ) {
return;
}
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ caps.setNumSamples(4);
+ caps.setSampleBuffers(true);
caps.setBitmap(true);
runTestGL(caps);
}
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 743d682c8..7b53d973c 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
@@ -17,22 +17,43 @@ public class TestPNGImage01NEWT extends UITestCase {
public void testPNGReadWriteAndCompare() throws InterruptedException, IOException, MalformedURLException {
final File out1_f=new File(getSimpleTestName(".")+"-PNGImageTest1.png");
final File out2_f=new File(getSimpleTestName(".")+"-PNGImageTest2.png");
+ final File out2F_f=new File(getSimpleTestName(".")+"-PNGImageTest2Flipped.png");
+ final File out2R_f=new File(getSimpleTestName(".")+"-PNGImageTest2Reversed.png");
+ final File out2RF_f=new File(getSimpleTestName(".")+"-PNGImageTest2ReversedFlipped.png");
final String url_s="jogl/util/data/av/test-ntsc01-160x90.png";
URLConnection urlConn = IOUtil.getResource(url_s, this.getClass().getClassLoader());
- PNGImage image0 = PNGImage.read(urlConn.getInputStream());
- System.err.println("PNGImage - Orig: "+image0);
- image0.write(out1_f, true);
+ PNGImage image1 = PNGImage.read(urlConn.getInputStream());
+ System.err.println("PNGImage - Orig: "+image1);
+ image1.write(out1_f, true);
{
- Assert.assertEquals(image0.getData(), PNGImage.read(IOUtil.toURL(out1_f).openStream()).getData());
+ Assert.assertEquals(image1.getData(), PNGImage.read(IOUtil.toURL(out1_f).openStream()).getData());
}
- final PNGImage image1 = PNGImage.createFromData(image0.getWidth(), image0.getHeight(),
- image0.getDpi()[0], image0.getDpi()[1],
- image0.getBytesPerPixel(), false, image0.getData());
- image1.write(out2_f, true);
+ final PNGImage image2 = PNGImage.createFromData(image1.getWidth(), image1.getHeight(),
+ image1.getDpi()[0], image1.getDpi()[1],
+ image1.getBytesPerPixel(), false /* reverseChannels */, image1.isGLOriented(), image1.getData());
+ image2.write(out2_f, true);
{
- Assert.assertEquals(image0.getData(), PNGImage.read(IOUtil.toURL(out2_f).openStream()).getData());
- }
+ Assert.assertEquals(image1.getData(), PNGImage.read(IOUtil.toURL(out2_f).openStream()).getData());
+ }
+
+ // flipped
+ final PNGImage image2F = PNGImage.createFromData(image1.getWidth(), image1.getHeight(),
+ image1.getDpi()[0], image1.getDpi()[1],
+ image1.getBytesPerPixel(), false /* reverseChannels */, !image1.isGLOriented(), image1.getData());
+ image2F.write(out2F_f, true);
+
+ // reversed channels
+ final PNGImage image2R = PNGImage.createFromData(image1.getWidth(), image1.getHeight(),
+ image1.getDpi()[0], image1.getDpi()[1],
+ image1.getBytesPerPixel(), true /* reverseChannels */, image1.isGLOriented(), image1.getData());
+ image2R.write(out2R_f, true);
+
+ // reversed channels and flipped
+ final PNGImage image2RF = PNGImage.createFromData(image1.getWidth(), image1.getHeight(),
+ image1.getDpi()[0], image1.getDpi()[1],
+ image1.getBytesPerPixel(), true /* reverseChannels */, !image1.isGLOriented(), image1.getData());
+ image2RF.write(out2RF_f, true);
}
public static void main(String args[]) {