/**
   * Draws a frame for an eye. The transformation for that eye (from the camera) is passed in as a
   * parameter.
   *
   * @param transform The transformations to apply to render this eye.
   */
  @Override
  public void onDrawEye(EyeTransform transform) {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    GLES20.glUseProgram(mProgram);

    GLES20.glActiveTexture(GL_TEXTURE_EXTERNAL_OES);
    GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture);

    mPositionHandle = GLES20.glGetAttribLocation(mProgram, "position");
    GLES20.glEnableVertexAttribArray(mPositionHandle);
    GLES20.glVertexAttribPointer(
        mPositionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, vertexStride, vertexBuffer);

    mTextureCoordHandle = GLES20.glGetAttribLocation(mProgram, "inputTextureCoordinate");
    GLES20.glEnableVertexAttribArray(mTextureCoordHandle);
    GLES20.glVertexAttribPointer(
        mTextureCoordHandle,
        COORDS_PER_VERTEX,
        GLES20.GL_FLOAT,
        false,
        vertexStride,
        textureVerticesBuffer);

    GLES20.glDrawElements(
        GLES20.GL_TRIANGLES, drawOrder.length, GLES20.GL_UNSIGNED_SHORT, drawListBuffer);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
    GLES20.glDisableVertexAttribArray(mTextureCoordHandle);

    Matrix.multiplyMM(mView, 0, transform.getEyeView(), 0, mCamera, 0);
  }
  /**
   * Draws a frame for an eye. The transformation for that eye (from the camera) is passed in as a
   * parameter.
   *
   * @param transform The transformations to apply to render this eye.
   */
  @Override
  public void onDrawEye(EyeTransform transform) {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    GLES20.glUseProgram(mProgram);

    GLES20.glActiveTexture(GL_TEXTURE_EXTERNAL_OES);
    GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture);

    mPositionHandle = GLES20.glGetAttribLocation(mProgram, "position");
    GLES20.glEnableVertexAttribArray(mPositionHandle);
    GLES20.glVertexAttribPointer(
        mPositionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, vertexStride, vertexBuffer);

    mTextureCoordHandle = GLES20.glGetAttribLocation(mProgram, "inputTextureCoordinate");
    GLES20.glEnableVertexAttribArray(mTextureCoordHandle);
    GLES20.glVertexAttribPointer(
        mTextureCoordHandle,
        COORDS_PER_VERTEX,
        GLES20.GL_FLOAT,
        false,
        vertexStride,
        textureVerticesBuffer);

    mColorHandle = GLES20.glGetAttribLocation(mProgram, "s_texture");

    GLES20.glDrawElements(
        GLES20.GL_TRIANGLES, drawOrder.length, GLES20.GL_UNSIGNED_SHORT, drawListBuffer);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
    GLES20.glDisableVertexAttribArray(mTextureCoordHandle);

    Matrix.multiplyMM(mView, 0, transform.getEyeView(), 0, mCamera, 0);

    //        mPositionParam = GLES20.glGetAttribLocation(mGlProgram, "a_Position");
    //        mNormalParam = GLES20.glGetAttribLocation(mGlProgram, "a_Normal");
    //        mColorParam = GLES20.glGetAttribLocation(mGlProgram, "a_Color");
    //
    //        GLES20.glEnableVertexAttribArray(mPositionParam);
    //        GLES20.glEnableVertexAttribArray(mNormalParam);
    //        GLES20.glEnableVertexAttribArray(mColorParam);
    //        checkGLError("mColorParam");
    //
    //        // Apply the eye transformation to the camera.
    //        Matrix.multiplyMM(mView, 0, transform.getEyeView(), 0, mCamera, 0);
    //
    //        // Set the position of the light
    //        Matrix.multiplyMV(mLightPosInEyeSpace, 0, mView, 0, mLightPosInWorldSpace, 0);
    //        GLES20.glUniform3f(mLightPosParam, mLightPosInEyeSpace[0], mLightPosInEyeSpace[1],
    //                mLightPosInEyeSpace[2]);
    //
    //        // Build the ModelView and ModelViewProjection matrices
    //        // for calculating cube position and light.
    //        Matrix.multiplyMM(mModelView, 0, mView, 0, mModelCube, 0);
    //        Matrix.multiplyMM(mModelViewProjection, 0, transform.getPerspective(), 0, mModelView,
    // 0);
    //        drawCube();
    //
    //        // Set mModelView for the floor, so we draw floor in the correct location
    //        Matrix.multiplyMM(mModelView, 0, mView, 0, mModelFloor, 0);
    //        Matrix.multiplyMM(mModelViewProjection, 0, transform.getPerspective(), 0,
    //            mModelView, 0);
    //        drawFloor(transform.getPerspective());
  }