commit 4b7152b698c5ed0ffc1d73b875cce4ce7404e0f0
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Dec 16 21:12:25 2022 +0100

    simplify the crash app.

diff --git a/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java
index 4dae617..9ee01cd 100644
--- a/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java
+++ b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java
@@ -21,19 +21,38 @@ package org.distorted.examples.flatblur2;
 
 import android.opengl.GLSurfaceView;
 
+import org.distorted.library.effect.EffectQuality;
+import org.distorted.library.effect.PostprocessEffectGlow;
+import org.distorted.library.effect.VertexEffectScale;
+import org.distorted.library.main.DistortedEffects;
 import org.distorted.library.main.DistortedLibrary;
+import org.distorted.library.main.DistortedNode;
 import org.distorted.library.main.DistortedScreen;
+import org.distorted.library.main.DistortedTexture;
+import org.distorted.library.mesh.MeshQuad;
+import org.distorted.library.message.EffectListener;
+import org.distorted.library.type.Dynamic2D;
+import org.distorted.library.type.Dynamic4D;
+import org.distorted.library.type.Static2D;
+import org.distorted.library.type.Static4D;
 
 import javax.microedition.khronos.egl.EGLConfig;
 import javax.microedition.khronos.opengles.GL10;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-class FlatBlur2Renderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
+class FlatBlur2Renderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener, EffectListener
 {
+    private static final int DUR_GLO =  2000;
+
+    private static final int[] colors = new int[] {0,0,1,  1,0,1,  1,0,0,  1,1,0,  0,1,0,  1,1,1}; // blue, pink, red, yellow, green, white
+    private static final int INDEX = 5;
+
     private final GLSurfaceView mView;
     private final DistortedScreen mScreen;
-    private OverlayStars mStars;
+
+    private DistortedNode mNode1, mNode2;
+    private long mGlowID;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -61,7 +80,8 @@ class FlatBlur2Renderer implements GLSurfaceView.Renderer, DistortedLibrary.Exce
     
     public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
       {
-      OverlayStars.enableEffects();
+      VertexEffectScale.enable();
+      PostprocessEffectGlow.enable();
       DistortedLibrary.onSurfaceCreated( mView.getContext(), this);
       }
 
@@ -76,17 +96,59 @@ class FlatBlur2Renderer implements GLSurfaceView.Renderer, DistortedLibrary.Exce
 
     public void button1()
       {
-      mStars = new OverlayStars();
-      mStars.startOverlay(mScreen);
+      DistortedTexture texture1 = new DistortedTexture();
+      texture1.setColorARGB(0xffff0000);
+      MeshQuad mesh1 = new MeshQuad();
+      DistortedEffects effects1 = new DistortedEffects();
+      VertexEffectScale mainScale= new VertexEffectScale(200);
+      effects1.apply(mainScale);
+      mNode1 = new DistortedNode(texture1,effects1,mesh1);
+      mScreen.attach(mNode1);
+
+      DistortedTexture texture2 = new DistortedTexture();
+      texture2.setColorARGB(0xffff0000);
+      MeshQuad mesh2 = new MeshQuad();
+      DistortedEffects effects2 = new DistortedEffects();
+      mNode2 = new DistortedNode(texture2,effects2,mesh2);
+      mScreen.attach(mNode2);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public void button2()
       {
-      if( mStars!=null )
-        {
-        mStars.button2();
-        }
+      Dynamic2D haloRadius = new Dynamic2D(DUR_GLO,1.0f);
+      haloRadius.add(new Static2D( 0, 0));
+      haloRadius.add(new Static2D(15,50));
+      haloRadius.add(new Static2D( 0, 0));
+
+      Dynamic4D color= new Dynamic4D(DUR_GLO,1.0f);
+      Static4D P1    = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.0f);
+      Static4D P2    = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.5f);
+      color.add(P1);
+      color.add(P2);
+      color.add(P1);
+
+      PostprocessEffectGlow glow = new PostprocessEffectGlow(haloRadius,color);
+      glow.setQuality(EffectQuality.MEDIUM);
+      mGlowID = glow.getID();
+      glow.notifyWhenFinished(this);
+      DistortedEffects effects = mNode1.getEffects();
+      effects.apply(glow);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   public void effectFinished(long id)
+      {
+      if( id==mGlowID )
+         {
+         mScreen.detach(mNode1);
+         mNode1.markForDeletion();
+         mNode1=null;
+         mScreen.detach(mNode2);
+         mNode2.markForDeletion();
+         mNode2=null;
+         }
       }
 }
diff --git a/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java b/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java
deleted file mode 100644
index 8e19ce2..0000000
--- a/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.distorted.examples.flatblur2;
-
-import org.distorted.library.effect.EffectQuality;
-import org.distorted.library.effect.PostprocessEffectGlow;
-import org.distorted.library.effect.VertexEffectMove;
-import org.distorted.library.effect.VertexEffectScale;
-import org.distorted.library.main.DistortedEffects;
-import org.distorted.library.main.DistortedNode;
-import org.distorted.library.main.DistortedScreen;
-import org.distorted.library.main.DistortedTexture;
-import org.distorted.library.mesh.MeshQuad;
-import org.distorted.library.message.EffectListener;
-import org.distorted.library.type.Dynamic2D;
-import org.distorted.library.type.Dynamic4D;
-import org.distorted.library.type.Static2D;
-import org.distorted.library.type.Static4D;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-public class OverlayStars implements EffectListener
-{
-   private static final int DUR_GLO =  2000;
-
-   private static final int[] colors = new int[] {0,0,1,  1,0,1,  1,0,0,  1,1,0,  0,1,0,  1,1,1}; // blue, pink, red, yellow, green, white
-   private static final int INDEX = 5;
-
-   private DistortedNode mNode1, mNode2;
-   private DistortedScreen mScreen;
-
-   private long mGlowID;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-   private DistortedNode createNode2()
-      {
-      DistortedTexture texture = new DistortedTexture();
-      texture.setColorARGB(0xffff0000);
-      MeshQuad mesh = new MeshQuad();
-      DistortedEffects effects = new DistortedEffects();
-
-      return new DistortedNode(texture,effects,mesh);
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-   private DistortedNode createNode1()
-      {
-      DistortedTexture texture = new DistortedTexture();
-      texture.setColorARGB(0xffff0000);
-      MeshQuad mesh = new MeshQuad();
-      DistortedEffects effects = new DistortedEffects();
-      VertexEffectScale mainScale= new VertexEffectScale(200);
-      effects.apply(mainScale);
-
-      return new DistortedNode(texture,effects,mesh);
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-   public void startOverlay(DistortedScreen screen)
-      {
-      mScreen = screen;
-      mNode1 = createNode1();
-      mScreen.attach(mNode1);
-      mNode2 = createNode2();
-      mScreen.attach(mNode2);
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-   public void effectFinished(long id)
-      {
-      if( id==mGlowID )
-         {
-         mScreen.detach(mNode1);
-         mNode1.markForDeletion();
-         mNode1=null;
-         mScreen.detach(mNode2);
-         mNode2.markForDeletion();
-         mNode2=null;
-         }
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void button2()
-     {
-     Dynamic2D haloRadius = new Dynamic2D(DUR_GLO,1.0f);
-     haloRadius.add(new Static2D( 0, 0));
-     haloRadius.add(new Static2D(15,50));
-     haloRadius.add(new Static2D( 0, 0));
-
-     Dynamic4D color= new Dynamic4D(DUR_GLO,1.0f);
-     Static4D P1    = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.0f);
-     Static4D P2    = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.5f);
-     color.add(P1);
-     color.add(P2);
-     color.add(P1);
-
-     PostprocessEffectGlow glow = new PostprocessEffectGlow(haloRadius,color);
-     glow.setQuality(EffectQuality.MEDIUM);
-     mGlowID = glow.getID();
-     glow.notifyWhenFinished(this);
-     DistortedEffects effects = mNode1.getEffects();
-     effects.apply(glow);
-     }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @SuppressWarnings("unused")
-  public static void enableEffects()
-     {
-     VertexEffectMove.enable();
-     VertexEffectScale.enable();
-     PostprocessEffectGlow.enable();
-     }
-}
\ No newline at end of file
