diff options
author | Sven Gothel <[email protected]> | 2014-08-30 20:05:27 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-08-30 20:05:27 +0200 |
commit | 701e1e8da5e7d31ffdf166ead77250e4d007f86f (patch) | |
tree | 11bf530d39490f9aa9b4c73b38237702b6f59520 /src | |
parent | da16dfd39cc17687808308c386d64f6206027c00 (diff) |
Refine test cases for synchronous GLAutoDrawable display, swap-buffer and read-pixels (non-MSAA and MSAA) Bugs: 841, 975 and 1020
Diffstat (limited to 'src')
6 files changed, 195 insertions, 174 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java index 26974eb30..710f53f92 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java @@ -48,7 +48,18 @@ import com.jogamp.opengl.test.junit.graph.TextRendererGLELBase; import com.jogamp.opengl.test.junit.util.UITestCase; /** - * Multiple GLJPanels in a JFrame + * Test synchronous GLAutoDrawable display, swap-buffer and read-pixels + * including non-MSAA and MSAA framebuffer. + * <p> + * Analyzes behavior of reported bugs + * <ul> + * <li>Bug 841 - GLJPanel "lagging" by one frame, https://jogamp.org/bugzilla/show_bug.cgi?id=841</li> + * <li>Bug 975 - GLJPanel's OffscreenDrawable shall not double swap (custom swap by GLEventListener using [AWT]GLReadBufferUtil), + * https://jogamp.org/bugzilla/show_bug.cgi?id=975</li> + * <li>Bug 1020 - First frame on a mac nvidia card not antialiased, https://jogamp.org/bugzilla/show_bug.cgi?id=841</li> + * </ul> + * </p> + * */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public abstract class GLReadBuffer00Base extends UITestCase { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java new file mode 100644 index 000000000..be0d38357 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java @@ -0,0 +1,120 @@ +/** + * Copyright 2014 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.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; +import javax.media.opengl.GL; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLDrawable; +import javax.media.opengl.GLEventListener; + +import com.jogamp.opengl.util.GLDrawableUtil; +import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil; +import com.jogamp.opengl.util.texture.TextureIO; + +/** + * Test synchronous GLAutoDrawable display, swap-buffer and read-pixels + * including non-MSAA and MSAA framebuffer. + * <p> + * See {@link GLReadBuffer00Base} for related bugs and further details. + * </p> + */ +public abstract class GLReadBuffer00BaseAWT extends GLReadBuffer00Base { + + protected class SnapshotGLELAWT implements GLEventListener { + final TextRendererGLEL textRendererGLEL; + final AWTGLReadBufferUtil glReadBufferUtil; + final boolean skipGLOrientationVerticalFlip; + boolean defAutoSwapMode; + boolean swapBuffersBeforeRead; + int i; + + SnapshotGLELAWT(final TextRendererGLEL textRendererGLEL, final AWTGLReadBufferUtil glReadBufferUtil, final boolean skipGLOrientationVerticalFlip) { + this.textRendererGLEL = textRendererGLEL; + this.glReadBufferUtil = glReadBufferUtil; + this.skipGLOrientationVerticalFlip = skipGLOrientationVerticalFlip; + this.defAutoSwapMode = true; + this.swapBuffersBeforeRead = false; + i = 0; + } + + @Override + public void init(final GLAutoDrawable drawable) { + defAutoSwapMode = drawable.getAutoSwapBufferMode(); + swapBuffersBeforeRead = GLDrawableUtil.swapBuffersBeforeRead(drawable.getChosenGLCapabilities()); + drawable.setAutoSwapBufferMode( !swapBuffersBeforeRead ); + } + @Override + public void dispose(final GLAutoDrawable drawable) { + drawable.setAutoSwapBufferMode( defAutoSwapMode ); + } + @Override + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } + @Override + public void display(final GLAutoDrawable drawable) { + snapshot(i++, drawable.getGL(), TextureIO.PNG, null); + } + public void snapshot(final int sn, final GL gl, final String fileSuffix, final String destPath) { + final GLDrawable drawable = gl.getContext().getGLReadDrawable(); + final String postSNDetail = String.format("awt-usr%03d", textRendererGLEL.userCounter); + final String filenameAWT = getSnapshotFilename(sn, postSNDetail, + drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), + glReadBufferUtil.hasAlpha(), fileSuffix, destPath); + if( swapBuffersBeforeRead ) { + drawable.swapBuffers(); + // Just to test whether we use the right buffer, + // i.e. back-buffer shall no more be required .. + gl.glClear(GL.GL_COLOR_BUFFER_BIT); + } else { + gl.glFinish(); // just make sure rendering finished .. + } + + final boolean awtOrientation = !( drawable.isGLOriented() && skipGLOrientationVerticalFlip ); + System.err.println(Thread.currentThread().getName()+": ** screenshot: awtOrient/v-flip "+awtOrientation+", swapBuffersBeforeRead "+swapBuffersBeforeRead+", "+filenameAWT); + + final BufferedImage image = glReadBufferUtil.readPixelsToBufferedImage(gl, awtOrientation); + final File fout = new File(filenameAWT); + try { + ImageIO.write(image, "png", fout); + } catch (final IOException e) { + e.printStackTrace(); + } + /** + final String filenameJGL = getSnapshotFilename(sn, "jgl", + drawable.getChosenGLCapabilities(), drawable.getWidth(), drawable.getHeight(), + glReadBufferUtil.hasAlpha(), fileSuffix, destPath); + glReadBufferUtil.write(new File(filenameJGL)); + */ + } + }; + +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java index 2b6c84bf3..b2291e5f5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java @@ -30,16 +30,8 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Frame; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import javax.imageio.ImageIO; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; import javax.swing.SwingUtilities; @@ -50,17 +42,20 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; +import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2; import com.jogamp.opengl.test.junit.util.MiscUtils; 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; /** - * Multiple GLJPanels in a JFrame + * Test synchronous GLAutoDrawable display, swap-buffer and read-pixels with AWT GLCanvas + * including non-MSAA and MSAA framebuffer. + * <p> + * See {@link GLReadBuffer00Base} for related bugs and further details. + * </p> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { +public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00BaseAWT { @BeforeClass public static void initClass() { @@ -77,7 +72,7 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { final Dimension d = new Dimension(320, 240); final GLCanvas glad = createGLCanvas(caps, d); final TextRendererGLEL textRendererGLEL = new TextRendererGLEL(); - final SnapshotGLELAWT snapshotGLEL = doSnapshot ? new SnapshotGLELAWT(textRendererGLEL, awtGLReadBufferUtil) : null; + final SnapshotGLELAWT snapshotGLEL = doSnapshot ? new SnapshotGLELAWT(textRendererGLEL, awtGLReadBufferUtil, false) : null; try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -88,9 +83,17 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { // panel.setDoubleBuffered(useSwingDoubleBuffer); // frame.getContentPane().add(panel); - final GearsES2 gears = new GearsES2(1); - gears.setVerbose(false); - glad.addGLEventListener(gears); + { + final GearsES2 gears = new GearsES2(1); + gears.setVerbose(false); + glad.addGLEventListener(gears); + } + { + final MultisampleDemoES2 demo = new MultisampleDemoES2(caps.getSampleBuffers()); + demo.setClearBuffers(false);; + glad.addGLEventListener(demo); + } + glad.addGLEventListener(textRendererGLEL); if( doSnapshot ) { glad.addGLEventListener(snapshotGLEL); @@ -166,71 +169,6 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { return canvas; } - private class SnapshotGLELAWT implements GLEventListener { - final TextRendererGLEL textRendererGLEL; - final AWTGLReadBufferUtil glReadBufferUtil; - boolean defAutoSwapMode; - boolean swapBuffersBeforeRead; - int i; - - SnapshotGLELAWT(final TextRendererGLEL textRendererGLEL, final AWTGLReadBufferUtil glReadBufferUtil) { - this.textRendererGLEL = textRendererGLEL; - this.glReadBufferUtil = glReadBufferUtil; - this.defAutoSwapMode = true; - this.swapBuffersBeforeRead = false; - i = 0; - } - - @Override - public void init(final GLAutoDrawable drawable) { - defAutoSwapMode = drawable.getAutoSwapBufferMode(); - swapBuffersBeforeRead = GLDrawableUtil.swapBuffersBeforeRead(drawable.getChosenGLCapabilities()); - drawable.setAutoSwapBufferMode( !swapBuffersBeforeRead ); - } - @Override - public void dispose(final GLAutoDrawable drawable) { - drawable.setAutoSwapBufferMode( defAutoSwapMode ); - } - @Override - public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } - @Override - public void display(final GLAutoDrawable drawable) { - snapshot(i++, drawable.getGL(), TextureIO.PNG, null); - } - public void snapshot(final int sn, final GL gl, final String fileSuffix, final String destPath) { - final GLDrawable drawable = gl.getContext().getGLReadDrawable(); - final String postSNDetail = String.format("awt-usr%03d", textRendererGLEL.userCounter); - final String filenameAWT = getSnapshotFilename(sn, postSNDetail, - drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), - glReadBufferUtil.hasAlpha(), fileSuffix, destPath); - if( swapBuffersBeforeRead ) { - drawable.swapBuffers(); - // Just to test whether we use the right buffer, - // i.e. back-buffer shall no more be required .. - gl.glClear(GL.GL_COLOR_BUFFER_BIT); - } else { - gl.glFinish(); // just make sure rendering finished .. - } - - final boolean awtOrientation = drawable.isGLOriented(); - System.err.println(Thread.currentThread().getName()+": ** screenshot: awtOrient/v-flip "+awtOrientation+", swapBuffersBeforeRead "+swapBuffersBeforeRead+", "+filenameAWT); - - final BufferedImage image = glReadBufferUtil.readPixelsToBufferedImage(gl, awtOrientation); - final File fout = new File(filenameAWT); - try { - ImageIO.write(image, "png", fout); - } catch (final IOException e) { - e.printStackTrace(); - } - /** - final String filenameJGL = getSnapshotFilename(sn, "jgl", - drawable.getChosenGLCapabilities(), drawable.getWidth(), drawable.getHeight(), - glReadBufferUtil.hasAlpha(), fileSuffix, destPath); - glReadBufferUtil.write(new File(filenameJGL)); - */ - } - }; - static GLCapabilitiesImmutable caps = null; static boolean doSnapshot = true; static boolean keyFrame = false; 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 7f5755fc7..e862e46e2 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 @@ -29,16 +29,8 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import javax.imageio.ImageIO; -import javax.media.opengl.GL; -import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLDrawable; -import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLJPanel; import javax.swing.JFrame; @@ -51,17 +43,20 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; +import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2; import com.jogamp.opengl.test.junit.util.MiscUtils; 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; /** - * Multiple GLJPanels in a JFrame + * Test synchronous GLAutoDrawable display, swap-buffer and read-pixels with AWT GLJPanel + * including non-MSAA and MSAA framebuffer. + * <p> + * See {@link GLReadBuffer00Base} for related bugs and further details. + * </p> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { +public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00BaseAWT { @BeforeClass public static void initClass() { @@ -85,10 +80,17 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { panel.setDoubleBuffered(useSwingDoubleBuffer); frame.getContentPane().add(panel); - final GearsES2 gears = new GearsES2(1); - gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip); - gears.setVerbose(false); - glad.addGLEventListener(gears); + { + final GearsES2 gears = new GearsES2(1); + gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip); + gears.setVerbose(false); + glad.addGLEventListener(gears); + } + { + final MultisampleDemoES2 demo = new MultisampleDemoES2(caps.getSampleBuffers()); + demo.setClearBuffers(false);; + glad.addGLEventListener(demo); + } textRendererGLEL.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip); glad.addGLEventListener(textRendererGLEL); if( doSnapshot ) { @@ -166,73 +168,6 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { return canvas; } - private class SnapshotGLELAWT implements GLEventListener { - final TextRendererGLEL textRendererGLEL; - final AWTGLReadBufferUtil glReadBufferUtil; - final boolean skipGLOrientationVerticalFlip; - boolean defAutoSwapMode; - boolean swapBuffersBeforeRead; - int i; - - SnapshotGLELAWT(final TextRendererGLEL textRendererGLEL, final AWTGLReadBufferUtil glReadBufferUtil, final boolean skipGLOrientationVerticalFlip) { - this.textRendererGLEL = textRendererGLEL; - this.glReadBufferUtil = glReadBufferUtil; - this.skipGLOrientationVerticalFlip = skipGLOrientationVerticalFlip; - this.defAutoSwapMode = true; - this.swapBuffersBeforeRead = false; - i = 0; - } - - @Override - public void init(final GLAutoDrawable drawable) { - defAutoSwapMode = drawable.getAutoSwapBufferMode(); - swapBuffersBeforeRead = GLDrawableUtil.swapBuffersBeforeRead(drawable.getChosenGLCapabilities()); - drawable.setAutoSwapBufferMode( !swapBuffersBeforeRead ); - } - @Override - public void dispose(final GLAutoDrawable drawable) { - drawable.setAutoSwapBufferMode( defAutoSwapMode ); - } - @Override - public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } - @Override - public void display(final GLAutoDrawable drawable) { - snapshot(i++, drawable.getGL(), TextureIO.PNG, null); - } - public void snapshot(final int sn, final GL gl, final String fileSuffix, final String destPath) { - final GLDrawable drawable = gl.getContext().getGLReadDrawable(); - final String postSNDetail = String.format("awt-usr%03d", textRendererGLEL.userCounter); - final String filenameAWT = getSnapshotFilename(sn, postSNDetail, - drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), - glReadBufferUtil.hasAlpha(), fileSuffix, destPath); - if( swapBuffersBeforeRead ) { - drawable.swapBuffers(); - // Just to test whether we use the right buffer, - // i.e. back-buffer shall no more be required .. - gl.glClear(GL.GL_COLOR_BUFFER_BIT); - } else { - gl.glFinish(); // just make sure rendering finished .. - } - - final boolean awtOrientation = !( drawable.isGLOriented() && skipGLOrientationVerticalFlip ); - System.err.println(Thread.currentThread().getName()+": ** screenshot: awtOrient/v-flip "+awtOrientation+", swapBuffersBeforeRead "+swapBuffersBeforeRead+", "+filenameAWT); - - final BufferedImage image = glReadBufferUtil.readPixelsToBufferedImage(gl, awtOrientation); - final File fout = new File(filenameAWT); - try { - ImageIO.write(image, "png", fout); - } catch (final IOException e) { - e.printStackTrace(); - } - /** - final String filenameJGL = getSnapshotFilename(sn, "jgl", - drawable.getChosenGLCapabilities(), drawable.getWidth(), drawable.getHeight(), - glReadBufferUtil.hasAlpha(), fileSuffix, destPath); - glReadBufferUtil.write(new File(filenameJGL)); - */ - } - }; - static GLCapabilitiesImmutable caps = null; static boolean doSnapshot = true; static boolean keyFrame = false; 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 8e0e6bfb9..57a571ba9 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 @@ -44,6 +44,7 @@ import org.junit.runners.MethodSorters; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; +import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.GLDrawableUtil; @@ -51,7 +52,11 @@ import com.jogamp.opengl.util.GLReadBufferUtil; import com.jogamp.opengl.util.texture.TextureIO; /** - * Multiple GLJPanels in a JFrame + * Test synchronous GLAutoDrawable display, swap-buffer and read-pixels with NEWT + * including non-MSAA and MSAA framebuffer. + * <p> + * See {@link GLReadBuffer00Base} for related bugs and further details. + * </p> */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base { @@ -73,9 +78,16 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base { try { glad.setPosition(64, 64); glad.setSize(320, 240); - final GearsES2 gears = new GearsES2(1); - gears.setVerbose(false); - glad.addGLEventListener(gears); + { + final GearsES2 gears = new GearsES2(1); + gears.setVerbose(false); + glad.addGLEventListener(gears); + } + { + final MultisampleDemoES2 demo = new MultisampleDemoES2(caps.getSampleBuffers()); + demo.setClearBuffers(false);; + glad.addGLEventListener(demo); + } textRendererGLEL.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip); glad.addGLEventListener(textRendererGLEL); if( doSnapshot ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java index 7c4c5106b..8e4dbfefe 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java @@ -55,7 +55,7 @@ import com.jogamp.opengl.util.glsl.ShaderState; public class MultisampleDemoES2 implements GLEventListener { - private boolean multisample; + private boolean multisample, clearBuffers; private final ShaderState st; private final PMVMatrix pmvMatrix; private ShaderProgram sp0; @@ -64,11 +64,14 @@ public class MultisampleDemoES2 implements GLEventListener { public MultisampleDemoES2(final boolean multisample) { this.multisample = multisample; + this.clearBuffers = true; st = new ShaderState(); st.setVerbose(true); pmvMatrix = new PMVMatrix(); } + public void setClearBuffers(final boolean v) { clearBuffers = v; } + public void init(final GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); @@ -135,10 +138,12 @@ public class MultisampleDemoES2 implements GLEventListener { if (multisample) { gl.glEnable(GL.GL_MULTISAMPLE); } - gl.glClearColor(0, 0, 0, 0); - // gl.glEnable(GL.GL_DEPTH_TEST); - // gl.glDepthFunc(GL.GL_LESS); - gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); + if( clearBuffers ) { + gl.glClearColor(0, 0, 0, 0); + // gl.glEnable(GL.GL_DEPTH_TEST); + // gl.glDepthFunc(GL.GL_LESS); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); + } st.useProgram(gl, true); |