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/save/SaveRenderer.java
58 58
  private DistortedEffects mEffects;
59 59
  private DistortedFramebuffer mOffscreen;
60 60
  private DistortedTexture mTexture;
61
  private MeshFlat mMesh;
61 62
  private DistortedScreen mScreen;
62 63
  private Static1D s0;
63 64
  private Dynamic3D mScaleDyn;
......
242 243
    bmpHeight = bitmap.getHeight();
243 244
    bmpWidth  = bitmap.getWidth();
244 245

  
245
    MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
246
    if( mMesh==null ) mMesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
246 247
    if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
247 248
    mTexture.setTexture(bitmap);
248 249

  
249 250
    if( mOffscreen==null ) mOffscreen = new DistortedFramebuffer( (int)(mScale*bmpWidth) , (int)(mScale*bmpHeight) );
250 251

  
251 252
    mOffscreen.detachAll();
252
    mOffscreen.attach(mTexture,mEffects,mesh);
253
    mOffscreen.attach(mTexture,mEffects,mMesh);
253 254
    mScreen.detachAll();
254
    mScreen.attach(mTexture,mEffects,mesh);
255
    mScreen.attach(mTexture,mEffects,mMesh);
255 256

  
256 257
    DistortedEffects.enableEffect(EffectNames.SINK);
257 258

  

Also available in: Unified diff