Project

General

Profile

« Previous | Next » 

Revision bc29e409

Added by Leszek Koltunski over 7 years ago

Again change of API. Now instead of the 'DistortedEffects.draw() and DistortedTree.draw()' we have 'DistortedFramebuffer.renderTo()'

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
23 23
import android.graphics.BitmapFactory;
24 24
import android.opengl.GLES20;
25 25
import android.opengl.GLSurfaceView;
26
import android.provider.Settings;
26 27

  
27 28
import org.distorted.examples.R;
28 29
import org.distorted.library.Distorted;
......
77 78
   public void onDrawFrame(GL10 glUnused) 
78 79
      {
79 80
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
80
      mEffects.draw(System.currentTimeMillis(), mTexture, mGrid, mScreen);
81
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
81 82
      }
82 83

  
83 84
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/bean/BeanRenderer.java
97 97
    public void onDrawFrame(GL10 glUnused) 
98 98
      {
99 99
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
100
      mEffects.draw(System.currentTimeMillis(), mTexture, mGrid, mScreen);
100
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
101 101
      }
102 102

  
103 103
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java
86 86
    public void onDrawFrame(GL10 glUnused) 
87 87
      {
88 88
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
89
      mEffects.draw(System.currentTimeMillis(), mTexture, mGrid, mScreen);
89
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
90 90
      }
91 91

  
92 92
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/check/CheckRenderer.java
82 82
    public void onDrawFrame(GL10 glUnused) 
83 83
      {
84 84
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
85
      mEffects.draw(System.currentTimeMillis(), mTexture, mGrid, mScreen);
85
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
86 86
      }
87 87

  
88 88
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/cubes/CubesRenderer.java
89 89
    public void onDrawFrame(GL10 glUnused) 
90 90
      {
91 91
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
92
      mEffects.draw(System.currentTimeMillis(),mTexture,mGrid, mScreen);
92
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
93 93
      }
94 94

  
95 95
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/deform/DeformRenderer.java
182 182
    
183 183
     long time = System.currentTimeMillis();
184 184
      
185
     stretchEffects.draw(time,stretchTexture,stretchGrid,mScreen);
185
     mScreen.renderTo(stretchTexture,stretchGrid,stretchEffects,time);
186 186
      
187 187
     mPaint.setColor(0xffffffff);
188 188
     fpsCanvas.drawRect(0, 0, fpsW, fpsH, mPaint);
......
190 190
     fpsCanvas.drawText(fpsString, fpsW/2, 5*fpsH/6, mPaint);
191 191
      
192 192
     fpsTexture.setTexture(fpsBitmap);
193
     fpsEffects.draw(time,fpsTexture,fpsGrid,mScreen);
193
     mScreen.renderTo(fpsTexture,fpsGrid,fpsEffects,time);
194 194
      
195 195
     computeFPS(time);
196 196
     }
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java
111 111
      
112 112
      long time = System.currentTimeMillis();
113 113
      
114
      for(int i=NUM-1; i>=0; i--) mEffects[i].draw(time, mTexture[i], mGrid, mScreen);
114
      for(int i=NUM-1; i>=0; i--) mScreen.renderTo(mTexture[i], mGrid, mEffects[i], time);
115 115
      }
116 116

  
117 117
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java
105 105
      
106 106
     long time = System.currentTimeMillis();
107 107
   
108
     for(int i=NUM-1; i>=0; i--) mEffects[i].draw(time, mTexture, mGrid, mScreen);
108
     for(int i=NUM-1; i>=0; i--) mScreen.renderTo(mTexture, mGrid, mEffects[i], time);
109 109
     }
110 110

  
111 111
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/dynamic/DynamicRenderer.java
106 106
     mCanvas.drawRect(0, 0, texW, texH, mPaint);
107 107
     mView.drawCurve(mCanvas,time);
108 108
     mTexture.setTexture(mBitmap);
109
     mEffects.draw(time,mTexture,mGrid,mScreen);
109
     mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
110 110
     }
111 111

  
112 112
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
130 130
  public void onDrawFrame(GL10 glUnused)
131 131
    {   
132 132
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
133
    mEffects.draw(System.currentTimeMillis(), mTexture,mGrid,mScreen);
133
    mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
134 134
    }
135 135

  
136 136
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
137 137

  
138 138
      long time = System.currentTimeMillis();
139 139

  
140
      mBackgroundEffects.draw(time,mBackgroundTexture,mQuad,mScreen);
141
      mObjectEffects.draw(time,mObjectTexture,mObjectGrid,mScreen);
140
      mScreen.renderTo(mBackgroundTexture,mQuad      ,mBackgroundEffects,time);
141
      mScreen.renderTo(mObjectTexture    ,mObjectGrid,mObjectEffects    ,time);
142 142

  
143 143
      if( Effects3DActivity.supportsCenter() )
144 144
        {
145
        mCenterEffects.draw(time, mCenterTexture,mQuad,mScreen);
146
        if( Effects3DActivity.supportsRegion() ) mRegionEffects.draw(time, mRegionTexture,mQuad,mScreen);
145
        mScreen.renderTo(mCenterTexture,mQuad,mCenterEffects, time);
146
        if( Effects3DActivity.supportsRegion() ) mScreen.renderTo(mRegionTexture,mQuad,mRegionEffects,time);
147 147
        }
148 148
      }
149 149

  
src/main/java/org/distorted/examples/fbo/FBORenderer.java
69 69
    public void onDrawFrame(GL10 glUnused) 
70 70
      {
71 71
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
72
      mRoot.draw(System.currentTimeMillis(),mScreen);
72
      mScreen.renderTo(mRoot,System.currentTimeMillis());
73 73
      }
74 74

  
75 75
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/flag/FlagRenderer.java
143 143
    public void onDrawFrame(GL10 glUnused) 
144 144
      {
145 145
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
146
      mEffects.draw(System.currentTimeMillis(), mTexture, mGrid, mScreen);
146
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
147 147
      }
148 148

  
149 149
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/girl/GirlRenderer.java
154 154
   public void onDrawFrame(GL10 glUnused) 
155 155
      {
156 156
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
157
      mEffects.draw(System.currentTimeMillis(),mTexture,mGrid,mScreen);
157
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
158 158
      }
159 159

  
160 160
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/listener/ListenerRenderer.java
106 106
    public void onDrawFrame(GL10 glUnused) 
107 107
      {
108 108
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
109
      mEffects.draw(System.currentTimeMillis(), mTexture,mGrid,mScreen);
109
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
110 110
      }
111 111

  
112 112
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/matrix3d/Matrix3DRenderer.java
62 62
    public void onDrawFrame(GL10 glUnused)
63 63
      {
64 64
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
65
      mEffects.draw(System.currentTimeMillis(),mTexture,mGrid,mScreen);
65
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
66 66
      }
67 67

  
68 68
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java
82 82
    public void onDrawFrame(GL10 glUnused) 
83 83
      {
84 84
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
85
      mEffects.draw(System.currentTimeMillis(),mTexture,mGrid,mScreen);
85
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
86 86
      }
87 87

  
88 88
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java
153 153
       mRefresh = false;
154 154
       }
155 155
      
156
     mEffects.draw(time,mTexture,mGrid,mScreen);
156
     mScreen.renderTo(mTexture, mGrid, mEffects, time );
157 157
     }
158 158

  
159 159
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
120 120
    public void onDrawFrame(GL10 glUnused) 
121 121
      {
122 122
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
123
      mRoot.draw(System.currentTimeMillis(),mScreen);
123
      mScreen.renderTo(mRoot,System.currentTimeMillis());
124 124
      }
125 125

  
126 126
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
267 267
    eglCore.makeCurrent(eglSurface);
268 268

  
269 269
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
270
    mEffects.draw(System.currentTimeMillis(), mTexture,mGrid,mScreen);
270
    mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
271 271

  
272 272
    eglCore.swapBuffers(eglSurface);
273 273
    }
src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
91 91
   public void onDrawFrame(GL10 glUnused) 
92 92
      {
93 93
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
94
      mEffects.draw(System.currentTimeMillis(), mTexture,mGrid,mScreen);
94
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
95 95
      }
96 96

  
97 97
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java
94 94
  public void onDrawFrame(GL10 glUnused) 
95 95
    {
96 96
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
97
    mEffects.draw(System.currentTimeMillis(), mTexture,mGrid,mScreen);
97
    mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
98 98
    }
99 99

  
100 100
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/save/SaveRenderer.java
53 53
class SaveRenderer implements GLSurfaceView.Renderer
54 54
  {
55 55
  private GLSurfaceView mView;
56
  private DistortedTexture mGirl;
56
  private DistortedTexture mTexture;
57 57
  private DistortedEffects mEffects;
58 58
  private GridFlat mGrid;
59 59
  private DistortedFramebuffer mScreen, mOffscreen;
......
156 156
      {
157 157
      mEffects.abortEffects(EffectTypes.MATRIX);
158 158
      mEffects.scale(mScaleFactor);
159
      mEffects.draw(time, mGirl, mGrid, mOffscreen);
159
      mOffscreen.renderTo(mTexture, mGrid, mEffects, time );
160 160
      applyMatrixEffects(scrWidth,scrHeight);
161 161

  
162 162
      int fW =(int)(mScale*bmpWidth);
......
180 180
      isSaving = false;
181 181
      }
182 182

  
183
    mEffects.draw(time, mGirl, mGrid, mScreen);
183
    mScreen.renderTo(mTexture, mGrid, mEffects, time );
184 184
    }
185 185

  
186 186
///////////////////////////////////////////////////////////////////////////////////////////////////
......
245 245
    bmpWidth  = bitmap.getWidth();
246 246

  
247 247
    mGrid = new GridFlat(30,30*bmpHeight/bmpWidth);
248
    mGirl = new DistortedTexture(bmpWidth,bmpHeight);
249
    mGirl.setTexture(bitmap);
248
    mTexture = new DistortedTexture(bmpWidth,bmpHeight);
249
    mTexture.setTexture(bitmap);
250 250

  
251 251
    mOffscreen = new DistortedFramebuffer( (int)(mScale*bmpWidth) , (int)(mScale*bmpHeight) );
252 252

  
src/main/java/org/distorted/examples/sink/SinkRenderer.java
80 80
  public void onDrawFrame(GL10 glUnused) 
81 81
    {
82 82
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
83
    mEffects.draw(System.currentTimeMillis(), mTexture,mGrid,mScreen);
83
    mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
84 84
    }
85 85

  
86 86
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
150 150
  public void onDrawFrame(GL10 glUnused) 
151 151
    {
152 152
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
153
    mRoot.draw(System.currentTimeMillis(),mScreen);
153
    mScreen.renderTo(mRoot,System.currentTimeMillis());
154 154
    }
155 155

  
156 156
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/wind/WindRenderer.java
81 81
   public void onDrawFrame(GL10 glUnused) 
82 82
      {
83 83
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
84
      mEffects.draw(System.currentTimeMillis(),mTexture, mGrid,mScreen);
84
      mScreen.renderTo(mTexture, mGrid, mEffects, System.currentTimeMillis() );
85 85
      }
86 86

  
87 87
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff