diff options
author | Sven Gothel <[email protected]> | 2011-09-28 19:04:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-28 19:04:53 +0200 |
commit | 22e869ae8b6a44e2f06f73b557a0b8d3bb0da49f (patch) | |
tree | ba1fc3121f5481147caf83d944af3a9ca008d96a | |
parent | cc9ab3d4e1ed2c7b9d38a9599a37abd05be36cc0 (diff) |
Android/Demos: Add ElektronenMultiplizierer (fix shader and keylistener add/remove)
-rw-r--r-- | make/resources/android/AndroidManifest-launcher.xml | 12 | ||||
-rw-r--r-- | make/resources/android/res-launcher/values/strings.xml | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | make/scripts/adb-install-all.sh | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | make/scripts/adb-uninstall-all.sh | 2 | ||||
-rwxr-xr-x | make/scripts/tests.sh | 6 | ||||
-rw-r--r-- | src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java | 3 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java | 2 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java | 12 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp | 28 |
9 files changed, 43 insertions, 26 deletions
diff --git a/make/resources/android/AndroidManifest-launcher.xml b/make/resources/android/AndroidManifest-launcher.xml index a69e6f865..cbd2063a6 100644 --- a/make/resources/android/AndroidManifest-launcher.xml +++ b/make/resources/android/AndroidManifest-launcher.xml @@ -49,6 +49,18 @@ <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> + <activity android:name="com.jogamp.android.launcher.NEWTLauncherElektronActivity" + android:finishOnTaskLaunch="true" + android:launchMode="singleTop" + android:configChanges="keyboardHidden|orientation" + android:label="@string/activity_elektro_name" + android:description="@string/activity_elektro_descr" + > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> </application> </manifest> diff --git a/make/resources/android/res-launcher/values/strings.xml b/make/resources/android/res-launcher/values/strings.xml index e9bb75b65..595752728 100644 --- a/make/resources/android/res-launcher/values/strings.xml +++ b/make/resources/android/res-launcher/values/strings.xml @@ -9,4 +9,6 @@ <string name="activity_gearses2_descr">GearsES2</string> <string name="activity_graphui_name">GraphUI</string> <string name="activity_graphui_descr">GraphUI</string> + <string name="activity_elektro_name">Elektro</string> + <string name="activity_elektro_descr">Elektro</string> </resources> diff --git a/make/scripts/adb-install-all.sh b/make/scripts/adb-install-all.sh index e266ae22d..ac18a84ed 100644..100755 --- a/make/scripts/adb-install-all.sh +++ b/make/scripts/adb-install-all.sh @@ -1,4 +1,4 @@ -adb install ../../gluegen/build-android-armv7/gluegen-rt.apk +#adb install ../../gluegen/build-android-armv7/gluegen-rt.apk adb install ../build-android-armv7/jar/jogl.all-android.apk adb install ../build-android-armv7/jar/jogl.android-launcher.apk adb install ../build-android-armv7/jar/jogl.test.apk diff --git a/make/scripts/adb-uninstall-all.sh b/make/scripts/adb-uninstall-all.sh index db079fcf0..059b1d5aa 100644..100755 --- a/make/scripts/adb-uninstall-all.sh +++ b/make/scripts/adb-uninstall-all.sh @@ -1,4 +1,4 @@ -adb uninstall com.jogamp.common +#adb uninstall com.jogamp.common adb uninstall javax.media.opengl adb uninstall com.jogamp.android.launcher adb uninstall com.jogamp.opengl.test diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index a3e8c92f3..2182ad0dd 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -69,7 +69,7 @@ function jrun() { #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GraphicsConfiguration" #D_ARGS="-Dnewt.debug.EDT" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all" - D_ARGS="-Djogl.debug=all -Dnewt.debug=all" + #D_ARGS="-Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext" #D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen" #D_ARGS="-Dnewt.debug.Window" @@ -246,11 +246,11 @@ function testawtmt() { #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo02 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo02 $* -testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo01 $* +#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBuffer01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $* # # regressions diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java index 86e98a38c..02ec1ea68 100644 --- a/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java +++ b/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java @@ -61,7 +61,8 @@ public abstract class NEWTLauncherActivity extends Activity { // 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"); + ClassLoader cl = ClassLoaderUtil.createJogampClassLoaderSingleton(this); if(null != cl) { try { diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java index f2e82f4ab..c0b358d07 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java @@ -69,7 +69,7 @@ public class NEWTGearsES1Activity extends NewtBaseActivity { }); glWindow.setVisible(true); animator = new Animator(glWindow); - // animator.setUpdateFPSFrames(60, System.err); + animator.setUpdateFPSFrames(60, System.err); Log.d(TAG, "onCreate - X"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java index 6fec015b0..52a98fde8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java @@ -225,9 +225,7 @@ public class ElektronenMultiplizierer implements GLEventListener { public void init(GLAutoDrawable drawable) { if(drawable instanceof GLWindow) { final GLWindow glw = (GLWindow) drawable; - if ( glw.getKeyListener(0) != timeShiftKeys ) { - glw.addKeyListener(0, timeShiftKeys); - } + glw.addKeyListener(0, timeShiftKeys); } GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.setSwapInterval(1); @@ -490,11 +488,15 @@ public class ElektronenMultiplizierer implements GLEventListener { gl.glViewport(0, 0, width, height); } - public void dispose(GLAutoDrawable inDrawable) { - GL2ES2 gl = inDrawable.getGL().getGL2ES2(); + public void dispose(GLAutoDrawable drawable) { + GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glDeleteFramebuffers(1, new int[] { mFrameBufferObjectID }, 0); gl.glDeleteTextures(1, new int[] { mFrameBufferTextureID }, 0); st.destroy(gl); + if(drawable instanceof GLWindow) { + final GLWindow glw = (GLWindow) drawable; + glw.removeKeyListener(timeShiftKeys); + } } // public BaseMusic getBaseMusic() { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp index d6739e8ca..948037e92 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp @@ -65,7 +65,7 @@ MEDIUMP vec3 distancefunction(MEDIUMP vec3 w) { MEDIUMP float d, t; MEDIUMP float md = 1000.0, cd = 0.0; //!P iterations (8) ... 2x see below - for (MEDIUMP int i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { w *= fractalplanerotationx; w = abs(w); t = w.x * phi3.z + w.y * phi3.y - w.z * phi3.x; @@ -90,7 +90,7 @@ MEDIUMP vec3 distancefunction(MEDIUMP vec3 w) { } } //!P max iterations (8) - return MEDIUMP vec3((length(w) - 2.0) * pow(scale, -8.0), md, cd); + return vec3((length(w) - 2.0) * pow(scale, -8.0), md, cd); } //calculate ray direction fragment coordinates @@ -116,7 +116,7 @@ MEDIUMP float ambientocclusion(MEDIUMP vec3 p, MEDIUMP vec3 n, MEDIUMP float eps //add little start distance to the surface MEDIUMP float d = 2.0 * eps; //!P ao iterations (5) ... - for (MEDIUMP int i = 0; i < 5; ++i) { + for (int i = 0; i < 5; ++i) { o -= (d - distancefunction(p + n * d).x) * k; d += eps; //fade ao when distance to the surface increases @@ -125,7 +125,7 @@ MEDIUMP float ambientocclusion(MEDIUMP vec3 p, MEDIUMP vec3 n, MEDIUMP float eps return clamp(o, 0.0, 1.0); } -MEDIUMP vec4 render(vec2 pixel) { +MEDIUMP vec4 render(MEDIUMP vec2 pixel) { MEDIUMP vec3 ray_direction = raydirection(pixel); //!P minimum ray length (6e-5) MEDIUMP float ray_length = 6e-5; @@ -146,7 +146,7 @@ MEDIUMP vec4 render(vec2 pixel) { ray_length = minmarch; ray = camerapositiondode + ray_length * ray_direction; //!P max number of raymarching steps (90); - for (MEDIUMP int i = 0; i < 90; i++) { + for (int i = 0; i < 90; i++) { steps = i; dist = distancefunction(ray); //!P X-) questionable surface smoothing (0.53) @@ -197,7 +197,7 @@ MEDIUMP vec4 render(vec2 pixel) { } MEDIUMP mat3 xmatrixrotation(MEDIUMP float angle) { - return MEDIUMP mat3( + return mat3( vec3(1.0, 0.0, 0.0), vec3(0.0, cos(angle), sin(angle)), vec3(0.0, -sin(angle), cos(angle)) @@ -205,7 +205,7 @@ MEDIUMP mat3 xmatrixrotation(MEDIUMP float angle) { } MEDIUMP mat3 ymatrixrotation(MEDIUMP float angle) { - return MEDIUMP mat3( + return mat3( vec3(cos(angle), 0.0, -sin(angle)), vec3( 0.0, 1.0, 0.0), vec3(sin(angle), 0.0, cos(angle)) @@ -221,7 +221,7 @@ MEDIUMP vec4 raymarch_orbittrap_image(MEDIUMP vec2 fragcoord) { MEDIUMP mat3 identitymatrix = mat3(1,0,0,0,1,0,0,0,1); MEDIUMP float sin_phi = sin(0.1*tm); MEDIUMP float cos_phi = cos(0.1*tm); - MEDIUMP mat3 zrot = MEDIUMP mat3( + MEDIUMP mat3 zrot = mat3( vec3( cos_phi, sin_phi, 0.0), vec3(-sin_phi, cos_phi, 0.0), vec3( 0.0, 0.0, 1.0) @@ -276,8 +276,8 @@ MEDIUMP vec4 orbitmapping(MEDIUMP vec4 c, MEDIUMP vec2 w) { //mandlebrot ... orbittrapscale = 0.325; } - vec2 sp = 0.5 + (w / orbittrapscale - orbittrapoffset); - vec4 s = texture2D(fb, sp); + MEDIUMP vec2 sp = 0.5 + (w / orbittrapscale - orbittrapoffset); + MEDIUMP vec4 s = texture2D(fb, sp); if (s.a > 0.0) { c = mix(c, s, s.a); } @@ -301,8 +301,8 @@ MEDIUMP vec4 orbittrap(MEDIUMP vec2 z) { //!P max iterations for julia (128) ... 2x parameter - see below! for (int i = 0; i<128; i++) { n += 1.0; - float r = pow(length(z), powerjulia); - float a = powerjulia * atan(z.y, z.x); + MEDIUMP float r = pow(length(z), powerjulia); + MEDIUMP float a = powerjulia * atan(z.y, z.x); z = vec2(cos(a) * r, sin(a) * r) +c; //!P min iterations for julia (1.0) ... if (n >= 1.0) { @@ -349,9 +349,9 @@ void main() { } else { //do normal rendering ... //analog-tv distortion ... - vec2 position = oglFragCoord.xy / sizejulia.xy; + MEDIUMP vec2 position = oglFragCoord.xy / sizejulia.xy; position.y *=-1.0; - vec3 color_tv = color.rgb; + MEDIUMP vec3 color_tv = color.rgb; //contrast color_tv = clamp(color_tv*0.5+0.5*color_tv*color_tv*1.2,0.0,1.0); //circular vignette fade |