Exemple #1
0
 /// <summary>
 /// Creates a handle to a VR session.
 ///
 /// Upon success the returned IntPtr must be eventually freed with Destroy when it is no longer needed.
 /// A second call to Create will result in an error return value if the previous Hmd has not been destroyed.
 /// </summary>
 /// <param name="sessionPtr">
 /// Provides a pointer to an IntPtr which will be written to upon success.
 /// </param>
 /// <param name="pLuid">
 /// Provides a system specific graphics adapter identifier that locates which
 /// graphics adapter has the HMD attached. This must match the adapter used by the application
 /// or no rendering output will be possible. This is important for stability on multi-adapter systems. An
 /// application that simply chooses the default adapter will not run reliably on multi-adapter systems.
 /// </param>
 /// <remarks>
 /// Call Marshal.PtrToStructure(...) to convert the IntPtr to the OVR.ovrHmd type.
 /// </remarks>
 /// <returns>
 /// Returns an ovrResult indicating success or failure. Upon failure
 /// the returned pHmd will be null.
 /// </returns>
 /// <example>
 /// <code>
 /// IntPtr sessionPtr;
 /// ovrGraphicsLuid luid;
 /// ovrResult result = Create(ref session, ref luid);
 /// if(OVR_FAILURE(result))
 /// ...
 /// </code>
 /// </example>
 /// <see cref="Destroy"/>
 public static Result Create(ref IntPtr sessionPtr, ref GraphicsLuid pLuid)
 {
     if (Environment.Is64BitProcess)
     {
         return(OculusNative64.ovr_Create(ref sessionPtr, ref pLuid));
     }
     else
     {
         return(OculusNative32.ovr_Create(ref sessionPtr, ref pLuid));
     }
 }
 internal static extern Result ovr_Create(ref IntPtr sessionPtr, ref GraphicsLuid pLuid);