Project

General

Profile

« Previous | Next » 

Revision 5f2a53b6

Added by Leszek Koltunski about 7 years ago

Progress with VBOs - this time abstract out a new class, DistortedObject - i.e. everything that uploads something to GPU and thus needs to be auto re-created upon loss of the context.

View differences:

src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java
52 52
   private GLSurfaceView mView;
53 53
   private DistortedEffects[] mEffects;
54 54
   private DistortedTexture[] mTexture;
55
   private MeshFlat mMesh;
55 56
   private DistortedScreen mScreen;
56 57
   private int bmpHeight, bmpWidth;
57 58
    
......
169 170
      mTexture[1].setTexture(bitmap1);
170 171
      mTexture[2].setTexture(bitmap2);
171 172

  
172
      MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
173
      if( mMesh==null ) mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
173 174

  
174 175
      mScreen.detachAll();
175
      for(int i=NUM-1; i>=0; i--) mScreen.attach(mTexture[i], mEffects[i], mesh);
176
      for(int i=NUM-1; i>=0; i--) mScreen.attach(mTexture[i], mEffects[i], mMesh);
176 177

  
177 178
      DistortedEffects.enableEffect(EffectNames.SINK);
178 179
      DistortedEffects.enableEffect(EffectNames.DISTORT);

Also available in: Unified diff