Project

General

Profile

« Previous | Next » 

Revision 36532c7f

Added by Leszek Koltunski over 1 year ago

This app reproduces an issue with glow being improperly displayed on my physical LG phone.

View differences:

src/main/java/org/distorted/examples/flatblur/FlatBlurRenderer.java
21 21

  
22 22
import android.opengl.GLSurfaceView;
23 23

  
24
import org.distorted.library.effect.EffectQuality;
25
import org.distorted.library.effect.MatrixEffectMove;
26
import org.distorted.library.effect.MatrixEffectScale;
27
import org.distorted.library.effect.PostprocessEffectBlur;
28
import org.distorted.library.main.DistortedEffects;
29 24
import org.distorted.library.main.DistortedLibrary;
30
import org.distorted.library.main.DistortedNode;
31 25
import org.distorted.library.main.DistortedScreen;
32
import org.distorted.library.main.DistortedTexture;
33
import org.distorted.library.mesh.MeshQuad;
34
import org.distorted.library.type.Static2D;
35
import org.distorted.library.type.Static3D;
36 26

  
37 27
import javax.microedition.khronos.egl.EGLConfig;
38 28
import javax.microedition.khronos.opengles.GL10;
......
41 31

  
42 32
class FlatBlurRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
43 33
{
44
    private static final int HALO = 15;
45

  
46 34
    private final GLSurfaceView mView;
47 35
    private final DistortedScreen mScreen;
48
    private final PostprocessEffectBlur mBlur;
49
    private final DistortedNode mRedNode;
50
    private final Static2D mBlurStrength;
51 36

  
52 37
///////////////////////////////////////////////////////////////////////////////////////////////////
53 38

  
......
55 40
      {
56 41
      mView = v;
57 42
      mScreen = new DistortedScreen();
58

  
59
      int x = 50;
60
      int scale = 200;
61
      mRedNode = createNode(-x,0,1,scale,0xffff0000);
62
      DistortedNode whiteNode = createNode(x,0,1,scale,0xffffffff);
63

  
64
      mScreen.attach(mRedNode);
65
      mScreen.attach(whiteNode);
66

  
67
      mBlurStrength = new Static2D(HALO,0);
68
      mBlur = new PostprocessEffectBlur(mBlurStrength);
69
      mBlur.setQuality(EffectQuality.MEDIUM);
70
      }
71

  
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73

  
74
    private DistortedNode createNode(int x, int y, int z, int scale, int color)
75
      {
76
      DistortedTexture texture = new DistortedTexture();
77
      texture.setColorARGB(color);
78
      MeshQuad mesh = new MeshQuad();
79
      DistortedEffects effects = new DistortedEffects();
80

  
81
      Static3D move = new Static3D(x,y,z);
82

  
83
      MatrixEffectMove mainMove  = new MatrixEffectMove(move);
84
      MatrixEffectScale mainScale= new MatrixEffectScale(scale);
85

  
86
      effects.apply(mainScale);
87
      effects.apply(mainMove);
88

  
89
      return new DistortedNode(texture,effects,mesh);
90 43
      }
91 44

  
92 45
///////////////////////////////////////////////////////////////////////////////////////////////////
......
107 60
    
108 61
    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
109 62
      {
110
      PostprocessEffectBlur.enable();
63
      OverlayStars.enableEffects();
111 64
      DistortedLibrary.onSurfaceCreated( mView.getContext(), this);
112 65
      }
113 66

  
......
115 68

  
116 69
    public void distortedException(Exception ex)
117 70
      {
118
      android.util.Log.e("SetTexture", ex.getMessage() );
71
      android.util.Log.e("FlatBlur", ex.getMessage() );
119 72
      }
120 73

  
121 74
///////////////////////////////////////////////////////////////////////////////////////////////////
122 75

  
123
    public void enableBlur(boolean enable)
76
    public void button1()
124 77
      {
125
      DistortedEffects effects = mRedNode.getEffects();
126
      long id = mBlur.getID();
127

  
128
      if( enable ) effects.abortById(id);
129
      else         effects.apply(mBlur);
78
      OverlayStars stars = new OverlayStars();
79
      stars.startOverlay(mScreen);
130 80
      }
131 81

  
132 82
///////////////////////////////////////////////////////////////////////////////////////////////////
133 83

  
134
    public void setBlurStrength(int strength)
84
    public void button2()
135 85
      {
136
      mBlurStrength.set(HALO,strength*0.5f);
86

  
137 87
      }
138 88
}

Also available in: Unified diff