Project

General

Profile

« Previous | Next » 

Revision 392e16fd

Added by Leszek Koltunski over 7 years ago

Change in the API: we always have to create a DistortedFramebuffer to render to.

View differences:

src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
29 29
import android.opengl.GLES20;
30 30
import android.opengl.GLSurfaceView;
31 31

  
32
import org.distorted.library.DistortedFramebuffer;
32 33
import org.distorted.library.GridFlat;
33 34
import org.distorted.library.DistortedTexture;
34 35
import org.distorted.library.DistortedEffectQueues;
......
53 54

  
54 55
  private DistortedTexture mTexture;
55 56
  private GridFlat mGrid;
56
  private DistortedEffectQueues mQueues;
57
  private DistortedEffectQueues mEffects;
58
  private DistortedFramebuffer mScreen;
57 59

  
58 60
///////////////////////////////////////////////////////////////////////////////////////////////////
59 61

  
......
71 73

  
72 74
    mGrid    = new GridFlat(80,80*texHeight/texWidth);
73 75
    mTexture = new DistortedTexture(texWidth,texHeight);
74
    mQueues  = new DistortedEffectQueues();
76
    mEffects = new DistortedEffectQueues();
75 77

  
76
    mQueues.registerForMessages(this);
78
    mEffects.registerForMessages(this);
79

  
80
    mScreen = new DistortedFramebuffer(0);
77 81
    }
78 82

  
79 83
///////////////////////////////////////////////////////////////////////////////////////////////////
80 84

  
81 85
  DistortedEffectQueues getQueues()
82 86
    {
83
    return mQueues;
87
    return mEffects;
84 88
    }
85 89

  
86 90
///////////////////////////////////////////////////////////////////////////////////////////////////
......
115 119

  
116 120
  public void onSurfaceChanged(GL10 glUnused, int width, int height)
117 121
    {
118
    mQueues.abortEffects(EffectTypes.MATRIX);
119
    mQueues.scale( new Static3D((float)width/texWidth,(float)height/texHeight,1) );
120
    Distorted.onSurfaceChanged(width,height);
122
    mEffects.abortEffects(EffectTypes.MATRIX);
123
    mEffects.scale( new Static3D((float)width/texWidth,(float)height/texHeight,1) );
124
    mScreen.resize(width,height);
121 125
    mView.setScreenSize(width,height);
122 126
    }
123 127
   
......
126 130
  public void onDrawFrame(GL10 glUnused)
127 131
    {   
128 132
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
129
    mQueues.draw(System.currentTimeMillis(), mTexture,mGrid);
133
    mEffects.draw(System.currentTimeMillis(), mTexture,mGrid,mScreen);
130 134
    }
131 135

  
132 136
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff