Esempio n. 1
0
        /// <summary>
        /// Updates this instance.
        /// </summary>
        private void Update()
        {
            if (IsConnected && OpenVR.Compositor != null)
            {
                //TODO: Move somewhere else since this is a hack
                Time.DrawFPS   = 90;
                Time.UpdateFPS = 90;

                // Get poses
                VRUtils.ReportCompositeError(OpenVR.Compositor.WaitGetPoses(renderPoses, gamePoses));

                // Update

                UpdateHMD();
                UpdateDevices();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes the OpenVR subsystem.
        /// </summary>
        private void InitOpenVR()
        {
            Debug.Log("[VR] OpenVR init begin");

            // Initialize OpenVR
            EVRInitError error = EVRInitError.None;

            Hmd = OpenVR.Init(ref error);

            bool success = true;

            if (error != EVRInitError.None)
            {
                VRUtils.ReportInitError(error);
                success = false;
            }

            // Check if compositor is present

            OpenVR.GetGenericInterface(OpenVR.IVRCompositor_Version, ref error);

            if (error != EVRInitError.None)
            {
                VRUtils.ReportInitError(error);
                success = false;
            }

            // Check if overlay is present

            OpenVR.GetGenericInterface(OpenVR.IVROverlay_Version, ref error);

            if (error != EVRInitError.None)
            {
                VRUtils.ReportInitError(error);
                success = false;
            }

            // Shutdown on error
            if (!success)
            {
                OpenVR.Shutdown();
            }

            Debug.Log("[VR] OpenVR init end");
        }
Esempio n. 3
0
 /// <summary>
 /// Submits the data for specified eye.
 /// </summary>
 /// <param name="eye">The eye.</param>
 /// <param name="texture">The texture.</param>
 /// <param name="bounds">The bounds.</param>
 private void Submit(EVREye eye, ref Texture_t texture, ref VRTextureBounds_t bounds)
 {
     VRUtils.ReportCompositeError(OpenVR.Compositor.Submit(eye, ref texture, ref bounds, EVRSubmitFlags.Submit_Default));
 }