Project

General

Profile

« Previous | Next » 

Revision dac831c1

Added by Leszek Koltunski over 7 years ago

Beginning of support for actual Transform Feedback.

View differences:

src/main/java/org/distorted/library/DistortedEffects.java
300 300
        {
301 301
        throw new RuntimeException("DrawArrays: glError 0x" + Integer.toHexString(error));
302 302
        }
303

  
303
/*
304 304
    int size = (MeshObject.POS_DATA_SIZE+MeshObject.NOR_DATA_SIZE+MeshObject.TEX_DATA_SIZE)*mesh.numVertices;
305 305

  
306 306
    Buffer mappedBuffer =  GLES30.glMapBufferRange(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, 4*size, GLES30.GL_MAP_READ_BIT);
......
312 312
    android.util.Log.d( "Feedback", msg);
313 313

  
314 314
    GLES30.glUnmapBuffer(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER);
315
*/
315 316
    GLES30.glEndTransformFeedback();
316 317
    GLES30.glBindBufferBase(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, 0);
317 318
    }
......
343 344

  
344 345
    displayTransformFeedback(mesh);
345 346

  
347
    EffectQueueMatrix.sendZero();
348
    EffectQueueVertex.sendZero();
349

  
346 350
    mF.send(halfW,halfH);
347 351

  
352
    GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, mesh.mAttTFO[0]);
353
    GLES30.glVertexAttribPointer(mMainProgram.mAttribute[0], MeshObject.POS_DATA_SIZE, GLES30.GL_FLOAT, false, MeshObject.VERTSIZE, MeshObject.OFFSET0);
354
    GLES30.glVertexAttribPointer(mMainProgram.mAttribute[1], MeshObject.NOR_DATA_SIZE, GLES30.GL_FLOAT, false, MeshObject.VERTSIZE, MeshObject.OFFSET1);
355
    GLES30.glVertexAttribPointer(mMainProgram.mAttribute[2], MeshObject.TEX_DATA_SIZE, GLES30.GL_FLOAT, false, MeshObject.VERTSIZE, MeshObject.OFFSET2);
356
    GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0 );
357

  
348 358
    GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, mesh.numVertices);
349 359

  
350 360
    /// DEBUG ONLY //////
src/main/java/org/distorted/library/EffectQueueMatrix.java
261 261
    GLES30.glUniformMatrix4fv(mMVPMatrixH, 1, false, mMVPMatrix , 0);
262 262
    }
263 263

  
264
///////////////////////////////////////////////////////////////////////////////////////////////////
265

  
266
  static synchronized void sendZero()
267
    {
268
    Matrix.setIdentityM(mTmpMatrix, 0);
269

  
270
    GLES30.glUniform3f( mObjDH , 0.5f, 0.5f, 0.5f);
271
    GLES30.glUniformMatrix4fv(mMVMatrixH , 1, false, mTmpMatrix , 0);
272
    GLES30.glUniformMatrix4fv(mMVPMatrixH, 1, false, mMVPMatrix , 0);
273
    }
274

  
264 275
///////////////////////////////////////////////////////////////////////////////////////////////////
265 276
// move, scale
266 277

  
src/main/java/org/distorted/library/EffectQueueVertex.java
151 151
      }
152 152
    }
153 153

  
154
///////////////////////////////////////////////////////////////////////////////////////////////////
155

  
156
  static synchronized void sendZero()
157
    {
158
    GLES30.glUniform1i( mNumEffectsH, 0);
159
    }
160

  
154 161
///////////////////////////////////////////////////////////////////////////////////////////////////
155 162
// Do various post-processing on already computed effects.
156 163
// 1) here unlike in the fragment queue, we don't have to multiply the points by ModelView matrix because that gets done in the shader.

Also available in: Unified diff