public MosaicPreviewRenderer(SurfaceTexture tex, int w, int h, boolean isLandscape) {
    mMosaicOutputSurfaceTexture = tex;
    mWidth = w;
    mHeight = h;
    mIsLandscape = isLandscape;

    mEglThread = new HandlerThread("PanoramaRealtimeRenderer");
    mEglThread.start();
    mEglHandler = new EGLHandler(mEglThread.getLooper());

    // We need to sync this because the generation of surface texture for input is
    // done here and the client will continue with the assumption that the
    // generation is completed.
    mEglHandler.sendMessageSync(EGLHandler.MSG_INIT_EGL_SYNC);
  }
 public void alignFrame() {
   mEglHandler.sendEmptyMessage(EGLHandler.MSG_ALIGN_FRAME);
 }
 public void showPreviewFrame() {
   mEglHandler.sendEmptyMessage(EGLHandler.MSG_SHOW_PREVIEW_FRAME);
 }
 public void showPreviewFrameSync() {
   mEglHandler.sendMessageSync(EGLHandler.MSG_SHOW_PREVIEW_FRAME_SYNC);
 }
 public void release() {
   mEglHandler.sendEmptyMessage(EGLHandler.MSG_RELEASE);
 }