@Override public void onDrawEye(Eye eye){
  GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
  Engine.checkGLError("mColorParam");
  if (!prefOrientationProviderString.equals("0")) {
    if (firstOnDrawEye > 0) {
      firstOnDrawEye--;
      float[] m=new float[16];
      Matrix.invertM(m,0,mHeadViewSDK,0);
      Matrix.multiplyMM(m,0,eye.getEyeView(),0,m,0);
      if (eye.getType() == Eye.Type.RIGHT) {
        mEyeRightView=m;
      }
 else       if (eye.getType() == Eye.Type.LEFT) {
        mEyeLeftView=m;
      }
      return;
    }
    float[] m=new float[16];
    if (eye.getType() == Eye.Type.RIGHT) {
      Matrix.multiplyMM(m,0,mHeadViewUse,0,mEyeRightView,0);
    }
 else {
      Matrix.multiplyMM(m,0,mHeadViewUse,0,mEyeLeftView,0);
    }
    Matrix.multiplyMM(mView,0,m,0,mCamera,0);
  }
 else {
    Matrix.multiplyMM(mView,0,eye.getEyeView(),0,mCamera,0);
  }
  float[] perspective=eye.getPerspective(Z_NEAR,Z_FAR);
  GLES20.glEnable(GLES20.GL_DEPTH_TEST);
  GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA,GLES20.GL_ONE_MINUS_SRC_ALPHA);
  GLES20.glEnable(GLES20.GL_BLEND);
  if (prefShowEnv && bgEnv.isReady()) {
    Matrix.multiplyMM(mModelView,0,mView,0,bgEnv.model,0);
    Matrix.multiplyMM(mModelViewProjection,0,perspective,0,mModelView,0);
    bgEnv.draw(eye.getType(),mModelViewProjection);
  }
  GLES20.glDisable(GLES20.GL_DEPTH_TEST);
  Matrix.multiplyMM(mModelViewProjection,0,perspective,0,cameraPreview.model,0);
  cameraPreview.draw(eye.getType(),mModelViewProjection);
  Matrix.multiplyMM(mModelView,0,mView,0,screen.model,0);
  Matrix.multiplyMM(mModelViewProjection,0,perspective,0,mModelView,0);
  screen.draw(eye.getType(),mModelViewProjection);
  for (  ButtonThing button : buttonList) {
    Matrix.multiplyMM(mModelView,0,mView,0,button.model,0);
    Matrix.multiplyMM(mModelViewProjection,0,perspective,0,mModelView,0);
    button.draw(eye.getType(),mModelViewProjection);
  }
  Matrix.multiplyMM(mModelViewProjection,0,perspective,0,aimPoint.model,0);
  aimPoint.draw(Eye.Type.MONOCULAR,mModelViewProjection);
}

@ Override public void onDrawEye ( Eye eye ) { GLES20 . glClear ( GLES20 . GL_COLOR_BUFFER_BIT | GLES20 . GL_DEPTH_BUFFER_BIT ) ; Engine . checkGLError ( "mColorParam" ) ; if ( ! prefOrientationProviderString . equals ( "0" ) ) { if ( firstOnDrawEye > 0 ) { firstOnDrawEye -- ; float [ ] m = new float [ 16 ] ; Matrix . invertM ( m , 0 , mHeadViewSDK , 0 ) ; Matrix . multiplyMM ( m , 0 , eye . getEyeView ( ) , 0 , m , 0 ) ; if ( eye . getType ( ) == Eye . Type . RIGHT ) { mEyeRightView = m ; } else if ( eye . getType ( ) == Eye . Type . LEFT ) { mEyeLeftView = m ; } return ; } float [ ] m = new float [ 16 ] ; if ( eye . getType ( ) == Eye . Type . RIGHT ) { Matrix . multiplyMM ( m , 0 , mHeadViewUse , 0 , mEyeRightView , 0 ) ; } else { Matrix . multiplyMM ( m , 0 , mHeadViewUse , 0 , mEyeLeftView , 0 ) ; } Matrix . multiplyMM ( mView , 0 , m , 0 , mCamera , 0 ) ; } else { Matrix . multiplyMM ( mView , 0 , eye . getEyeView ( ) , 0 , mCamera , 0 ) ; } float [ ] perspective = eye . getPerspective ( Z_NEAR , Z_FAR ) ; GLES20 . glEnable ( GLES20 . GL_DEPTH_TEST ) ; GLES20 . glBlendFunc ( GLES20 . GL_SRC_ALPHA , GLES20 . GL_ONE_MINUS_SRC_ALPHA ) ; GLES20 . glEnable ( GLES20 . GL_BLEND ) ; if ( prefShowEnv && bgEnv . isReady ( ) ) { Matrix . multiplyMM ( mModelView , 0 , mView , 0 , bgEnv . model , 0 ) ; Matrix . multiplyMM ( mModelViewProjection , 0 , perspective , 0 , mModelView , 0 ) ; bgEnv . draw ( eye . getType ( ) , mModelViewProjection ) ; } GLES20 . glDisable ( GLES20 . GL_DEPTH_TEST ) ; Matrix . multiplyMM ( mModelViewProjection , 0 , perspective , 0 , cameraPreview . model , 0 ) ; cameraPreview . draw ( eye . getType ( ) , mModelViewProjection ) ; Matrix . multiplyMM ( mModelView , 0 , mView , 0 , screen . model , 0 ) ; Matrix . multiplyMM ( mModelViewProjection , 0 , perspective , 0 , mModelView , 0 ) ; screen . draw ( eye . getType ( ) , mModelViewProjection ) ; for ( ButtonThing button : buttonList ) { Matrix . multiplyMM ( mModelView , 0 , mView , 0 , button . model , 0 ) ; Matrix . multiplyMM ( mModelViewProjection , 0 , perspective , 0 , mModelView , 0 ) ; button . draw ( eye . getType ( ) , mModelViewProjection ) ; } Matrix . multiplyMM ( mModelViewProjection , 0 , perspective , 0 , aimPoint . model , 0 ) ; aimPoint . draw ( Eye . Type . MONOCULAR , mModelViewProjection ) ; }
draws a frame for an eye .
