private long doMemoryManagementAndPerFrameCallbacks ( ) { long currentTime = GVRTime . getCurrentTime ( ) ; mFrameTime = ( currentTime - mPreviousTimeNanos ) / 1e9f ; mPreviousTimeNanos = currentTime ; /* * Without the sensor data, can't draw a scene properly. */ if ( ! ( mSensoredScene == null || ! mMainScene . equals ( mSensoredScene ) ) ) { Runnable runnable ; while ( ( runnable = mRunnables . poll ( ) ) != null ) { try { runnable . run ( ) ; } catch ( final Exception exc ) { Log . e ( TAG , "Runnable-on-GL %s threw %s" , runnable , exc . toString ( ) ) ; exc . printStackTrace ( ) ; } } final List < GVRDrawFrameListener > frameListeners = mFrameListeners ; for ( GVRDrawFrameListener listener : frameListeners ) { try { listener . onDrawFrame ( mFrameTime ) ; } catch ( final Exception exc ) { Log . e ( TAG , "DrawFrameListener %s threw %s" , listener , exc . toString ( ) ) ; exc . printStackTrace ( ) ; } } } return currentTime ; }
This is the code that needs to be executed before either eye is drawn .