diff options
-rwxr-xr-x | make/scripts/tests.sh | 35 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/demos/TestTextureSequence.java) | 4 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TexCubeES2.java) | 69 | ||||
-rwxr-xr-x | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java | 6 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java | 112 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java | 99 |
6 files changed, 250 insertions, 75 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index a678bdf05..da817d33b 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -209,6 +209,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFloatUtil01MatrixMatrixMultNOUI $* #testnoawt com.jogamp.opengl.test.junit.jogl.glu.TestGluUnprojectFloatNOUI $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $* @@ -249,12 +250,6 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.newt.ManualScreenMode03NEWT #testnoawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol02NEWT $* #testnoawt -Djava.awt.headless=true com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT -#testnoawt com.jogamp.opengl.test.junit.jogl.util.TestGLReadBufferUtilTextureIOWrite01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.util.TestGLReadBufferUtilTextureIOWrite02NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.util.TestPNGImage01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $* -#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* -#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.TexCubeES2 $* # # awt (testawt) @@ -280,9 +275,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWTAnalyzeBug455 $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWTBug450 $* -#testawt com.jogamp.opengl.test.junit.jogl.texture.TestTexture01AWT #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461OffscreenSupersamplingSwingAWT -#testawt com.jogamp.opengl.test.junit.jogl.texture.TestGrayTextureFromFileAWTBug417 #testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug463ScaleImageMemoryAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStopBug532 $* @@ -332,6 +325,23 @@ function testawtswt() { #testawt $* +# +# Texture / TextureUtils +# +#testnoawt com.jogamp.opengl.test.junit.jogl.util.TestPNGImage01NEWT $* +#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTexture01AWT +#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGrayTextureFromFileAWTBug417 +#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite01NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01NEWT $* +testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01AWT $* + +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* + +# +# GLSL / FBO / .. +# #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLSimple01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState01NEWT $* @@ -339,7 +349,10 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 $* #testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestFBOMRTNEWT01 $* -testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT10 $* +# +# Graph +# +#testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT10 $* #testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT00 $* #testnoawt com.jogamp.opengl.test.junit.graph.TestRegionRendererNEWT01 $* #testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT01 $* @@ -351,9 +364,11 @@ testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT10 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo02 $* +# +# Security +# #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBufferRead01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $* # # osx bugs diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TestTextureSequence.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java index 6dfb11855..a1d4b4466 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TestTextureSequence.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java @@ -14,14 +14,14 @@ import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; import com.jogamp.opengl.util.texture.TextureSequence; -public class TestTextureSequence implements TextureSequence { +public class TextureSequenceDemo01 implements TextureSequence { TextureSequence.TextureFrame frame = null; int textureUnit = 0; protected int[] texMinMagFilter = { GL.GL_NEAREST, GL.GL_NEAREST }; protected int[] texWrapST = { GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE }; final boolean useBuildInTexLookup; - public TestTextureSequence(boolean useBuildInTexLookup) { + public TextureSequenceDemo01(boolean useBuildInTexLookup) { this.useBuildInTexLookup = useBuildInTexLookup; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TexCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java index e85468bcb..c2fbc65af 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TexCubeES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java @@ -33,7 +33,6 @@ import java.nio.FloatBuffer; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLES2; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; @@ -45,13 +44,7 @@ import com.jogamp.newt.Window; import com.jogamp.newt.event.MouseAdapter; import com.jogamp.newt.event.MouseEvent; import com.jogamp.newt.event.MouseListener; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; -import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.JoglVersion; -import com.jogamp.opengl.test.junit.jogl.demos.TestTextureSequence; -import com.jogamp.opengl.test.junit.util.MiscUtils; -import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.GLArrayDataServer; import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderCode; @@ -61,8 +54,8 @@ import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureCoords; import com.jogamp.opengl.util.texture.TextureSequence; -public class TexCubeES2 implements GLEventListener { - public TexCubeES2 (TextureSequence texSource, boolean innerCube, float zoom0, float rotx, float roty) { +public class TextureSequenceCubeES2 implements GLEventListener { + public TextureSequenceCubeES2 (TextureSequence texSource, boolean innerCube, float zoom0, float rotx, float roty) { this.texSeq = texSource; this.innerCube = innerCube; this.zoom0 = zoom0; @@ -153,9 +146,9 @@ public class TexCubeES2 implements GLEventListener { private void initShader(GL2ES2 gl) { // Create & Compile the shader objects - ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TexCubeES2.class, + ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TextureSequenceCubeES2.class, "shader", "shader/bin", shaderBasename, true); - ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TexCubeES2.class, + ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TextureSequenceCubeES2.class, "shader", "shader/bin", shaderBasename, true); // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ] @@ -274,6 +267,9 @@ public class TexCubeES2 implements GLEventListener { if (drawable instanceof Window) { Window window = (Window) drawable; window.addMouseListener(mouseAction); + } else if (GLProfile.isAWTAvailable() && drawable instanceof java.awt.Component) { + java.awt.Component comp = (java.awt.Component) drawable; + new com.jogamp.newt.event.awt.AWTMouseAdapter(mouseAction).addTo(comp); } // Let's show the completed shader state .. @@ -432,6 +428,7 @@ public class TexCubeES2 implements GLEventListener { 255f/255f, 70f/255f, 60f/255f, 255f/255f, 255f/255f, 70f/255f, 60f/255f, 255f/255f }; + /* private static final float[] s_cubeNormals = { 0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f, 1f, @@ -445,7 +442,7 @@ public class TexCubeES2 implements GLEventListener { 1f, 0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f - }; + };*/ private static final byte[] s_cubeIndices = { 0, 3, 1, 2, 0, 1, /* front */ @@ -455,53 +452,5 @@ public class TexCubeES2 implements GLEventListener { 16, 19, 17, 18, 16, 17, /* right */ 23, 20, 21, 20, 22, 21 /* left */ }; - - public static void main(String[] args) { - int width = 510; - int height = 300; - boolean useBuildInTexLookup = false; - System.err.println("TexCubeES2.run()"); - - for(int i=0; i<args.length; i++) { - if(args[i].equals("-width")) { - i++; - width = MiscUtils.atoi(args[i], width); - } else if(args[i].equals("-height")) { - i++; - height = MiscUtils.atoi(args[i], height); - } else if(args[i].equals("-shaderBuildIn")) { - useBuildInTexLookup = true; - } - } - - final GLWindow window = GLWindow.create(new GLCapabilities(GLProfile.getGL2ES2())); - // Size OpenGL to Video Surface - window.setSize(width, height); - window.setFullscreen(false); - window.setSize(width, height); - final TestTextureSequence texSource = new TestTextureSequence(useBuildInTexLookup); - window.addGLEventListener(new GLEventListener() { - @Override - public void init(GLAutoDrawable drawable) { - texSource.initGLResources(drawable.getGL()); - } - @Override - public void dispose(GLAutoDrawable drawable) { } - @Override - public void display(GLAutoDrawable drawable) { } - @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } - }); - window.addGLEventListener(new TexCubeES2(texSource, false, -2.3f, 0f, 0f)); - window.setVisible(true); - final Animator anim = new Animator(window); - // anim.setUpdateFPSFrames(60, System.err); - anim.start(); - window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { - anim.stop(); - } - }); - } } 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 bb0d84193..0b83aacd8 100755 --- 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 @@ -55,7 +55,7 @@ import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.JoglVersion; -import com.jogamp.opengl.test.junit.jogl.demos.es2.TexCubeES2; +import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureSequenceCubeES2; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.av.GLMediaPlayer; @@ -66,7 +66,7 @@ public class MovieCube implements GLEventListener, GLMediaEventListener { static boolean waitForKey = false; final URLConnection stream; final float zoom0, rotx, roty; - TexCubeES2 cube=null; + TextureSequenceCubeES2 cube=null; GLMediaPlayer mPlayer=null; public MovieCube() throws IOException { @@ -137,7 +137,7 @@ public class MovieCube implements GLEventListener, GLMediaEventListener { mPlayer = GLMediaPlayerFactory.create(); mPlayer.addEventListener(this); - cube = new TexCubeES2(mPlayer, false, zoom0, rotx, roty); + cube = new TextureSequenceCubeES2(mPlayer, false, zoom0, rotx, roty); if(waitForKey) { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java new file mode 100644 index 000000000..36dad45e6 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java @@ -0,0 +1,112 @@ +package com.jogamp.opengl.test.junit.jogl.util.texture; + +import java.awt.Frame; + +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLProfile; +import javax.media.opengl.awt.GLCanvas; + +import org.junit.Assert; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.jogamp.opengl.test.junit.jogl.demos.TextureSequenceDemo01; +import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureSequenceCubeES2; +import com.jogamp.opengl.test.junit.util.MiscUtils; +import com.jogamp.opengl.test.junit.util.QuitAdapter; +import com.jogamp.opengl.test.junit.util.UITestCase; +import com.jogamp.opengl.util.Animator; + +public class TestTextureSequence01AWT extends UITestCase { + static boolean showFPS = false; + static int width = 510; + static int height = 300; + static boolean useBuildInTexLookup = false; + static long duration = 500; // ms + static GLProfile glp; + static GLCapabilities caps; + + @BeforeClass + public static void initClass() { + glp = GLProfile.getGL2ES2(); + Assert.assertNotNull(glp); + caps = new GLCapabilities(glp); + Assert.assertNotNull(caps); + } + + void testImpl() throws InterruptedException { + final GLCanvas glc = new GLCanvas(caps); + final Frame frame = new Frame("TestTextureSequence01AWT"); + Assert.assertNotNull(frame); + frame.add(glc); + frame.setSize(width, height); + + final TextureSequenceDemo01 texSource = new TextureSequenceDemo01(useBuildInTexLookup); + glc.addGLEventListener(new GLEventListener() { + @Override + public void init(GLAutoDrawable drawable) { + texSource.initGLResources(drawable.getGL()); + } + @Override + public void dispose(GLAutoDrawable drawable) { } + @Override + public void display(GLAutoDrawable drawable) { } + @Override + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + }); + glc.addGLEventListener(new TextureSequenceCubeES2(texSource, false, -2.3f, 0f, 0f)); + final Animator animator = new Animator(glc); + animator.setUpdateFPSFrames(60, showFPS ? System.err : null); + QuitAdapter quitAdapter = new QuitAdapter(); + new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter).addTo(glc); + new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter).addTo(glc); + frame.setVisible(true); + animator.start(); + + while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { + Thread.sleep(100); + } + + animator.stop(); + Assert.assertFalse(animator.isAnimating()); + Assert.assertFalse(animator.isStarted()); + try { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(false); + frame.remove(glc); + frame.dispose(); + }}); + } catch( Throwable throwable ) { + throwable.printStackTrace(); + Assume.assumeNoException( throwable ); + } + } + + @Test + public void test1() throws InterruptedException { + testImpl(); + } + + public static void main(String[] args) { + for(int i=0; i<args.length; i++) { + if(args[i].equals("-time")) { + i++; + duration = MiscUtils.atol(args[i], duration); + } else if(args[i].equals("-width")) { + i++; + width = MiscUtils.atoi(args[i], width); + } else if(args[i].equals("-height")) { + i++; + height = MiscUtils.atoi(args[i], height); + } else if(args[i].equals("-shaderBuildIn")) { + useBuildInTexLookup = true; + } + } + org.junit.runner.JUnitCore.main(TestTextureSequence01AWT.class.getName()); + } + +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java new file mode 100644 index 000000000..89f8863d7 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java @@ -0,0 +1,99 @@ +package com.jogamp.opengl.test.junit.jogl.util.texture; + +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLProfile; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.test.junit.jogl.demos.TextureSequenceDemo01; +import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureSequenceCubeES2; +import com.jogamp.opengl.test.junit.util.MiscUtils; +import com.jogamp.opengl.test.junit.util.QuitAdapter; +import com.jogamp.opengl.test.junit.util.UITestCase; +import com.jogamp.opengl.util.Animator; + +public class TestTextureSequence01NEWT extends UITestCase { + static boolean showFPS = false; + static int width = 510; + static int height = 300; + static boolean useBuildInTexLookup = false; + static long duration = 500; // ms + static GLProfile glp; + static GLCapabilities caps; + + @BeforeClass + public static void initClass() { + glp = GLProfile.getGL2ES2(); + Assert.assertNotNull(glp); + caps = new GLCapabilities(glp); + Assert.assertNotNull(caps); + } + + void testImpl() throws InterruptedException { + final GLWindow window = GLWindow.create(caps); + window.setTitle("TestTextureSequence01NEWT"); + // Size OpenGL to Video Surface + window.setSize(width, height); + window.setFullscreen(false); + window.setSize(width, height); + final TextureSequenceDemo01 texSource = new TextureSequenceDemo01(useBuildInTexLookup); + window.addGLEventListener(new GLEventListener() { + @Override + public void init(GLAutoDrawable drawable) { + texSource.initGLResources(drawable.getGL()); + } + @Override + public void dispose(GLAutoDrawable drawable) { } + @Override + public void display(GLAutoDrawable drawable) { } + @Override + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + }); + window.addGLEventListener(new TextureSequenceCubeES2(texSource, false, -2.3f, 0f, 0f)); + final Animator animator = new Animator(window); + animator.setUpdateFPSFrames(60, showFPS ? System.err : null); + QuitAdapter quitAdapter = new QuitAdapter(); + window.addKeyListener(quitAdapter); + window.addWindowListener(quitAdapter); + animator.start(); + window.setVisible(true); + + while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { + Thread.sleep(100); + } + + animator.stop(); + Assert.assertFalse(animator.isAnimating()); + Assert.assertFalse(animator.isStarted()); + window.destroy(); + } + + @Test + public void test1() throws InterruptedException { + testImpl(); + } + + public static void main(String[] args) { + for(int i=0; i<args.length; i++) { + if(args[i].equals("-time")) { + i++; + duration = MiscUtils.atol(args[i], duration); + } else if(args[i].equals("-width")) { + i++; + width = MiscUtils.atoi(args[i], width); + } else if(args[i].equals("-height")) { + i++; + height = MiscUtils.atoi(args[i], height); + } else if(args[i].equals("-shaderBuildIn")) { + useBuildInTexLookup = true; + } + } + org.junit.runner.JUnitCore.main(TestTextureSequence01NEWT.class.getName()); + } + +} |