/**
   * Rendering of a single frame. Here we update and render the detected trackable list.
   *
   * @param gl Unused context.
   */
  @Override
  public void onDrawFrame(GL10 gl) {
    if (MainInterface.DEBUG_FRAME_LOGGING) log.pushTimer(this, "opengl frame");

    // Clear:
    GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

    // If new markerlist, get:
    if (mainInterface.getListUpdateStatus()) {
      this.toRender = mainInterface.getList();
      if (toRender == null) {
        log.log(TAG, "Error getting list!");
        toRender = new ArrayList<Trackable>();
      } else log.debug(TAG, "Updated list – found " + this.toRender.size() + " " + "trackables.");
    }
    // ------------------------ RENDER ------------------------
    if (!toRender.isEmpty()) {
      for (Trackable trackable : toRender) {
        // Reset model matrix to identity
        Matrix.setIdentityM(mModelMatrix, 0);
        Matrix.multiplyMM(mModelMatrix, 0, trackable.getTRANSLATION(), 0, mModelMatrix, 0);
        drawObject(trackable.getFloatbuffer());
      }
    }
    if (MainInterface.DEBUG_FRAME_LOGGING) {
      log.debug(TAG, "OpenGL rendered frame in " + log.popTimer(this).time + "ms.");
    }
  }
 /**
  * Method for modifying the binary threshold for Detector. Only use after checking with
  * DEBUG_PREP_FRAME if the binarization actually is the error! Used to set all 3 binarization
  * methods, including Canny!
  *
  * @param value The value to set it to.
  */
 @SuppressWarnings("UnusedDeclaration")
 public void setBinaryThreshold(int value) {
   if (value >= 0 && value <= 255) {
     log.debug(TAG, "Setting theshold to " + value);
     this.threshold = value;
   } else this.threshold = 100;
 }