/** Sets visible page count to one or two. */
 public synchronized void setViewMode(int viewmode) {
   if (viewmode == SHOW_ONE_PAGE) {
     mViewMode = viewmode;
     mCurlRectRight.set(mViewRect);
     mObserver.onBitmapSizeChanged(mViewportWidth, mViewportHeight);
   } else if (viewmode == SHOW_TWO_PAGES) {
     mViewMode = viewmode;
     mCurlRectLeft.set(mViewRect);
     mCurlRectLeft.right = 0;
     mCurlRectRight.set(mViewRect);
     mCurlRectRight.left = 0;
     mObserver.onBitmapSizeChanged((mViewportWidth + 1) / 2, mViewportHeight);
   }
 }
  @Override
  public synchronized void onDrawFrame(GL10 gl) {
    if (mBackgroundColorChanged) {
      gl.glClearColor(
          Color.red(mBackgroundColor) / 255f,
          Color.green(mBackgroundColor) / 255f,
          Color.blue(mBackgroundColor) / 255f,
          Color.alpha(mBackgroundColor) / 255f);
    }

    gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glLoadIdentity();

    for (int i = 0; i < mCurlMeshes.size(); ++i) {
      mCurlMeshes.get(i).draw(gl);
    }

    mObserver.onRenderDone();
  }