310 |
310 |
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, mesh.mTexVBO[0]);
|
311 |
311 |
GLES30.glVertexAttribPointer(mMainProgram.mAttribute[2], MeshObject.TEX_DATA_SIZE , GLES30.GL_FLOAT, false, 0, 0);
|
312 |
312 |
|
313 |
|
GLES30.glBindBufferBase(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, mesh.mPosTBO[0]);
|
|
313 |
//GLES30.glBindBufferBase(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, mesh.mPosTBO[0]);
|
314 |
314 |
|
315 |
|
GLES30.glBeginTransformFeedback(GLES30.GL_TRIANGLES);
|
|
315 |
// GLES30.glBeginTransformFeedback(GLES30.GL_TRIANGLES);
|
316 |
316 |
GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, mesh.dataLength);
|
317 |
|
|
318 |
|
int error = GLES30.glGetError();
|
319 |
|
|
320 |
|
if (error != GLES30.GL_NO_ERROR)
|
321 |
|
{
|
322 |
|
throw new RuntimeException("glError 0x" + Integer.toHexString(error));
|
323 |
|
}
|
324 |
|
|
325 |
|
GLES30.glEndTransformFeedback();
|
326 |
|
GLES30.glFlush();
|
|
317 |
// GLES30.glEndTransformFeedback();
|
|
318 |
// GLES30.glFlush();
|
327 |
319 |
|
328 |
320 |
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0 );
|
329 |
|
|
330 |
|
int len = 3*(mesh.dataLength-2)*MeshObject.BYTES_PER_FLOAT*MeshObject.POSITION_DATA_SIZE;
|
|
321 |
/*
|
|
322 |
int len = mesh.dataLength*MeshObject.BYTES_PER_FLOAT*MeshObject.POSITION_DATA_SIZE;
|
331 |
323 |
|
332 |
324 |
Buffer mappedBuffer = GLES30.glMapBufferRange(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, len, GLES30.GL_MAP_READ_BIT);
|
333 |
325 |
FloatBuffer fb = ((ByteBuffer) mappedBuffer).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
334 |
326 |
FloatBuffer bb = mesh.mMeshPositions;
|
335 |
327 |
|
336 |
|
String msgB = "";
|
|
328 |
String msgB = "BEFORE: ", msgA = "AFTER : ";
|
337 |
329 |
for(int d=0; d<mesh.dataLength; d++)
|
338 |
330 |
{
|
339 |
331 |
msgB+="("+(2*halfW*bb.get(3*d+0))+","+(2*halfH*bb.get(3*d+1))+","+(2*halfZ*bb.get(3*d+2))+")";
|
|
332 |
msgA+="("+fb.get(3*d+0)+","+fb.get(3*d+1)+","+fb.get(3*d+2)+")";
|
340 |
333 |
}
|
341 |
334 |
android.util.Log.d( "Feedback", msgB);
|
342 |
|
|
343 |
|
String msgA = "";
|
344 |
|
for(int d=0; d<3*(mesh.dataLength-2); d++)
|
345 |
|
{
|
346 |
|
if( d==0 || d==1 || ((d-2)%3)==0)
|
347 |
|
msgA+="("+fb.get(3*d+0)+","+fb.get(3*d+1)+","+fb.get(3*d+2)+")";
|
348 |
|
}
|
349 |
335 |
android.util.Log.d( "Feedback", msgA);
|
350 |
336 |
|
351 |
|
android.util.Log.e( "Feedback",msgA.equalsIgnoreCase(msgB) ? "identical":"not identical");
|
352 |
|
|
353 |
|
|
354 |
337 |
/// DEBUG ONLY //////
|
355 |
338 |
// displayBoundingRect(halfW, halfH, halfZ, surface, mM.getMVP(), fb, currTime );
|
356 |
339 |
/// END DEBUG ///////
|
357 |
340 |
|
358 |
341 |
GLES30.glUnmapBuffer(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER);
|
359 |
|
|
|
342 |
*/
|
360 |
343 |
}
|
361 |
344 |
|
362 |
345 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Revert "This version appears to be fully working on Nexus 5X (it transfers back all the vertices and, if there are no vertex effects, the vertices transferred back are identical to the ones passed)."
This reverts commit 7cf57d72e238092806b3f833d85d16c1a38ac78d.