Project

General

Profile

« Previous | Next » 

Revision b9798977

Added by Leszek Koltunski about 7 years ago

Advances in Multiblur - breaks BLUR for now.

View differences:

src/main/java/org/distorted/library/EffectQueuePostprocess.java
69 69
    mQuadTextureInv.put(textureInv).position(0);
70 70
    }
71 71

  
72
  private static DistortedFramebuffer mBufferFBO = new DistortedFramebuffer(true,DistortedSurface.TYPE_SYST,1,1);
72
  private static DistortedFramebuffer mPostBuffer = new DistortedFramebuffer(true,DistortedSurface.TYPE_SYST,1,1);
73
                 DistortedFramebuffer mMainBuffer = new DistortedFramebuffer(true,DistortedSurface.TYPE_SYST,1,1);
73 74

  
74 75
  private static float[] mMVPMatrix = new float[16];
75 76
  private static float[] mTmpMatrix = new float[16];
......
245 246
    GLES30.glUniform1i( mRadiusH, radius);
246 247
    GLES30.glUniform2f( mObjDH , w, h );
247 248

  
248
    mBufferFBO.resizeFast( (int)w, (int)h);
249
    mBufferFBO.setAsOutput();
249
    mPostBuffer.resizeFast( (int)w, (int)h);
250
    mPostBuffer.setAsOutput();
250 251
    GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
251 252
    GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
252 253
    GLES30.glViewport(0, 0, (int)w, (int)h);
253 254

  
254 255
    Matrix.setIdentityM(mTmpMatrix, 0);
255
    Matrix.translateM(mTmpMatrix, 0, 0, 0, -mBufferFBO.mDistance);
256
    Matrix.multiplyMM(mMVPMatrix, 0, mBufferFBO.mProjectionMatrix, 0, mTmpMatrix, 0);
256
    Matrix.translateM(mTmpMatrix, 0, 0, 0, -mPostBuffer.mDistance);
257
    Matrix.multiplyMM(mMVPMatrix, 0, mPostBuffer.mProjectionMatrix, 0, mTmpMatrix, 0);
257 258

  
258 259
    // horizontal blur
259 260
    GLES30.glUniform1fv( mOffsetsH ,radius+1, mOffsets,0);
......
262 263
    GLES30.glVertexAttribPointer(mBlurProgram.mAttribute[1], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadTextureInv);
263 264
    GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4);
264 265

  
265
    mBufferFBO.setAsInput();
266
    mPostBuffer.setAsInput();
266 267
    surface.setAsOutput();
267 268

  
268 269
    GLES30.glViewport(0, 0, surface.mWidth, surface.mHeight);

Also available in: Unified diff