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/acore/TestGLReadBuffer01GLJPanelAWT.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/UITestCase.java23
3 files changed, 24 insertions, 31 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java
index 58ca24453..5853087f5 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java
@@ -54,6 +54,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLDrawableUtil;
import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil;
import com.jogamp.opengl.util.texture.TextureIO;
@@ -74,7 +75,7 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base {
final Dimension d = new Dimension(320, 240);
final GLJPanel glad = createGLJPanel(skipGLOrientationVerticalFlip, useSwingDoubleBuffer, caps, d);
final TextRendererGLEL textRendererGLEL = new TextRendererGLEL();
- final SnapshotGLELAWT snapshotGLEL = new SnapshotGLELAWT(textRendererGLEL, awtGLReadBufferUtil, skipGLOrientationVerticalFlip);
+ final SnapshotGLELAWT snapshotGLEL = doSnapshot ? new SnapshotGLELAWT(textRendererGLEL, awtGLReadBufferUtil, skipGLOrientationVerticalFlip) : null;
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -90,7 +91,9 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base {
glad.addGLEventListener(gears);
textRendererGLEL.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
glad.addGLEventListener(textRendererGLEL);
- glad.addGLEventListener(snapshotGLEL);
+ if( doSnapshot ) {
+ glad.addGLEventListener(snapshotGLEL);
+ }
panel.add(glad);
frame.pack();
frame.setVisible(true);
@@ -133,7 +136,9 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base {
} } );
try { Thread.sleep(duration); } catch (InterruptedException e) { }
- glad.disposeGLEventListener(snapshotGLEL, true /* remove */);
+ if( doSnapshot ) {
+ glad.disposeGLEventListener(snapshotGLEL, true /* remove */);
+ }
final Animator anim = new Animator(glad);
anim.start();
try { Thread.sleep(2*duration); } catch (InterruptedException e) { }
@@ -181,7 +186,7 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base {
@Override
public void init(GLAutoDrawable drawable) {
defAutoSwapMode = drawable.getAutoSwapBufferMode();
- swapBuffersBeforeRead = UITestCase.swapBuffersBeforeRead(drawable.getChosenGLCapabilities());
+ swapBuffersBeforeRead = GLDrawableUtil.swapBuffersBeforeRead(drawable.getChosenGLCapabilities());
drawable.setAutoSwapBufferMode( !swapBuffersBeforeRead );
}
@Override
@@ -229,6 +234,7 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base {
};
static GLCapabilitiesImmutable caps = null;
+ static boolean doSnapshot = true;
static boolean keyFrame = false;
public static void main(String[] args) {
@@ -238,6 +244,8 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base {
duration = MiscUtils.atol(args[i], duration);
} else if(args[i].equals("-keyFrame")) {
keyFrame = true;
+ } else if(args[i].equals("-noSnapshot")) {
+ doSnapshot = false;
}
}
org.junit.runner.JUnitCore.main(TestGLReadBuffer01GLJPanelAWT.class.getName());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java
index af5ff2a1a..8cfb18f79 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java
@@ -47,6 +47,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLDrawableUtil;
import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.texture.TextureIO;
@@ -68,7 +69,7 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base {
final GLReadBufferUtil glReadBufferUtil = new GLReadBufferUtil(false, false);
final GLWindow glad= GLWindow.create(caps);
final TextRendererGLEL textRendererGLEL = new TextRendererGLEL();
- final SnapshotGLEL snapshotGLEL = new SnapshotGLEL(textRendererGLEL, glReadBufferUtil);
+ final SnapshotGLEL snapshotGLEL = doSnapshot ? new SnapshotGLEL(textRendererGLEL, glReadBufferUtil) : null;
try {
glad.setPosition(64, 64);
glad.setSize(320, 240);
@@ -77,7 +78,9 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base {
glad.addGLEventListener(gears);
textRendererGLEL.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
glad.addGLEventListener(textRendererGLEL);
- glad.addGLEventListener(snapshotGLEL);
+ if( doSnapshot ) {
+ glad.addGLEventListener(snapshotGLEL);
+ }
glad.setVisible(true);
} catch( Throwable throwable ) {
throwable.printStackTrace();
@@ -104,7 +107,9 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base {
glad.setSize(size0.getWidth(), size0.getHeight());
try { Thread.sleep(duration); } catch (InterruptedException e) { }
- glad.disposeGLEventListener(snapshotGLEL, true /* remove */);
+ if( doSnapshot ) {
+ glad.disposeGLEventListener(snapshotGLEL, true /* remove */);
+ }
final Animator anim = new Animator(glad);
anim.start();
try { Thread.sleep(2*duration); } catch (InterruptedException e) { }
@@ -133,7 +138,7 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base {
@Override
public void init(GLAutoDrawable drawable) {
defAutoSwapMode = drawable.getAutoSwapBufferMode();
- swapBuffersBeforeRead = UITestCase.swapBuffersBeforeRead(drawable.getChosenGLCapabilities());
+ swapBuffersBeforeRead = GLDrawableUtil.swapBuffersBeforeRead(drawable.getChosenGLCapabilities());
drawable.setAutoSwapBufferMode( !swapBuffersBeforeRead );
}
@Override
@@ -170,6 +175,7 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base {
};
static GLCapabilitiesImmutable caps = null;
+ static boolean doSnapshot = true;
static boolean keyFrame = false;
public static void main(String[] args) {
@@ -179,6 +185,8 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base {
duration = MiscUtils.atol(args[i], duration);
} else if(args[i].equals("-keyFrame")) {
keyFrame = true;
+ } else if(args[i].equals("-noSnapshot")) {
+ doSnapshot = false;
}
}
org.junit.runner.JUnitCore.main(TestGLReadBuffer01GLWindowNEWT.class.getName());
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 79c76e49f..a08e9f842 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
@@ -277,29 +277,6 @@ public abstract class UITestCase {
static final String unsupportedTestMsg = "Test not supported on this platform.";
- /**
- * Determines whether the chosen {@link GLCapabilitiesImmutable}
- * requires a {@link GLDrawable#swapBuffers() swap-buffers}
- * before reading pixels.
- * <p>
- * Usually one uses the {@link GL#getDefaultReadBuffer() default-read-buffer}, i.e.
- * {@link GL#GL_FRONT} for single-buffer and {@link GL#GL_BACK} for double-buffer {@link GLDrawable}s
- * and {@link GL#GL_COLOR_ATTACHMENT0} for offscreen framebuffer objects.<br>
- * Here {@link GLDrawable#swapBuffers() swap-buffers} shall happen <b>after</b> calling reading pixels, the default.
- * </p>
- * <p>
- * However, <i>multisampling</i> offscreen {@link javax.media.opengl.GLFBODrawable}s
- * utilize {@link GLDrawable#swapBuffers() swap-buffers} to <i>downsample</i>
- * the multisamples into the readable sampling sink.
- * In this case, we require a {@link GLDrawable#swapBuffers() swap-buffers} <b>before</b> reading pixels.
- * </p>
- * @param chosenCaps the chosen {@link GLCapabilitiesImmutable}
- * @return chosenCaps.isFBO() && chosenCaps.getSampleBuffers()
- */
- public static final boolean swapBuffersBeforeRead(GLCapabilitiesImmutable chosenCaps) {
- return chosenCaps.isFBO() && chosenCaps.getSampleBuffers();
- }
-
public String getSnapshotFilename(int sn, String postSNDetail, GLCapabilitiesImmutable caps, int width, int height, boolean sinkHasAlpha, String fileSuffix, String destPath) {
if(null == fileSuffix) {
fileSuffix = TextureIO.PNG;