Example #1
0
    /**
    * Build an OpenGL window, respecting the Rift's current display mode choice of
    * extended or direct HMD.
    */
    GLFWwindow * createRiftRenderingWindow(ovrHmd hmd, glm::uvec2 & outSize, glm::ivec2 & outPosition)
    {
        outPosition = glm::ivec2(hmd->WindowsPos.x, hmd->WindowsPos.y);
        outSize = glm::uvec2(hmd->Resolution.w, hmd->Resolution.h);

        return createExtendedModeWindow(outSize, outPosition);
    }
  /**
   * Build an OpenGL window, respecting the Rift's current display mode choice of
   * extended or direct HMD.
   */
  GLFWwindow * createRiftRenderingWindow(ovrHmd hmd, glm::uvec2 & outSize, glm::ivec2 & outPosition) {
    bool extendedMode = true;

    outPosition = glm::ivec2(hmd->WindowsPos.x, hmd->WindowsPos.y);
    outSize = glm::uvec2(hmd->Resolution.w, hmd->Resolution.h);

    // The ovrHmdCap_ExtendDesktop is currently only reported reliably on Windows
    ON_WINDOWS([&] {
      extendedMode = (ovrHmdCap_ExtendDesktop & hmd->HmdCaps);
    });

    return extendedMode
      ? createExtendedModeWindow(outSize, outPosition)
      : createDirectHmdModeWindow(hmd, outSize);
  }