public void onDrawFrame(GL10 glUnused){
  boolean isNewFrame=false;
  int frameNumber=0;
synchronized (this) {
    if (updateSurface) {
      isNewFrame=true;
      frameNumber=mFrameNumber;
      mSurface.updateTexImage();
      mSurface.getTransformMatrix(mSTMatrix);
      updateSurface=false;
    }
  }
  GLES20.glClearColor(0.0f,1.0f,0.0f,1.0f);
  GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
  GLES20.glUseProgram(mProgram);
  checkGlError("glUseProgram");
  GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
  GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES,mTextureID);
  mTriangleVertices.position(TRIANGLE_VERTICES_DATA_POS_OFFSET);
  GLES20.glVertexAttribPointer(maPositionHandle,3,GLES20.GL_FLOAT,false,TRIANGLE_VERTICES_DATA_STRIDE_BYTES,mTriangleVertices);
  checkGlError("glVertexAttribPointer maPosition");
  GLES20.glEnableVertexAttribArray(maPositionHandle);
  checkGlError("glEnableVertexAttribArray maPositionHandle");
  mTriangleVertices.position(TRIANGLE_VERTICES_DATA_UV_OFFSET);
  GLES20.glVertexAttribPointer(maTextureHandle,3,GLES20.GL_FLOAT,false,TRIANGLE_VERTICES_DATA_STRIDE_BYTES,mTriangleVertices);
  checkGlError("glVertexAttribPointer maTextureHandle");
  GLES20.glEnableVertexAttribArray(maTextureHandle);
  checkGlError("glEnableVertexAttribArray maTextureHandle");
  Matrix.setIdentityM(mMVPMatrix,0);
  GLES20.glUniformMatrix4fv(muMVPMatrixHandle,1,false,mMVPMatrix,0);
  GLES20.glUniformMatrix4fv(muSTMatrixHandle,1,false,mSTMatrix,0);
  GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP,0,4);
  checkGlError("glDrawArrays");
  GLES20.glFinish();
  if (isNewFrame) {
    Log.d(TAG,mDrawNumber + "/" + frameNumber+ " before dumping "+ System.currentTimeMillis());
    DumpToFile(frameNumber);
    Log.d(TAG,mDrawNumber + "/" + frameNumber+ " after  dumping "+ System.currentTimeMillis());
    mDrawNumber++;
  }
}

public void onDrawFrame ( GL10 glUnused ) { boolean isNewFrame = false ; int frameNumber = 0 ; synchronized ( this ) { if ( updateSurface ) { isNewFrame = true ; frameNumber = mFrameNumber ; mSurface . updateTexImage ( ) ; mSurface . getTransformMatrix ( mSTMatrix ) ; updateSurface = false ; } } GLES20 . glClearColor ( 0.0f , 1.0f , 0.0f , 1.0f ) ; GLES20 . glClear ( GLES20 . GL_DEPTH_BUFFER_BIT | GLES20 . GL_COLOR_BUFFER_BIT ) ; GLES20 . glUseProgram ( mProgram ) ; checkGlError ( "glUseProgram" ) ; GLES20 . glActiveTexture ( GLES20 . GL_TEXTURE0 ) ; GLES20 . glBindTexture ( GL_TEXTURE_EXTERNAL_OES , mTextureID ) ; mTriangleVertices . position ( TRIANGLE_VERTICES_DATA_POS_OFFSET ) ; GLES20 . glVertexAttribPointer ( maPositionHandle , 3 , GLES20 . GL_FLOAT , false , TRIANGLE_VERTICES_DATA_STRIDE_BYTES , mTriangleVertices ) ; checkGlError ( "glVertexAttribPointer maPosition" ) ; GLES20 . glEnableVertexAttribArray ( maPositionHandle ) ; checkGlError ( "glEnableVertexAttribArray maPositionHandle" ) ; mTriangleVertices . position ( TRIANGLE_VERTICES_DATA_UV_OFFSET ) ; GLES20 . glVertexAttribPointer ( maTextureHandle , 3 , GLES20 . GL_FLOAT , false , TRIANGLE_VERTICES_DATA_STRIDE_BYTES , mTriangleVertices ) ; checkGlError ( "glVertexAttribPointer maTextureHandle" ) ; GLES20 . glEnableVertexAttribArray ( maTextureHandle ) ; checkGlError ( "glEnableVertexAttribArray maTextureHandle" ) ; Matrix . setIdentityM ( mMVPMatrix , 0 ) ; GLES20 . glUniformMatrix4fv ( muMVPMatrixHandle , 1 , false , mMVPMatrix , 0 ) ; GLES20 . glUniformMatrix4fv ( muSTMatrixHandle , 1 , false , mSTMatrix , 0 ) ; GLES20 . glDrawArrays ( GLES20 . GL_TRIANGLE_STRIP , 0 , 4 ) ; checkGlError ( "glDrawArrays" ) ; GLES20 . glFinish ( ) ; if ( isNewFrame ) { Log . d ( TAG , mDrawNumber + "/" + frameNumber + " before dumping " + System . currentTimeMillis ( ) ) ; DumpToFile ( frameNumber ) ; Log . d ( TAG , mDrawNumber + "/" + frameNumber + " after  dumping " + System . currentTimeMillis ( ) ) ; mDrawNumber ++ ; } }
called to draw the current frame . this method is responsible for drawing the current frame .
