diff options
author | Rami Santina <[email protected]> | 2011-09-30 22:37:24 +0300 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-09-30 22:37:24 +0300 |
commit | 274cabe94fef1fbea3d77407d7ee532235376022 (patch) | |
tree | e5bd348aae68c59344c70ce65ab6641f018877de /src | |
parent | 18817fe6d3b85fcb672a2dd244f3fad3fdab2aa3 (diff) | |
parent | efb2e94cfafc3eab39f729f2445006fc4e86b986 (diff) |
Merge branch 'android-tegra-playground' of git://github.com/sgothel/jogl into android-tegra-playground
Diffstat (limited to 'src')
11 files changed, 316 insertions, 28 deletions
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java index 81bc26572..12574c8d0 100644 --- a/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java +++ b/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java @@ -54,21 +54,26 @@ public abstract class NEWTLauncherActivity extends Activity { Log.d(TAG, "onCreate - S"); super.onCreate(savedInstanceState); + System.setProperty("jogamp.debug.JNILibLoader", "true"); + System.setProperty("jogamp.debug.NativeLibrary", "true"); + // System.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); + // System.setProperty("jogamp.debug.IOUtil", "true"); + // System.setProperty("nativewindow.debug", "all"); + // System.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); + // System.setProperty("jogl.debug", "all"); - System.setProperty("jogl.debug.GLProfile", "true"); + // System.setProperty("jogl.debug.GLProfile", "true"); System.setProperty("jogl.debug.GLDrawable", "true"); + System.setProperty("jogl.debug.GLSLCode", "true"); + System.setProperty("jogl.debug.DebugGL", "true"); + System.setProperty("jogl.debug.TraceGL", "true"); + // System.setProperty("newt.debug", "all"); System.setProperty("newt.debug.Window", "true"); // System.setProperty("newt.debug.Window.MouseEvent", "true"); // System.setProperty("newt.debug.Window.KeyEvent", "true"); - // System.setProperty("jogamp.debug.IOUtil", "true"); - System.setProperty("jogamp.debug.JNILibLoader", "true"); - System.setProperty("jogamp.debug.NativeLibrary", "true"); - // System.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); - System.setProperty("jogl.debug.GLSLCode", "true"); - System.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); - + ClassLoader cl = ClassLoaderUtil.createJogampClassLoaderSingleton(this, getUserPackageName()); if(null != cl) { try { diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherElektronActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherElektronActivity.java new file mode 100644 index 000000000..85a751ea6 --- /dev/null +++ b/src/android/com/jogamp/android/launcher/NEWTLauncherElektronActivity.java @@ -0,0 +1,15 @@ +package com.jogamp.android.launcher; + +public class NEWTLauncherElektronActivity extends NEWTLauncherActivity { + static String demo = "com.jogamp.opengl.test.android.NEWTElektronActivity"; + static String pkg = "com.jogamp.opengl.test"; + + @Override + public String getUserActivityName() { + return demo; + } + @Override + public String getUserPackageName() { + return pkg; + } +} diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES1Activity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES1Activity.java new file mode 100644 index 000000000..af5270569 --- /dev/null +++ b/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES1Activity.java @@ -0,0 +1,15 @@ +package com.jogamp.android.launcher; + +public class NEWTLauncherRedSquareES1Activity extends NEWTLauncherActivity { + static String demo = "com.jogamp.opengl.test.android.NEWTRedSquareES1Activity"; + static String pkg = "com.jogamp.opengl.test"; + + @Override + public String getUserActivityName() { + return demo; + } + @Override + public String getUserPackageName() { + return pkg; + } +} diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES2Activity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES2Activity.java new file mode 100644 index 000000000..03e2ad7d3 --- /dev/null +++ b/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES2Activity.java @@ -0,0 +1,15 @@ +package com.jogamp.android.launcher; + +public class NEWTLauncherRedSquareES2Activity extends NEWTLauncherActivity { + static String demo = "com.jogamp.opengl.test.android.NEWTRedSquareES2Activity"; + static String pkg = "com.jogamp.opengl.test"; + + @Override + public String getUserActivityName() { + return demo; + } + @Override + public String getUserPackageName() { + return pkg; + } +} diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 47a453484..a3aa369dd 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -428,6 +428,7 @@ public abstract class GLContext { public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); } public final boolean isGLCoreProfile() { return ( 0 != ( CTX_PROFILE_CORE & ctxOptions ) ); } public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); } + public final boolean isGLDebugEnabled() { return ( 0 != ( CTX_OPTION_DEBUG & ctxOptions ) ); } public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); } /** diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java index 926651c1d..7a12e52c9 100644 --- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java @@ -39,6 +39,8 @@ package javax.media.opengl; import java.lang.reflect.*; import java.util.StringTokenizer; +import com.jogamp.common.util.ReflectionUtil; + import jogamp.opengl.*; /** @@ -70,10 +72,10 @@ public class GLPipelineFactory { * @param downstream is always the 1st argument for the upstream constructor * @param additionalArgs additional arguments for the upstream constructor */ - public static final GL create(String pipelineClazzBaseName, Class reqInterface, GL downstream, Object[] additionalArgs) { - Class downstreamClazz = downstream.getClass(); - Class upstreamClazz = null; - Class interfaceClazz = null; + public static final GL create(String pipelineClazzBaseName, Class<?> reqInterface, GL downstream, Object[] additionalArgs) { + Class<?> downstreamClazz = downstream.getClass(); + Class<?> upstreamClazz = null; + Class<?> interfaceClazz = null; if(DEBUG) { System.out.println("GLPipelineFactory: Start "+downstreamClazz.getName()+", req. Interface: "+reqInterface+" -> "+pipelineClazzBaseName); @@ -83,7 +85,7 @@ public class GLPipelineFactory { do { // For all interfaces: right -> left == child -> parent // It is important that this matches with the gluegen cfg file's 'Implements' clause ! - Class[] clazzes = downstreamClazz.getInterfaces(); + Class<?>[] clazzes = downstreamClazz.getInterfaces(); for(int i=clazzes.length-1; null==upstreamClazz && i>=0; i--) { if(DEBUG) { System.out.println("GLPipelineFactory: Try "+downstreamClazz.getName()+" Interface["+i+"]: "+clazzes[i].getName()); @@ -124,7 +126,7 @@ public class GLPipelineFactory { System.out.println("GLPipelineFactory: Got : "+ upstreamClazz.getName()+", base interface: "+interfaceClazz.getName()); } - Class[] cstrArgTypes = new Class[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; + Class<?>[] cstrArgTypes = new Class<?>[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; { int i = 0; cstrArgTypes[i++] = interfaceClazz; @@ -132,13 +134,8 @@ public class GLPipelineFactory { cstrArgTypes[i++] = additionalArgs[j].getClass(); } } - Constructor cstr = null; - try { - cstr = upstreamClazz.getDeclaredConstructor( cstrArgTypes ); - } catch(NoSuchMethodException nsme) { - throw new GLException("Couldn't find pipeline constructor: " + upstreamClazz.getName() + - " ( "+getArgsClassNameList(downstreamClazz, additionalArgs) +" )"); - } + // throws exception if cstr not found! + Constructor<?> cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes); Object instance = null; try { Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; @@ -161,7 +158,7 @@ public class GLPipelineFactory { return (GL) instance; } - private static final String getArgsClassNameList(Class arg0, Object[] args) { + private static final String getArgsClassNameList(Class<?> arg0, Object[] args) { StringBuffer sb = new StringBuffer(); sb.append(arg0.getName()); if(args!=null) { @@ -173,7 +170,7 @@ public class GLPipelineFactory { return sb.toString(); } - private static final Class getUpstreamClazz(Class downstreamClazz, String pipelineClazzBaseName) { + private static final Class<?> getUpstreamClazz(Class<?> downstreamClazz, String pipelineClazzBaseName) { String downstreamClazzName = downstreamClazz.getName(); StringTokenizer st = new StringTokenizer(downstreamClazzName, "."); @@ -183,7 +180,7 @@ public class GLPipelineFactory { } String upstreamClazzName = pipelineClazzBaseName+downstreamClazzBaseName; - Class upstreamClazz = null; + Class<?> upstreamClazz = null; try { upstreamClazz = Class.forName(upstreamClazzName, true, GLPipelineFactory.class.getClassLoader()); } catch (Throwable e) { e.printStackTrace(); } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 6f2786b03..99693aabe 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -380,7 +380,10 @@ public abstract class GLContextImpl extends GLContext { if (null == getGLDrawable().getChosenGLCapabilities()) { throw new GLException("drawable has no chosen GLCapabilities: "+getGLDrawable()); } - additionalCtxCreationFlags |= DEBUG_GL ? GLContext.CTX_OPTION_DEBUG : 0 ; + if(DEBUG_GL) { + // only impacts w/ createContextARB(..) + additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG ; + } } lockConsiderFailFast(); @@ -408,14 +411,17 @@ public abstract class GLContextImpl extends GLContext { // throws an GLException if not getGLDrawable().getGLProfile().verifyEquality(gl.getGLProfile()); + glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() ); + if(DEBUG_GL) { gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); - glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener(true)); + if(glDebugHandler.isEnabled()) { + glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener(true)); + } } if(TRACE_GL) { gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); } - glDebugHandler.init(0 != (additionalCtxCreationFlags & GLContext.CTX_OPTION_DEBUG)); } /* FIXME: refactor dependence on Java 2D / JOGL bridge diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java index 9ca573536..8ca0c016d 100644 --- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java +++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java @@ -99,9 +99,14 @@ public class GLDebugMessageHandler { } public void init(boolean enable) { + if(DEBUG) { + System.err.println("GLDebugMessageHandler.init("+enable+")"); + } init(); if(isAvailable()) { enableImpl(enable); + } else if(DEBUG) { + System.err.println("GLDebugMessageHandler.init("+enable+") .. n/a"); } } @@ -111,6 +116,13 @@ public class GLDebugMessageHandler { return; } + if( !ctx.isGLDebugEnabled() ) { + if(DEBUG) { + System.err.println("GLDebugMessageHandler: GL DEBUG not set in ARB ctx options: "+ctx.getGLVersion()); + } + return; + } + if( ctx.isExtensionAvailable(GL_ARB_debug_output) ) { extName = GL_ARB_debug_output; extType = EXT_ARB; @@ -124,7 +136,7 @@ public class GLDebugMessageHandler { if(0 == extType) { if(DEBUG) { - System.err.println("GLDebugMessageHandler: No extension available!"); + System.err.println("GLDebugMessageHandler: No extension available! "+ctx.getGLVersion()); } return; } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java new file mode 100644 index 000000000..b36f567bb --- /dev/null +++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java @@ -0,0 +1,76 @@ +/** + * 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 javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; + +import jogamp.newt.driver.android.NewtBaseActivity; + +import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.event.ScreenModeListener; +import com.jogamp.newt.opengl.GLWindow; + +import com.jogamp.opengl.test.junit.jogl.demos.es2.ElektronenMultiplizierer; +import com.jogamp.opengl.util.Animator; + +import android.os.Bundle; +import android.util.Log; + +public class NEWTElektronActivity extends NewtBaseActivity { + static String TAG = "NEWTElektronActivity"; + + @Override + public void onCreate(Bundle savedInstanceState) { + Log.d(TAG, "onCreate - 0"); + super.onCreate(savedInstanceState); + + // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) + GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); + // caps.setAlphaBits(4); + // caps.setNumSamples(4); + // caps.setSampleBuffers(true); + Log.d(TAG, "req caps: "+caps); + GLWindow glWindow = GLWindow.create(caps); + setContentView(glWindow); + + glWindow.addGLEventListener(new ElektronenMultiplizierer()); + glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() { + public void screenModeChangeNotify(ScreenMode sm) { } + public void screenModeChanged(ScreenMode sm, boolean success) { + System.err.println("ScreenMode Changed: "+sm); + } + }); + glWindow.setVisible(true); + Animator animator = new Animator(glWindow); + animator.setUpdateFPSFrames(60, System.err); + setAnimator(animator); + + Log.d(TAG, "onCreate - X"); + } +} diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java new file mode 100644 index 000000000..bf5fcce49 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java @@ -0,0 +1,73 @@ +/** + * 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 javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; + +import jogamp.newt.driver.android.NewtBaseActivity; + +import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.event.ScreenModeListener; +import com.jogamp.newt.opengl.GLWindow; + +import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1; +import com.jogamp.opengl.util.Animator; + +import android.os.Bundle; +import android.util.Log; + +public class NEWTRedSquareES1Activity extends NewtBaseActivity { + static String TAG = "NEWTGearsES1Activity"; + + @Override + public void onCreate(Bundle savedInstanceState) { + Log.d(TAG, "onCreate - 0"); + super.onCreate(savedInstanceState); + + // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) + GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); + Log.d(TAG, "req caps: "+caps); + GLWindow glWindow = GLWindow.create(caps); + setContentView(glWindow); + + glWindow.addGLEventListener(new RedSquareES1(1)); + glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() { + public void screenModeChangeNotify(ScreenMode sm) { } + public void screenModeChanged(ScreenMode sm, boolean success) { + System.err.println("ScreenMode Changed: "+sm); + } + }); + glWindow.setVisible(true); + Animator animator = new Animator(glWindow); + animator.setUpdateFPSFrames(60, System.err); + setAnimator(animator); + + Log.d(TAG, "onCreate - X"); + } +} diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java new file mode 100644 index 000000000..fcffc5244 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java @@ -0,0 +1,73 @@ +/** + * 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 javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; + +import jogamp.newt.driver.android.NewtBaseActivity; + +import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.event.ScreenModeListener; +import com.jogamp.newt.opengl.GLWindow; + +import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2; +import com.jogamp.opengl.util.Animator; + +import android.os.Bundle; +import android.util.Log; + +public class NEWTRedSquareES2Activity extends NewtBaseActivity { + static String TAG = "NEWTGearsES2Activity"; + + @Override + public void onCreate(Bundle savedInstanceState) { + Log.d(TAG, "onCreate - 0"); + super.onCreate(savedInstanceState); + + // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) + GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); + Log.d(TAG, "req caps: "+caps); + GLWindow glWindow = GLWindow.create(caps); + setContentView(glWindow); + + glWindow.addGLEventListener(new RedSquareES2(1)); + glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() { + public void screenModeChangeNotify(ScreenMode sm) { } + public void screenModeChanged(ScreenMode sm, boolean success) { + System.err.println("ScreenMode Changed: "+sm); + } + }); + glWindow.setVisible(true); + Animator animator = new Animator(glWindow); + animator.setUpdateFPSFrames(60, System.err); + setAnimator(animator); + + Log.d(TAG, "onCreate - X"); + } +} |