Project

General

Profile

« Previous | Next » 

Revision 676c14da

Added by Leszek Koltunski almost 6 years ago

Relax requirements on when we can call DistortedEffects.setMax().

Before this change one had to call it before creation of shaders and before any of the DistortedEffects classes got created.
This commit removes the second requirement so now with setMax it's just like with enabling effects: it's best done in onSurfaceCreated.

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
63 63

  
64 64
   AroundTheWorldRenderer(GLSurfaceView view)
65 65
      {
66
      DistortedEffects.setMax(EffectType.VERTEX,12);
67
      DistortedEffects.setMax(EffectType.FRAGMENT,9);
68

  
69 66
      mMove = new Static3D(0,0,0);
70 67
      mScale= new Static3D(1,1,1);
71 68

  
......
147 144
      mScreen.detachAll();
148 145
      mScreen.attach(mTexture, mEffects, mMesh);
149 146

  
147
      DistortedEffects.setMax(EffectType.VERTEX  ,12);
148
      DistortedEffects.setMax(EffectType.FRAGMENT, 9);
149

  
150 150
      VertexEffectDistort.enable();
151 151
      VertexEffectSink.enable();
152 152
      VertexEffectPinch.enable();
src/main/java/org/distorted/examples/check/CheckRenderer.java
79 79

  
80 80
      DistortedEffects.setMax(EffectType.VERTEX  ,act.getMaxV());
81 81
      DistortedEffects.setMax(EffectType.FRAGMENT,act.getMaxF());
82

  
82 83
      VertexEffectSwirl.enable();
83 84
      VertexEffectDeform.enable();
84 85
      FragmentEffectChroma.enable();
......
217 218
        compilationResult += "\nGL vendor: "+(ver==null ? "null" : ver);
218 219
        ver = GLES31.glGetString(GLES31.GL_RENDERER);
219 220
        compilationResult += "\nGL renderer: "+(ver==null ? "null" : ver);
220
      
221

  
221 222
        CheckActivity act = (CheckActivity)mView.getContext();
222
      
223

  
223 224
        act.runOnUiThread(new Runnable() 
224 225
          {
225 226
          public void run() 
src/main/java/org/distorted/examples/earth/EarthRenderer.java
103 103

  
104 104
      mLevel = SCALE;
105 105

  
106
      DistortedEffects.setMax(EffectType.VERTEX  , MAX_EFF);
107
      DistortedEffects.setMax(EffectType.FRAGMENT, MAX_EFF);
108

  
109 106
      mStrength   = new Static1D(0.5f);
110 107
      mColor      = new Static3D(255,0,0);
111 108
      mRegionF    = new Static3D(RADIUS_F,RADIUS_F,RADIUS_F);
......
278 275
      Effect.enableEffects(EffectType.FRAGMENT);
279 276
      Effect.enableEffects(EffectType.VERTEX);
280 277

  
278
      DistortedEffects.setMax(EffectType.VERTEX  , MAX_EFF);
279
      DistortedEffects.setMax(EffectType.FRAGMENT, MAX_EFF);
280

  
281 281
      try
282 282
        {
283 283
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/effects3d/Effects3DActivity2.java
100 100
    mShowNormal = false;
101 101
    mUseOIT     = false;
102 102

  
103
    DistortedEffects.setMax(EffectType.VERTEX  ,10);    // those have to be called before
104
    DistortedEffects.setMax(EffectType.FRAGMENT,10);    // any DistortedEffect get created!
105

  
106 103
    switch(mObjectType)
107 104
      {
108 105
      case 0: mMesh = new MeshCubes(mNumCols, mString, mNumSlic);
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
306 306
      mCenterTexture.setTexture(bitmapC);
307 307
      mRegionTexture.setTexture(bitmapR);
308 308

  
309
      DistortedEffects.setMax(EffectType.VERTEX  ,10);
310
      DistortedEffects.setMax(EffectType.FRAGMENT,10);
311

  
309 312
      Effect.enableEffects(EffectType.VERTEX);
310 313
      Effect.enableEffects(EffectType.FRAGMENT);
311 314
      Effect.enableEffects(EffectType.POSTPROCESS);
src/main/java/org/distorted/examples/listener/ListenerRenderer.java
66 66

  
67 67
   ListenerRenderer(GLSurfaceView v)
68 68
      {
69
      // one more than we have bubbles at any given time because it can sometimes happen that
70
      // the old bubble is not yet removed when we add a new one
71
      DistortedEffects.setMax(EffectType.VERTEX,NUM_BUBBLES+1);
72

  
73 69
      mView = v;
74 70
      mEffects = new DistortedEffects();
75 71
      mEffects.registerForMessages(this);
......
178 174

  
179 175
     for(int i=0; i<NUM_BUBBLES; i++) addNewBubble();
180 176

  
177
     // one more than we have bubbles at any given time because it can sometimes
178
     // happen that the old bubble is not yet removed when we add a new one
179
     DistortedEffects.setMax(EffectType.VERTEX,NUM_BUBBLES+1);
181 180
     VertexEffectDistort.enable();
182 181

  
183 182
     try

Also available in: Unified diff