@Override public void onNewFrame(final HeadTransform headTransform){
  FPSCounter.logFrame();
  if (prefShowEnv && !bgEnv.isReady()) {
    if (prefShowEnvString.equals("Home Theater"))     bgEnv.init(0);
 else     bgEnv.init(1);
    bgEnv.setFixedModel();
    moveThing(bgEnv);
  }
  Matrix.setLookAtM(mCamera,0,0.0f,0.0f,CAMERA_Z,0.0f,0.0f,0.0f,0.0f,1.0f,0.0f);
  GLES20.glClearColor(r,g,b,a);
  headTransform.getHeadView(mHeadViewSDK,0);
  mHeadViewUse=getHeadView();
  if (screen.isLookingAtObject(mHeadViewUse)) {
    aimPoint.setAlpha(0);
  }
 else {
    aimPoint.setAlpha(1);
  }
  for (  ButtonThing button : buttonList) {
    if (button.isLookingAtObject(mHeadViewUse) && !button.isHidden) {
      if (fuseStart == -1) {
        fuseStart=SystemClock.elapsedRealtime();
        fuseButton=button;
      }
 else       if (fuseButton == button) {
        checkFuse(SystemClock.elapsedRealtime());
      }
    }
 else     if (fuseButton == button) {
      checkFuse(0);
      fuseStart=-1;
      fuseButton=null;
    }
  }
  Engine.checkGLError("onReadyToDraw");
}

@ Override public void onNewFrame ( final HeadTransform headTransform ) { FPSCounter . logFrame ( ) ; if ( prefShowEnv && ! bgEnv . isReady ( ) ) { if ( prefShowEnvString . equals ( "Home Theater" ) ) bgEnv . init ( 0 ) ; else bgEnv . init ( 1 ) ; bgEnv . setFixedModel ( ) ; moveThing ( bgEnv ) ; } Matrix . setLookAtM ( mCamera , 0 , 0.0f , 0.0f , CAMERA_Z , 0.0f , 0.0f , 0.0f , 0.0f , 1.0f , 0.0f ) ; GLES20 . glClearColor ( r , g , b , a ) ; headTransform . getHeadView ( mHeadViewSDK , 0 ) ; mHeadViewUse = getHeadView ( ) ; if ( screen . isLookingAtObject ( mHeadViewUse ) ) { aimPoint . setAlpha ( 0 ) ; } else { aimPoint . setAlpha ( 1 ) ; } for ( ButtonThing button : buttonList ) { if ( button . isLookingAtObject ( mHeadViewUse ) && ! button . isHidden ) { if ( fuseStart == - 1 ) { fuseStart = SystemClock . elapsedRealtime ( ) ; fuseButton = button ; } else if ( fuseButton == button ) { checkFuse ( SystemClock . elapsedRealtime ( ) ) ; } } else if ( fuseButton == button ) { checkFuse ( 0 ) ; fuseStart = - 1 ; fuseButton = null ; } } Engine . checkGLError ( "onReadyToDraw" ) ; }
prepares opengl es before we draw a frame .
