commit 395cabffa4c17472a5fd3e551d11411a64facb51
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Dec 16 21:01:04 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 96c4828..4dae617 100644
--- a/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java
+++ b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java
@@ -33,6 +33,7 @@ class FlatBlur2Renderer implements GLSurfaceView.Renderer, DistortedLibrary.Exce
 {
     private final GLSurfaceView mView;
     private final DistortedScreen mScreen;
+    private OverlayStars mStars;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -75,14 +76,17 @@ class FlatBlur2Renderer implements GLSurfaceView.Renderer, DistortedLibrary.Exce
 
     public void button1()
       {
-      OverlayStars stars = new OverlayStars();
-      stars.startOverlay(mScreen);
+      mStars = new OverlayStars();
+      mStars.startOverlay(mScreen);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public void button2()
       {
-
+      if( mStars!=null )
+        {
+        mStars.button2();
+        }
       }
 }
diff --git a/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java b/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java
index c0146a5..8e19ce2 100644
--- a/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java
+++ b/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java
@@ -8,22 +8,17 @@ 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.main.InternalOutputSurface;
 import org.distorted.library.mesh.MeshQuad;
 import org.distorted.library.message.EffectListener;
-import org.distorted.library.type.Dynamic;
 import org.distorted.library.type.Dynamic2D;
-import org.distorted.library.type.Dynamic3D;
 import org.distorted.library.type.Dynamic4D;
 import org.distorted.library.type.Static2D;
-import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 public class OverlayStars implements EffectListener
 {
-   private static final int DUR_MOV =  4000;
    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
@@ -32,26 +27,7 @@ public class OverlayStars implements EffectListener
    private DistortedNode mNode1, mNode2;
    private DistortedScreen mScreen;
 
-   private float mWidth;
-   private long mMoveID, mGlowID;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-   private Dynamic3D createRandomMove()
-      {
-      Dynamic3D move = new Dynamic3D();
-      move.setMode(Dynamic.MODE_PATH);
-      move.setDuration(DUR_MOV);
-      move.setCount(0.5f);
-
-      Static3D pointS = new Static3D(0,-500,0);
-      Static3D pointE = new Static3D(0,0,0);
-
-      move.add(pointS);
-      move.add(pointE);
-
-      return move;
-      }
+   private long mGlowID;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -59,24 +35,9 @@ public class OverlayStars implements EffectListener
       {
       DistortedTexture texture = new DistortedTexture();
       texture.setColorARGB(0xffff0000);
-
       MeshQuad mesh = new MeshQuad();
-
       DistortedEffects effects = new DistortedEffects();
 
-      float scaleP  = mWidth*0.15f;
-      VertexEffectScale scaleE = new VertexEffectScale(scaleP);
-      scaleE.setMeshAssociation(1,-1);
-      effects.apply(scaleE);
-
-      Dynamic3D moveP = createRandomMove();
-      VertexEffectMove moveE= new VertexEffectMove(moveP);
-      moveE.setMeshAssociation(0,0);
-      effects.apply(moveE);
-
-      mMoveID = moveE.getID();
-      moveE.notifyWhenFinished(this);
-
       return new DistortedNode(texture,effects,mesh);
       }
 
@@ -86,18 +47,9 @@ public class OverlayStars implements EffectListener
       {
       DistortedTexture texture = new DistortedTexture();
       texture.setColorARGB(0xffff0000);
-
       MeshQuad mesh = new MeshQuad();
-
       DistortedEffects effects = new DistortedEffects();
-
-      float scaleM  = mWidth*0.40f;
-      Static3D moveM= new Static3D(0,0,1);
-
-      VertexEffectMove mainMove  = new VertexEffectMove(moveM);
-      VertexEffectScale mainScale= new VertexEffectScale(scaleM);
-
-      effects.apply(mainMove);
+      VertexEffectScale mainScale= new VertexEffectScale(200);
       effects.apply(mainScale);
 
       return new DistortedNode(texture,effects,mesh);
@@ -108,14 +60,9 @@ public class OverlayStars implements EffectListener
    public void startOverlay(DistortedScreen screen)
       {
       mScreen = screen;
-      mWidth = mScreen.getWidth();
-
       mNode1 = createNode1();
-      mNode1.enableDepthStencil(InternalOutputSurface.NO_DEPTH_NO_STENCIL);
       mScreen.attach(mNode1);
-
       mNode2 = createNode2();
-      mNode2.enableDepthStencil(InternalOutputSurface.NO_DEPTH_NO_STENCIL);
       mScreen.attach(mNode2);
       }
 
@@ -123,27 +70,6 @@ public class OverlayStars implements EffectListener
 
    public void effectFinished(long id)
       {
-      if( id==mMoveID )
-         {
-         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);
-         }
       if( id==mGlowID )
          {
          mScreen.detach(mNode1);
@@ -155,6 +81,30 @@ public class OverlayStars implements EffectListener
          }
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  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")
