From 38febaa43f91e389ffdaf64a2cdd8145629e0b8d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 25 Mar 2014 23:55:39 +0100 Subject: Bug 801: Adjust Tests: GPUUIScene* use window proportional button size; Add Android MovieCubeActivity0a for 'no text' version --- .../opengl/test/android/MovieCubeActivity0.java | 167 -------------------- .../opengl/test/android/MovieCubeActivity0a.java | 167 ++++++++++++++++++++ .../opengl/test/android/MovieCubeActivity0b.java | 169 +++++++++++++++++++++ .../test/android/MovieCubeActivityLauncher0.java | 88 ----------- .../test/android/MovieCubeActivityLauncher0a.java | 88 +++++++++++ .../test/android/MovieCubeActivityLauncher0b.java | 88 +++++++++++ .../test/android/MovieCubeActivityLauncher1a.java | 2 +- .../test/android/MovieCubeActivityLauncher1b.java | 2 +- .../opengl/test/android/MovieSimpleActivity0.java | 40 ++--- .../opengl/test/android/MovieSimpleActivity1.java | 70 +++++---- .../junit/graph/demos/GPUUISceneGLListener0A.java | 19 ++- .../test/junit/jogl/demos/es2/av/MovieCube.java | 36 +++-- .../test/junit/jogl/demos/es2/av/MovieSimple.java | 12 +- 13 files changed, 617 insertions(+), 331 deletions(-) delete mode 100644 src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java create mode 100644 src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java create mode 100644 src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java delete mode 100644 src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0.java create mode 100644 src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0a.java create mode 100644 src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0b.java (limited to 'src/test') diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java deleted file mode 100644 index 1de095161..000000000 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Copyright 2011 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.android; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLConnection; -import java.util.Arrays; - -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; - -import jogamp.newt.driver.android.NewtBaseActivity; - -import com.jogamp.common.util.IOUtil; -import com.jogamp.newt.NewtFactory; -import com.jogamp.newt.event.MouseAdapter; -import com.jogamp.newt.event.MouseEvent; -import com.jogamp.newt.opengl.GLWindow; - -import com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube; -import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.av.GLMediaPlayer; -import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener; -import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException; -import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; - -import android.os.Bundle; -import android.util.Log; - -public class MovieCubeActivity0 extends NewtBaseActivity { - static String TAG = "MovieCubeActivity0"; - - MouseAdapter showKeyboardMouseListener = new MouseAdapter() { - @Override - public void mousePressed(MouseEvent e) { - if( e.getPointerCount() == 4 && e.getPressure(0, true) > 0.7f ) { - ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); - } - } - }; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - String[] streamLocs = new String[] { - System.getProperty("jnlp.media0_url2"), - System.getProperty("jnlp.media0_url1"), - System.getProperty("jnlp.media0_url0") }; - final URI streamLoc = getURI(streamLocs, 0, false); - if(null == streamLoc) { throw new RuntimeException("no media reachable: "+Arrays.asList(streamLocs)); } - - // also initializes JOGL - final GLCapabilities capsMain = new GLCapabilities(GLProfile.getGL2ES2()); - capsMain.setBackgroundOpaque(false); - - // screen for layout params .. - final com.jogamp.newt.Display dpy = NewtFactory.createDisplay(null); - final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0); - scrn.addReference(); - - try { - final Animator anim = new Animator(); - - // Main - final GLWindow glWindowMain = GLWindow.create(scrn, capsMain); - glWindowMain.setFullscreen(true); - setContentView(getWindow(), glWindowMain); - anim.add(glWindowMain); - glWindowMain.setVisible(true); - glWindowMain.addMouseListener(showKeyboardMouseListener); - - final MovieCube demoMain = new MovieCube(MovieCube.zoom_def, 0f, 0f); - final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer(); - mPlayer.addEventListener(new GLMediaEventListener() { - @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { - } - - @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { - System.err.println("MovieCubeActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); - System.err.println("MovieCubeActivity0 State: "+mp); - if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { - glWindowMain.addGLEventListener(demoMain); - anim.setUpdateFPSFrames(60, null); - anim.resetFPSCounter(); - } - if( 0 != ( GLMediaEventListener.EVENT_CHANGE_PLAY & event_mask ) ) { - anim.resetFPSCounter(); - } - if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) { - final StreamException se = mPlayer.getStreamException(); - if( null != se ) { - se.printStackTrace(); - } - getActivity().finish(); - } - } - }); - demoMain.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0); - } catch (IOException e) { - e.printStackTrace(); - } - - scrn.removeReference(); - - Log.d(TAG, "onCreate - X"); - } - - static URI getURI(String path[], int off, boolean checkAvail) { - URI uri = null; - for(int i=off; null==uri && i0) { - if( checkAvail ) { - final URLConnection uc = IOUtil.getResource(path[i], null); - if( null != uc ) { - try { - uri = uc.getURL().toURI(); - } catch (URISyntaxException e) { - uri = null; - } - if( uc instanceof HttpURLConnection ) { - ((HttpURLConnection)uc).disconnect(); - } - } - } else { - try { - uri = new URI(path[i]); - } catch (URISyntaxException e) { - uri = null; - } - } - Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uri)); - } - } - return uri; - } -} diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java new file mode 100644 index 000000000..0a45f3c3b --- /dev/null +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java @@ -0,0 +1,167 @@ +/** + * Copyright 2011 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.android; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLConnection; +import java.util.Arrays; + +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; + +import jogamp.newt.driver.android.NewtBaseActivity; + +import com.jogamp.common.util.IOUtil; +import com.jogamp.newt.NewtFactory; +import com.jogamp.newt.event.MouseAdapter; +import com.jogamp.newt.event.MouseEvent; +import com.jogamp.newt.opengl.GLWindow; + +import com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube; +import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.av.GLMediaPlayer; +import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener; +import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException; +import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; + +import android.os.Bundle; +import android.util.Log; + +public class MovieCubeActivity0a extends NewtBaseActivity { + static String TAG = "MovieCubeActivity0a"; + + MouseAdapter showKeyboardMouseListener = new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if( e.getPointerCount() == 4 && e.getPressure(0, true) > 0.7f ) { + ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); + } + } + }; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + String[] streamLocs = new String[] { + System.getProperty("jnlp.media0_url2"), + System.getProperty("jnlp.media0_url1"), + System.getProperty("jnlp.media0_url0") }; + final URI streamLoc = getURI(streamLocs, 0, false); + if(null == streamLoc) { throw new RuntimeException("no media reachable: "+Arrays.asList(streamLocs)); } + + // also initializes JOGL + final GLCapabilities capsMain = new GLCapabilities(GLProfile.getGL2ES2()); + capsMain.setBackgroundOpaque(false); + + // screen for layout params .. + final com.jogamp.newt.Display dpy = NewtFactory.createDisplay(null); + final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0); + scrn.addReference(); + + try { + final Animator anim = new Animator(); + + // Main + final GLWindow glWindowMain = GLWindow.create(scrn, capsMain); + glWindowMain.setFullscreen(true); + setContentView(getWindow(), glWindowMain); + anim.add(glWindowMain); + glWindowMain.setVisible(true); + glWindowMain.addMouseListener(showKeyboardMouseListener); + + final MovieCube demoMain = new MovieCube(MovieCube.zoom_def, 0f, 0f, false); + final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer(); + mPlayer.addEventListener(new GLMediaEventListener() { + @Override + public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { + } + + @Override + public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + System.err.println("MovieCubeActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); + System.err.println("MovieCubeActivity0 State: "+mp); + if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { + glWindowMain.addGLEventListener(demoMain); + anim.setUpdateFPSFrames(60, null); + anim.resetFPSCounter(); + } + if( 0 != ( GLMediaEventListener.EVENT_CHANGE_PLAY & event_mask ) ) { + anim.resetFPSCounter(); + } + if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) { + final StreamException se = mPlayer.getStreamException(); + if( null != se ) { + se.printStackTrace(); + } + getActivity().finish(); + } + } + }); + demoMain.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0); + } catch (IOException e) { + e.printStackTrace(); + } + + scrn.removeReference(); + + Log.d(TAG, "onCreate - X"); + } + + static URI getURI(String path[], int off, boolean checkAvail) { + URI uri = null; + for(int i=off; null==uri && i0) { + if( checkAvail ) { + final URLConnection uc = IOUtil.getResource(path[i], null); + if( null != uc ) { + try { + uri = uc.getURL().toURI(); + } catch (URISyntaxException e) { + uri = null; + } + if( uc instanceof HttpURLConnection ) { + ((HttpURLConnection)uc).disconnect(); + } + } + } else { + try { + uri = new URI(path[i]); + } catch (URISyntaxException e) { + uri = null; + } + } + Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uri)); + } + } + return uri; + } +} diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java new file mode 100644 index 000000000..192b305f4 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java @@ -0,0 +1,169 @@ +/** + * Copyright 2011 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.android; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLConnection; +import java.util.Arrays; + +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; + +import jogamp.newt.driver.android.NewtBaseActivity; + +import com.jogamp.common.util.IOUtil; +import com.jogamp.newt.NewtFactory; +import com.jogamp.newt.event.MouseAdapter; +import com.jogamp.newt.event.MouseEvent; +import com.jogamp.newt.opengl.GLWindow; + +import com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube; +import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.av.GLMediaPlayer; +import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener; +import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException; +import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; + +import android.os.Bundle; +import android.util.Log; + +public class MovieCubeActivity0b extends NewtBaseActivity { + static String TAG = "MovieCubeActivity0a"; + + MouseAdapter showKeyboardMouseListener = new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if( e.getPointerCount() == 4 && e.getPressure(0, true) > 0.7f ) { + ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); + } + } + }; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + String[] streamLocs = new String[] { + System.getProperty("jnlp.media0_url2"), + System.getProperty("jnlp.media0_url1"), + System.getProperty("jnlp.media0_url0") }; + final URI streamLoc = getURI(streamLocs, 0, false); + if(null == streamLoc) { throw new RuntimeException("no media reachable: "+Arrays.asList(streamLocs)); } + + // also initializes JOGL + final GLCapabilities capsMain = new GLCapabilities(GLProfile.getGL2ES2()); + capsMain.setNumSamples(4); + capsMain.setSampleBuffers(true); + capsMain.setBackgroundOpaque(false); + + // screen for layout params .. + final com.jogamp.newt.Display dpy = NewtFactory.createDisplay(null); + final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0); + scrn.addReference(); + + try { + final Animator anim = new Animator(); + + // Main + final GLWindow glWindowMain = GLWindow.create(scrn, capsMain); + glWindowMain.setFullscreen(true); + setContentView(getWindow(), glWindowMain); + anim.add(glWindowMain); + glWindowMain.setVisible(true); + glWindowMain.addMouseListener(showKeyboardMouseListener); + + final MovieCube demoMain = new MovieCube(MovieCube.zoom_def, 0f, 0f, true); + final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer(); + mPlayer.addEventListener(new GLMediaEventListener() { + @Override + public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { + } + + @Override + public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + System.err.println("MovieCubeActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); + System.err.println("MovieCubeActivity0 State: "+mp); + if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { + glWindowMain.addGLEventListener(demoMain); + anim.setUpdateFPSFrames(60, null); + anim.resetFPSCounter(); + } + if( 0 != ( GLMediaEventListener.EVENT_CHANGE_PLAY & event_mask ) ) { + anim.resetFPSCounter(); + } + if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) { + final StreamException se = mPlayer.getStreamException(); + if( null != se ) { + se.printStackTrace(); + } + getActivity().finish(); + } + } + }); + demoMain.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0); + } catch (IOException e) { + e.printStackTrace(); + } + + scrn.removeReference(); + + Log.d(TAG, "onCreate - X"); + } + + static URI getURI(String path[], int off, boolean checkAvail) { + URI uri = null; + for(int i=off; null==uri && i0) { + if( checkAvail ) { + final URLConnection uc = IOUtil.getResource(path[i], null); + if( null != uc ) { + try { + uri = uc.getURL().toURI(); + } catch (URISyntaxException e) { + uri = null; + } + if( uc instanceof HttpURLConnection ) { + ((HttpURLConnection)uc).disconnect(); + } + } + } else { + try { + uri = new URI(path[i]); + } catch (URISyntaxException e) { + uri = null; + } + } + Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uri)); + } + } + return uri; + } +} diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0.java deleted file mode 100644 index 1e0d6067f..000000000 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2012 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.android; - -import java.util.Arrays; -import java.util.List; - -import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; - -public class MovieCubeActivityLauncher0 extends LauncherUtil.BaseActivityLauncher { - - static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; - static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - - @Override - public void init() { - final OrderedProperties props = getProperties(); - // props.setProperty("jnlp.media0_url2", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v"); - props.setProperty("jnlp.media0_url2", ""); - props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"); - props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4"); - props.setProperty("jnlp.media1_url0", "http://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"); - // props.setProperty("jogamp.debug.JNILibLoader", "true"); - // props.setProperty("jogamp.debug.NativeLibrary", "true"); - // props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); - // props.setProperty("jogamp.debug.IOUtil", "true"); - // props.setProperty("jogamp.debug.Lock", "true"); - // props.setProperty("jogamp.debug.Lock.TraceLock", "true"); - // props.setProperty("nativewindow.debug", "all"); - // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); - // props.setProperty("jogl.debug", "all"); - // props.setProperty("jogl.debug.GLProfile", "true"); - // props.setProperty("jogl.debug.GLDrawable", "true"); - // props.setProperty("jogl.debug.GLContext", "true"); - props.setProperty("jogl.debug.GLMediaPlayer", "true"); - props.setProperty("jogl.debug.GLSLCode", "true"); - // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); - // props.setProperty("jogl.debug.GLSLState", "true"); - // props.setProperty("jogl.debug.DebugGL", "true"); - // props.setProperty("jogl.debug.TraceGL", "true"); - // props.setProperty("newt.debug", "all"); - // props.setProperty("newt.debug.Window", "true"); - // props.setProperty("newt.debug.Window.MouseEvent", "true"); - // props.setProperty("newt.debug.Window.KeyEvent", "true"); - props.setProperty("jogamp.debug.IOUtil", "true"); - } - - @Override - public String getActivityName() { - return demo; - } - - @Override - public List getSysPackages() { - return Arrays.asList(sys_pkgs); - } - - @Override - public List getUsrPackages() { - return Arrays.asList(usr_pkgs); - } -} diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0a.java new file mode 100644 index 000000000..a850e42aa --- /dev/null +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0a.java @@ -0,0 +1,88 @@ +/** + * Copyright 2012 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.android; + +import java.util.Arrays; +import java.util.List; + +import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; + +public class MovieCubeActivityLauncher0a extends LauncherUtil.BaseActivityLauncher { + + static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0a"; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; + + @Override + public void init() { + final OrderedProperties props = getProperties(); + // props.setProperty("jnlp.media0_url2", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v"); + props.setProperty("jnlp.media0_url2", ""); + props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"); + props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4"); + props.setProperty("jnlp.media1_url0", "http://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"); + // props.setProperty("jogamp.debug.JNILibLoader", "true"); + // props.setProperty("jogamp.debug.NativeLibrary", "true"); + // props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); + // props.setProperty("jogamp.debug.IOUtil", "true"); + // props.setProperty("jogamp.debug.Lock", "true"); + // props.setProperty("jogamp.debug.Lock.TraceLock", "true"); + // props.setProperty("nativewindow.debug", "all"); + // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); + // props.setProperty("jogl.debug", "all"); + // props.setProperty("jogl.debug.GLProfile", "true"); + // props.setProperty("jogl.debug.GLDrawable", "true"); + // props.setProperty("jogl.debug.GLContext", "true"); + props.setProperty("jogl.debug.GLMediaPlayer", "true"); + props.setProperty("jogl.debug.GLSLCode", "true"); + // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + // props.setProperty("jogl.debug.GLSLState", "true"); + // props.setProperty("jogl.debug.DebugGL", "true"); + // props.setProperty("jogl.debug.TraceGL", "true"); + // props.setProperty("newt.debug", "all"); + // props.setProperty("newt.debug.Window", "true"); + // props.setProperty("newt.debug.Window.MouseEvent", "true"); + // props.setProperty("newt.debug.Window.KeyEvent", "true"); + props.setProperty("jogamp.debug.IOUtil", "true"); + } + + @Override + public String getActivityName() { + return demo; + } + + @Override + public List getSysPackages() { + return Arrays.asList(sys_pkgs); + } + + @Override + public List getUsrPackages() { + return Arrays.asList(usr_pkgs); + } +} diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0b.java new file mode 100644 index 000000000..8d8711319 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher0b.java @@ -0,0 +1,88 @@ +/** + * Copyright 2012 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.android; + +import java.util.Arrays; +import java.util.List; + +import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; + +public class MovieCubeActivityLauncher0b extends LauncherUtil.BaseActivityLauncher { + + static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0b"; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; + + @Override + public void init() { + final OrderedProperties props = getProperties(); + // props.setProperty("jnlp.media0_url2", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v"); + props.setProperty("jnlp.media0_url2", ""); + props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"); + props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4"); + props.setProperty("jnlp.media1_url0", "http://archive.org/download/ElephantsDream/ed_1024_512kb.mp4"); + // props.setProperty("jogamp.debug.JNILibLoader", "true"); + // props.setProperty("jogamp.debug.NativeLibrary", "true"); + // props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); + // props.setProperty("jogamp.debug.IOUtil", "true"); + // props.setProperty("jogamp.debug.Lock", "true"); + // props.setProperty("jogamp.debug.Lock.TraceLock", "true"); + // props.setProperty("nativewindow.debug", "all"); + // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); + // props.setProperty("jogl.debug", "all"); + // props.setProperty("jogl.debug.GLProfile", "true"); + // props.setProperty("jogl.debug.GLDrawable", "true"); + // props.setProperty("jogl.debug.GLContext", "true"); + props.setProperty("jogl.debug.GLMediaPlayer", "true"); + props.setProperty("jogl.debug.GLSLCode", "true"); + // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + // props.setProperty("jogl.debug.GLSLState", "true"); + // props.setProperty("jogl.debug.DebugGL", "true"); + // props.setProperty("jogl.debug.TraceGL", "true"); + // props.setProperty("newt.debug", "all"); + // props.setProperty("newt.debug.Window", "true"); + // props.setProperty("newt.debug.Window.MouseEvent", "true"); + // props.setProperty("newt.debug.Window.KeyEvent", "true"); + props.setProperty("jogamp.debug.IOUtil", "true"); + } + + @Override + public String getActivityName() { + return demo; + } + + @Override + public List getSysPackages() { + return Arrays.asList(sys_pkgs); + } + + @Override + public List getUsrPackages() { + return Arrays.asList(usr_pkgs); + } +} diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java index c4eea084a..5eab8a8e1 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java @@ -34,7 +34,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieCubeActivityLauncher1a extends LauncherUtil.BaseActivityLauncher { - static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0"; + static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0a"; static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java index 26b61dd16..1e4c2c72f 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java @@ -34,7 +34,7 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class MovieCubeActivityLauncher1b extends LauncherUtil.BaseActivityLauncher { - static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0"; + static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0a"; static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java index b5a9ce580..38c8b36d6 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.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,7 +20,7 @@ * 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. @@ -57,7 +57,7 @@ import android.util.Log; public class MovieSimpleActivity0 extends NewtBaseActivity { static String TAG = "MovieSimpleActivity0"; - + MouseAdapter toFrontMouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { Object src = e.getSource(); @@ -65,43 +65,45 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { ((Window)src).requestFocus(false); } } }; - + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - - final String[] streamLocs = new String[] { + + final String[] streamLocs = new String[] { System.getProperty("jnlp.media0_url2"), System.getProperty("jnlp.media0_url1"), - System.getProperty("jnlp.media0_url0") }; + System.getProperty("jnlp.media0_url0") }; final URI streamLoc = getURI(streamLocs, 0, false); if(null == streamLoc) { throw new RuntimeException("no media reachable: "+Arrays.asList(streamLocs)); } - + // also initializes JOGL final GLCapabilities capsMain = new GLCapabilities(GLProfile.getGL2ES2()); + capsMain.setNumSamples(4); + capsMain.setSampleBuffers(true); capsMain.setBackgroundOpaque(false); // screen for layout params .. final com.jogamp.newt.Display dpy = NewtFactory.createDisplay(null); final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0); scrn.addReference(); - + final Animator anim = new Animator(); - - // Main + + // Main final GLWindow glWindowMain = GLWindow.create(scrn, capsMain); glWindowMain.setFullscreen(true); setContentView(getWindow(), glWindowMain); anim.add(glWindowMain); glWindowMain.setVisible(true); - + final MovieSimple demoMain = new MovieSimple(null); demoMain.setScaleOrig(true); final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer(); - mPlayer.addEventListener( new GLMediaPlayer.GLMediaEventListener() { + mPlayer.addEventListener( new GLMediaPlayer.GLMediaEventListener() { @Override public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { } - + @Override public void attributesChanged(GLMediaPlayer mp, int event_mask, long when) { System.err.println("MovieSimpleActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); @@ -114,19 +116,19 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) { final StreamException se = mPlayer.getStreamException(); if( null != se ) { - se.printStackTrace(); + se.printStackTrace(); } getActivity().finish(); } } }); demoMain.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0); - + scrn.removeReference(); Log.d(TAG, "onCreate - X"); } - + static URI getURI(String path[], int off, boolean checkAvail) { URI uri = null; for(int i=off; null==uri && i "+buttonXSize+" x "+buttonYSize); final float xstart = 0f; final float ystart = 0f; final float diffX = 1.2f * buttonXSize; @@ -545,7 +549,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { crossHairCtr.setEnabled(true); crossHairCtr.translate(0f, 0f, -1f); - initButtons(gl, renderer); + initButtons(gl, drawable.getWidth(), drawable.getHeight(), renderer); for(int i=0; i */ public MovieCube() throws IOException, URISyntaxException { - this(zoom_def, 0f, 0f); + this(zoom_def, 0f, 0f, true); mPlayer.addEventListener(new GLMediaEventListener() { @Override @@ -136,11 +137,14 @@ public class MovieCube implements GLEventListener { } } - /** Custom constructor, user needs to issue {@link #initStream(URI, int, int, int)} afterwards. */ - public MovieCube(float zoom0, float rotx, float roty) throws IOException { + /** + * Custom constructor, user needs to issue {@link #initStream(URI, int, int, int)} afterwards. + */ + public MovieCube(float zoom0, float rotx, float roty, boolean showText) throws IOException { this.zoom0 = zoom0; this.rotx = rotx; this.roty = roty; + this.showText = showText; mPlayer = GLMediaPlayerFactory.createDefault(); } @@ -166,9 +170,9 @@ public class MovieCube implements GLEventListener { private final GLRegion regionFPS; private float pixelSize, underlineSize; - InfoTextRendererGLELBase() { + InfoTextRendererGLELBase(final int rmode) { // FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO - super(Region.VBAA_RENDERING_BIT, MovieCube.this.textSampleCount); + super(rmode, MovieCube.this.textSampleCount); // NOTE_ALPHA_BLENDING: We go w/o alpha and blending! // this.setRendererCallbacks(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); regionFPS = GLRegion.create(usrRenderModes); @@ -229,7 +233,9 @@ public class MovieCube implements GLEventListener { "; underlineSize "+underlineSize+" "+(pixelScale*underlineSize)+ "; yoff "+yoff1+", yoff2 "+yoff2); */ - final String text1 = String.format("%03.1f/%03.1f s, %s (%01.2fx, vol %01.2f), a %01.2f, fps %02.1f -> %02.1f / %02.1f, v-sync %d", + final GL gl = drawable.getGL(); + final String ptsPrec = gl.isGLES() ? "3.0" : "3.1"; + final String text1 = String.format("%0"+ptsPrec+"f/%0"+ptsPrec+"f s, %s (%01.2fx, vol %01.2f), a %01.2f, fps %02.1f -> %02.1f / %02.1f, v-sync %d", pts, mPlayer.getDuration() / 1000f, mPlayer.getState().toString().toLowerCase(), mPlayer.getPlaySpeed(), mPlayer.getAudioVolume(), aspect, mPlayer.getFramerate(), lfps, tfps, swapIntervalSet); @@ -239,14 +245,15 @@ public class MovieCube implements GLEventListener { mPlayer.getVID(), mPlayer.getVideoBitrate()/1000, mPlayer.getVideoCodec()); final String text4 = mPlayer.getURI().getRawPath(); if( displayOSD && null != renderer ) { - drawable.getGL().glClearColor(1.0f, 1.0f, 1.0f, 0.0f); + gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f); renderString(drawable, font, pixelSize, text1, 1 /* col */, -1 /* row */, -1+z_diff, yoff1, 1f+z_diff, regionFPS); // no-cache renderString(drawable, font, pixelSize, text2, 1 /* col */, 0 /* row */, -1+z_diff, yoff2, 1f+z_diff, true); renderString(drawable, font, pixelSize, text3, 1 /* col */, 1 /* row */, -1+z_diff, yoff2, 1f+z_diff, true); renderString(drawable, font, pixelSize, text4, 1 /* col */, 2 /* row */, -1+z_diff, yoff2, 1f+z_diff, true); } } }; - private final InfoTextRendererGLELBase textRendererGLEL = new InfoTextRendererGLELBase(); + private InfoTextRendererGLELBase textRendererGLEL = null; + final boolean showText; private boolean displayOSD = true; private final KeyListener keyAction = new KeyAdapter() { @@ -370,7 +377,11 @@ public class MovieCube implements GLEventListener { added = true; } else { added = false; } System.err.println("MC.init: kl-added "+added+", "+drawable.getClass().getName()); - drawable.addGLEventListener(textRendererGLEL); + + if( showText ) { + textRendererGLEL = new InfoTextRendererGLELBase(drawable.getChosenGLCapabilities().getSampleBuffers() ? 0 : Region.VBAA_RENDERING_BIT); + drawable.addGLEventListener(textRendererGLEL); + } } @Override @@ -382,7 +393,10 @@ public class MovieCube implements GLEventListener { @Override public void dispose(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" MovieCube.dispose ... "); - drawable.disposeGLEventListener(textRendererGLEL, true); + if( null != textRendererGLEL ) { + drawable.disposeGLEventListener(textRendererGLEL, true); + textRendererGLEL = null; + } disposeImpl(drawable, true); } @@ -507,7 +521,7 @@ public class MovieCube implements GLEventListener { System.err.println("forceGLDef "+forceGLDef); System.err.println("swapInterval "+swapInterval); - final MovieCube mc = new MovieCube(zoom_def, 0f, 0f); + final MovieCube mc = new MovieCube(zoom_def, 0f, 0f, true); mc.setSwapInterval(swapInterval); final GLProfile glp; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java index f0e9c4bde..c5160ffb1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java @@ -139,9 +139,9 @@ public class MovieSimple implements GLEventListener { private final float fontSize = 10f; private final GLRegion regionFPS; - InfoTextRendererGLELBase() { + InfoTextRendererGLELBase(int rmode) { // FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO - super(Region.VBAA_RENDERING_BIT, textSampleCount); + super(rmode, textSampleCount); // NOTE_ALPHA_BLENDING: We go w/o alpha and blending! // this.setRendererCallbacks(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); regionFPS = GLRegion.create(usrRenderModes); @@ -178,7 +178,9 @@ public class MovieSimple implements GLEventListener { final float aspect = (float)mPlayer.getWidth() / (float)mPlayer.getHeight(); - final String text1 = String.format("%03.1f/%03.1f s, %s (%01.2fx, vol %01.2f), a %01.2f, fps %02.1f -> %02.1f / %02.1f, v-sync %d", + final GL gl = drawable.getGL(); + final String ptsPrec = gl.isGLES() ? "3.0" : "3.1"; + final String text1 = String.format("%0"+ptsPrec+"f/%0"+ptsPrec+"f s, %s (%01.2fx, vol %01.2f), a %01.2f, fps %02.1f -> %02.1f / %02.1f, v-sync %d", pts, mPlayer.getDuration() / 1000f, mPlayer.getState().toString().toLowerCase(), mPlayer.getPlaySpeed(), mPlayer.getAudioVolume(), aspect, mPlayer.getFramerate(), lfps, tfps, swapIntervalSet); @@ -196,7 +198,7 @@ public class MovieSimple implements GLEventListener { renderString(drawable, font, pixelSize, text4, 1 /* col */, -2 /* row */, 0, height, -1, true); } } }; - private final InfoTextRendererGLELBase textRendererGLEL = new InfoTextRendererGLELBase(); + private InfoTextRendererGLELBase textRendererGLEL = null; private boolean displayOSD = true; private final MouseListener mouseAction = new MouseAdapter() { @@ -593,6 +595,7 @@ public class MovieSimple implements GLEventListener { winWidth = window.getWidth(); winHeight = window.getHeight(); } + textRendererGLEL = new InfoTextRendererGLELBase(drawable.getChosenGLCapabilities().getSampleBuffers() ? 0 : Region.VBAA_RENDERING_BIT); drawable.addGLEventListener(textRendererGLEL); } @@ -689,6 +692,7 @@ public class MovieSimple implements GLEventListener { @Override public void dispose(GLAutoDrawable drawable) { drawable.disposeGLEventListener(textRendererGLEL, true); + textRendererGLEL = null; disposeImpl(drawable, true); } -- cgit v1.2.3