Package org.lwjgl.ovr

Class OVR



  • public class OVR
    extends java.lang.Object
    Native bindings to libOVR, using the Oculus SDK C API.

    Overview of the API:

    Setup

    Application Loop

    • Call GetPredictedDisplayTime to get the current frame timing information.
    • Call GetTrackingState and CalcEyePoses to obtain the predicted rendering pose for each eye based on timing.
    • Render the scene content into the current buffer of the texture swapchains for each eye and layer you plan to update this frame. If you render into a texture swap chain, you must call CommitTextureSwapChain on it to commit the changes before you reference the chain this frame (otherwise, your latest changes won't be picked up).
    • Call SubmitFrame to render the distorted layers to and present them on the HMD. If SubmitFrame returns Success_NotVisible, there is no need to render the scene for the next loop iteration. Instead, just call SubmitFrame again until it returns Success.

    Shutdown

    • Field Detail

      • ovrInit_Debug

        public static final int ovrInit_Debug
        When a debug library is requested, a slower debugging version of the library will run which can be used to help solve problems in the library and debug application code.
        See Also:
        Constant Field Values
      • ovrInit_RequestVersion

        public static final int ovrInit_RequestVersion
        When a version is requested, the LibOVR runtime respects the RequestedMinorVersion field and verifies that the RequestedMinorVersion is supported.
        See Also:
        Constant Field Values
      • ovrInit_WritableBits

        public static final int ovrInit_WritableBits
        These bits are writable by user code.
        See Also:
        Constant Field Values
      • ovrLogLevel_Debug

        public static final int ovrLogLevel_Debug
        Debug-level log event.
        See Also:
        Constant Field Values
      • ovrLogLevel_Info

        public static final int ovrLogLevel_Info
        Info-level log event.
        See Also:
        Constant Field Values
      • ovrLogLevel_Error

        public static final int ovrLogLevel_Error
        Error-level log event.
        See Also:
        Constant Field Values
      • ovrHmd_None

        public static final int ovrHmd_None
        HMD types. (ovrHmdType)
        See Also:
        Constant Field Values
      • ovrHmd_DKHD

        public static final int ovrHmd_DKHD
        HMD types. (ovrHmdType)
        See Also:
        Constant Field Values
      • ovrHmd_Other

        public static final int ovrHmd_Other
        HMD types. (ovrHmdType)
        See Also:
        Constant Field Values
      • ovrHmd_E3_2015

        public static final int ovrHmd_E3_2015
        HMD types. (ovrHmdType)
        See Also:
        Constant Field Values
      • ovrHmd_ES06

        public static final int ovrHmd_ES06
        HMD types. (ovrHmdType)
        See Also:
        Constant Field Values
      • ovrHmd_ES09

        public static final int ovrHmd_ES09
        HMD types. (ovrHmdType)
        See Also:
        Constant Field Values
      • ovrHmd_ES11

        public static final int ovrHmd_ES11
        HMD types. (ovrHmdType)
        See Also:
        Constant Field Values
      • ovrHmdCap_DebugDevice

        public static final int ovrHmdCap_DebugDevice
        (read only) Specifies that the HMD is a virtual debug device.
        See Also:
        Constant Field Values
      • ovrTrackingCap_Orientation

        public static final int ovrTrackingCap_Orientation
        Supports orientation tracking (IMU).
        See Also:
        Constant Field Values
      • ovrTrackingCap_MagYawCorrection

        public static final int ovrTrackingCap_MagYawCorrection
        Supports yaw drift correction via a magnetometer or other means.
        See Also:
        Constant Field Values
      • ovrTrackingCap_Position

        public static final int ovrTrackingCap_Position
        Supports positional tracking.
        See Also:
        Constant Field Values
      • ovrEye_Left

        public static final int ovrEye_Left
        The left eye, from the viewer's perspective.
        See Also:
        Constant Field Values
      • ovrEye_Right

        public static final int ovrEye_Right
        The right eye, from the viewer's perspective.
        See Also:
        Constant Field Values
      • ovrTrackingOrigin_EyeLevel

        public static final int ovrTrackingOrigin_EyeLevel
        Tracking system origin reported at eye (HMD) height.

        Prefer using this origin when your application requires matching user's current physical head pose to a virtual head pose without any regards to a the height of the floor. Cockpit-based, or 3rd-person experiences are ideal candidates. When used, all poses in OVRTrackingState are reported as an offset transform from the profile calibrated or recentered HMD pose. It is recommended that apps using this origin type call RecenterTrackingOrigin prior to starting the VR experience, but notify the user before doing so to make sure the user is in a comfortable pose, facing a comfortable direction.

        See Also:
        Constant Field Values
      • ovrTrackingOrigin_FloorLevel

        public static final int ovrTrackingOrigin_FloorLevel
        Tracking system origin reported at floor height.

        Prefer using this origin when your application requires the physical floor height to match the virtual floor height, such as standing experiences. When used, all poses in OVRTrackingState are reported as an offset transform from the profile calibrated floor pose. Calling RecenterTrackingOrigin will recenter the X & Z axes as well as yaw, but the Y-axis (i.e. height) will continue to be reported using the floor height as the origin for all poses.

        See Also:
        Constant Field Values
      • ovrStatus_OrientationTracked

        public static final int ovrStatus_OrientationTracked
        Orientation is currently tracked (connected and in use).
        See Also:
        Constant Field Values
      • ovrStatus_PositionTracked

        public static final int ovrStatus_PositionTracked
        Position is currently tracked (false if out of range).
        See Also:
        Constant Field Values
      • ovrTracker_Connected

        public static final int ovrTracker_Connected
        The sensor is present, else the sensor is absent or offline.
        See Also:
        Constant Field Values
      • ovrTracker_PoseTracked

        public static final int ovrTracker_PoseTracked
        The sensor has a valid pose, else the pose is unavailable. This will only be set if ovrTracker_Connected is set.
        See Also:
        Constant Field Values
      • ovrTexture_2D_External

        public static final int ovrTexture_2D_External
        External 2D texture. Not used on PC
        See Also:
        Constant Field Values
      • ovrTexture_Cube

        public static final int ovrTexture_Cube
        Cube maps. Not currently supported on PC.
        See Also:
        Constant Field Values
      • ovrTextureBind_None

        public static final int ovrTextureBind_None
        The bindings required for texture swap chain. (ovrTextureBindFlags)

        All texture swap chains are automatically bindable as shader input resources since the Oculus runtime needs this to read them.

        See Also:
        Constant Field Values
      • ovrTextureBind_DX_RenderTarget

        public static final int ovrTextureBind_DX_RenderTarget
        The application can write into the chain with pixel shader
        See Also:
        Constant Field Values
      • ovrTextureBind_DX_UnorderedAccess

        public static final int ovrTextureBind_DX_UnorderedAccess
        The application can write to the chain with compute shader
        See Also:
        Constant Field Values
      • ovrTextureBind_DX_DepthStencil

        public static final int ovrTextureBind_DX_DepthStencil
        The chain buffers can be bound as depth and/or stencil buffers
        See Also:
        Constant Field Values
      • OVR_FORMAT_UNKNOWN

        public static final int OVR_FORMAT_UNKNOWN
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_R8G8B8A8_UNORM

        public static final int OVR_FORMAT_R8G8B8A8_UNORM
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_R8G8B8A8_UNORM_SRGB

        public static final int OVR_FORMAT_R8G8B8A8_UNORM_SRGB
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_B8G8R8A8_UNORM

        public static final int OVR_FORMAT_B8G8R8A8_UNORM
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_R16G16B16A16_FLOAT

        public static final int OVR_FORMAT_R16G16B16A16_FLOAT
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_D16_UNORM

        public static final int OVR_FORMAT_D16_UNORM
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_D24_UNORM_S8_UINT

        public static final int OVR_FORMAT_D24_UNORM_S8_UINT
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_D32_FLOAT

        public static final int OVR_FORMAT_D32_FLOAT
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_D32_FLOAT_S8X24_UINT

        public static final int OVR_FORMAT_D32_FLOAT_S8X24_UINT
        The format of a texture. (ovrTextureFormat)
        See Also:
        Constant Field Values
      • OVR_FORMAT_B5G6R5_UNORM

        public static final int OVR_FORMAT_B5G6R5_UNORM
        Not currently supported on PC. Would require a DirectX 11.1 device.
        See Also:
        Constant Field Values
      • OVR_FORMAT_B5G5R5A1_UNORM

        public static final int OVR_FORMAT_B5G5R5A1_UNORM
        Not currently supported on PC. Would require a DirectX 11.1 device.
        See Also:
        Constant Field Values
      • OVR_FORMAT_B4G4R4A4_UNORM

        public static final int OVR_FORMAT_B4G4R4A4_UNORM
        Not currently supported on PC. Would require a DirectX 11.1 device.
        See Also:
        Constant Field Values
      • OVR_FORMAT_B8G8R8A8_UNORM_SRGB

        public static final int OVR_FORMAT_B8G8R8A8_UNORM_SRGB
        Not supported for OpenGL applications.
        See Also:
        Constant Field Values
      • OVR_FORMAT_B8G8R8X8_UNORM

        public static final int OVR_FORMAT_B8G8R8X8_UNORM
        Not supported for OpenGL applications.
        See Also:
        Constant Field Values
      • OVR_FORMAT_B8G8R8X8_UNORM_SRGB

        public static final int OVR_FORMAT_B8G8R8X8_UNORM_SRGB
        Not supported for OpenGL applications.
        See Also:
        Constant Field Values
      • ovrTextureMisc_None

        public static final int ovrTextureMisc_None
        Misc flags overriding particular behaviors of a texture swap chain. (ovrTextureFlags)
        See Also:
        Constant Field Values
      • ovrTextureMisc_DX_Typeless

        public static final int ovrTextureMisc_DX_Typeless
        DX only: The underlying texture is created with a TYPELESS equivalent of the format specified in the texture desc. The SDK will still access the texture using the format specified in the texture desc, but the app can create views with different formats if this is specified.
        See Also:
        Constant Field Values
      • ovrTextureMisc_AllowGenerateMips

        public static final int ovrTextureMisc_AllowGenerateMips
        DX only: Allow generation of the mip chain on the GPU via the GenerateMips call. This flag requires that RenderTarget binding also be specified.
        See Also:
        Constant Field Values
      • ovrTextureMisc_ProtectedContent

        public static final int ovrTextureMisc_ProtectedContent
        Texture swap chain contains protected content, and requires HDCP connection in order to display to HMD. Also prevents mirroring or other redirection of any frame containing this contents
        See Also:
        Constant Field Values
      • ovrButton_RThumb

        public static final int ovrButton_RThumb
        Button RThumb
        See Also:
        Constant Field Values
      • ovrButton_RShoulder

        public static final int ovrButton_RShoulder
        Button RShoulder
        See Also:
        Constant Field Values
      • ovrButton_RMask

        public static final int ovrButton_RMask
        Bit mask of all buttons on the right Touch controller
        See Also:
        Constant Field Values
      • ovrButton_LThumb

        public static final int ovrButton_LThumb
        Button LThumb
        See Also:
        Constant Field Values
      • ovrButton_LShoulder

        public static final int ovrButton_LShoulder
        Button LShoulder
        See Also:
        Constant Field Values
      • ovrButton_LMask

        public static final int ovrButton_LMask
        Bit mask of all buttons on the left Touch controller
        See Also:
        Constant Field Values
      • ovrButton_VolDown

        public static final int ovrButton_VolDown
        Button VolDown
        See Also:
        Constant Field Values
      • ovrButton_Private

        public static final int ovrButton_Private
        Button input types. (ovrTouch)
        See Also:
        Constant Field Values
      • ovrTouch_RIndexTrigger

        public static final int ovrTouch_RIndexTrigger
        Touch RIndexTrigger
        See Also:
        Constant Field Values
      • ovrTouch_RButtonMask

        public static final int ovrTouch_RButtonMask
        Bit mask of all the button touches on the right controller
        See Also:
        Constant Field Values
      • ovrTouch_LIndexTrigger

        public static final int ovrTouch_LIndexTrigger
        Touch LIndexTrigger
        See Also:
        Constant Field Values
      • ovrTouch_LButtonMask

        public static final int ovrTouch_LButtonMask
        Bit mask of all the button touches on the left controller
        See Also:
        Constant Field Values
      • ovrTouch_RIndexPointing

        public static final int ovrTouch_RIndexPointing
        TouchRIndexPointing
        See Also:
        Constant Field Values
      • ovrTouch_RThumbUp

        public static final int ovrTouch_RThumbUp
        Touch RThumbUp
        See Also:
        Constant Field Values
      • ovrTouch_RPoseMask

        public static final int ovrTouch_RPoseMask
        Bit mask of all right controller poses
        See Also:
        Constant Field Values
      • ovrTouch_LIndexPointing

        public static final int ovrTouch_LIndexPointing
        Touch LIndexPointing
        See Also:
        Constant Field Values
      • ovrTouch_LThumbUp

        public static final int ovrTouch_LThumbUp
        Touch LThumbUp
        See Also:
        Constant Field Values
      • ovrTouch_LPoseMask

        public static final int ovrTouch_LPoseMask
        Bit mask of all left controller poses.
        See Also:
        Constant Field Values
      • ovrControllerType_None

        public static final int ovrControllerType_None
        Which controller is connected; multiple can be connected at once. (ovrControllerType)
        See Also:
        Constant Field Values
      • ovrControllerType_LTouch

        public static final int ovrControllerType_LTouch
        Which controller is connected; multiple can be connected at once. (ovrControllerType)
        See Also:
        Constant Field Values
      • ovrControllerType_RTouch

        public static final int ovrControllerType_RTouch
        Which controller is connected; multiple can be connected at once. (ovrControllerType)
        See Also:
        Constant Field Values
      • ovrControllerType_Touch

        public static final int ovrControllerType_Touch
        Which controller is connected; multiple can be connected at once. (ovrControllerType)
        See Also:
        Constant Field Values
      • ovrControllerType_Remote

        public static final int ovrControllerType_Remote
        Which controller is connected; multiple can be connected at once. (ovrControllerType)
        See Also:
        Constant Field Values
      • ovrControllerType_XBox

        public static final int ovrControllerType_XBox
        Which controller is connected; multiple can be connected at once. (ovrControllerType)
        See Also:
        Constant Field Values
      • ovrControllerType_Active

        public static final int ovrControllerType_Active
        Operate on or query whichever controller is active.
        See Also:
        Constant Field Values
      • ovrHand_Left

        public static final int ovrHand_Left
        Names for the left and right hand array indexes. (ovrHandType)
        See Also:
        Constant Field Values
      • ovrHand_Right

        public static final int ovrHand_Right
        Names for the left and right hand array indexes. (ovrHandType)
        See Also:
        Constant Field Values
      • ovrLayerType_Disabled

        public static final int ovrLayerType_Disabled
        Layer is disabled.
        See Also:
        Constant Field Values
      • ovrLayerFlag_HighQuality

        public static final int ovrLayerFlag_HighQuality
        Enables 4x anisotropic sampling during the composition of the layer. The benefits are mostly visible at the periphery for high-frequency & high-contrast visuals. For best results consider combining this flag with an ovrTextureSwapChain that has mipmaps and instead of using arbitrary sized textures, prefer texture sizes that are powers-of-two. Actual rendered viewport and doesn't necessarily have to fill the whole texture.
        See Also:
        Constant Field Values
      • ovrLayerFlag_TextureOriginAtBottomLeft

        public static final int ovrLayerFlag_TextureOriginAtBottomLeft
        the opposite is TopLeft. Generally this is false for D3D, true for OpenGL.
        See Also:
        Constant Field Values
      • ovrLayerFlag_HeadLocked

        public static final int ovrLayerFlag_HeadLocked
        Mark this surface as "headlocked", which means it is specified relative to the HMD and moves with it, rather than being specified relative to sensor/torso space and remaining still while the head moves. What used to be ovrLayerType_QuadHeadLocked is now LayerType_Quad plus this flag. However the flag can be applied to any layer type to achieve a similar effect.
        See Also:
        Constant Field Values
      • ovrPerfHud_Off

        public static final int ovrPerfHud_Off
        Turns off the performance HUD
        See Also:
        Constant Field Values
      • ovrPerfHud_PerfSummary

        public static final int ovrPerfHud_PerfSummary
        Shows performance summary and headroom
        See Also:
        Constant Field Values
      • ovrPerfHud_LatencyTiming

        public static final int ovrPerfHud_LatencyTiming
        Shows latency related timing info
        See Also:
        Constant Field Values
      • ovrPerfHud_AppRenderTiming

        public static final int ovrPerfHud_AppRenderTiming
        Shows render timing info for application
        See Also:
        Constant Field Values
      • ovrPerfHud_CompRenderTiming

        public static final int ovrPerfHud_CompRenderTiming
        Shows render timing info for OVR compositor
        See Also:
        Constant Field Values
      • ovrPerfHud_VersionInfo

        public static final int ovrPerfHud_VersionInfo
        Shows SDK & HMD version Info
        See Also:
        Constant Field Values
      • ovrLayerHud_Off

        public static final int ovrLayerHud_Off
        Turns off the layer HUD
        See Also:
        Constant Field Values
      • ovrLayerHud_Info

        public static final int ovrLayerHud_Info
        Shows info about a specific layer
        See Also:
        Constant Field Values
      • ovrDebugHudStereo_Off

        public static final int ovrDebugHudStereo_Off
        Visual properties of the stereo guide.
        See Also:
        Constant Field Values
      • ovrDebugHudStereo_Quad

        public static final int ovrDebugHudStereo_Quad
        Visual properties of the stereo guide.
        See Also:
        Constant Field Values
      • ovrDebugHudStereo_QuadWithCrosshair

        public static final int ovrDebugHudStereo_QuadWithCrosshair
        Visual properties of the stereo guide.
        See Also:
        Constant Field Values
      • ovrDebugHudStereo_CrosshairAtInfinity

        public static final int ovrDebugHudStereo_CrosshairAtInfinity
        Visual properties of the stereo guide.
        See Also:
        Constant Field Values
    • Method Detail

      • ovr_Initialize

        public static int ovr_Initialize(OVRInitParams params)
        Initialize LibOVR for application usage. This includes finding and loading the LibOVRRT shared library. No LibOVR API functions, other than GetLastErrorInfo and _Detect, can be called unless Initialize succeeds. A successful call to ovr_Initialize must be eventually followed by a call to Shutdown. ovr_Initialize calls are idempotent. Calling ovr_Initialize twice does not require two matching calls to ovr_Shutdown. If already initialized, the return value is Success.

        LibOVRRT shared library search order:

        1. Current working directory (often the same as the application directory).
        2. Module directory (usually the same as the application directory, but not if the module is a separate shared library).
        3. Application directory
        4. Development directory (only if OVR_ENABLE_DEVELOPER_SEARCH is enabled, which is off by default).
        5. Standard OS shared library search location(s) (OS-specific).
        Parameters:
        params - an OVRInitParams struct that cpecifies custom initialization options. May be NULL to indicate default options.
        Returns:
        an ovrResult indicating success or failure. In the case of failure, use GetLastErrorInfo to get more information. Example failed results include:
      • ovr_Shutdown

        public static void ovr_Shutdown()
        Shuts down LibOVR.

        A successful call to Initialize must be eventually matched by a call to ovr_Shutdown. After calling ovr_Shutdown, no LibOVR functions can be called except GetLastErrorInfo or another Initialize. ovr_Shutdown invalidates all pointers, references, and created objects previously returned by LibOVR functions. The LibOVRRT shared library can be unloaded by ovr_Shutdown.

      • ovr_GetLastErrorInfo

        public static void ovr_GetLastErrorInfo(OVRErrorInfo errorInfo)
        Returns information about the most recent failed return value by the current thread for this library.

        This function itself can never generate an error. The last error is never cleared by LibOVR, but will be overwritten by new errors. Do not use this call to determine if there was an error in the last API call as successful API calls don't clear the last OVRErrorInfo. To avoid any inconsistency, GetLastErrorInfo should be called immediately after an API function that returned a failed ovrResult, with no other API functions called in the interim.

        Parameters:
        errorInfo - The last OVRErrorInfo for the current thread
      • ovr_GetVersionString

        public static java.lang.String ovr_GetVersionString()
        Returns the version string representing the LibOVRRT version.

        The returned string pointer is valid until the next call to Shutdown.

        Note that the returned version string doesn't necessarily match the current OVR_MAJOR_VERSION, etc., as the returned string refers to the LibOVRRT shared library version and not the locally compiled interface version.

        The format of this string is subject to change in future versions and its contents should not be interpreted.

        Returns:
        a UTF8-encoded null-terminated version string
      • ovr_TraceMessage

        public static java.lang.String ovr_TraceMessage(int level,
                                                        java.nio.ByteBuffer message)
        Writes a message string to the LibOVR tracing mechanism (if enabled).

        This message will be passed back to the application via the OVRLogCallback if it was registered.

        Parameters:
        level - an ovrLogLevel constant. One of:
        LogLevel_DebugLogLevel_InfoLogLevel_Error
        message - a UTF8-encoded null-terminated string
        Returns:
        the strlen of the message or a negative value if the message is too large
      • ovr_TraceMessage

        public static java.lang.String ovr_TraceMessage(int level,
                                                        java.lang.CharSequence message)
        Writes a message string to the LibOVR tracing mechanism (if enabled).

        This message will be passed back to the application via the OVRLogCallback if it was registered.

        Parameters:
        level - an ovrLogLevel constant. One of:
        LogLevel_DebugLogLevel_InfoLogLevel_Error
        message - a UTF8-encoded null-terminated string
        Returns:
        the strlen of the message or a negative value if the message is too large
      • ovr_GetHmdDesc

        public static OVRHmdDesc ovr_GetHmdDesc(long session,
                                                OVRHmdDesc __result)
        Returns information about the current HMD.

        Initialize must have first been called in order for this to succeed, otherwise ovrHmdDesc::Type will be reported as Hmd_None.

        Parameters:
        session - an ovrSession previously returned by Create, else NULL in which case this function detects whether an HMD is present and returns its info if so.
        __result - an OVRHmdDesc. If the hmd is NULL and ovrHmdDesc::Type is Hmd_None then no HMD is present.
      • ovr_GetTrackerCount

        public static int ovr_GetTrackerCount(long session)
        Returns the number of sensors.

        The number of sensors may change at any time, so this function should be called before use as opposed to once on startup.

        Parameters:
        session - an ovrSession previously returned by Create
      • ovr_GetTrackerDesc

        public static OVRTrackerDesc ovr_GetTrackerDesc(long session,
                                                        int trackerDescIndex,
                                                        OVRTrackerDesc __result)
        Returns a given sensor description.

        It's possible that sensor desc [0] may indicate a unconnnected or non-pose tracked sensor, but sensor desc [1] may be connected.

        Initialize must have first been called in order for this to succeed, otherwise the returned trackerDescArray will be zero-initialized. The data returned by this function can change at runtime.

        Parameters:
        session - an ovrSession previously returned by Create
        trackerDescIndex - a sensor index. The valid indexes are in the range of 0 to the sensor count returned by GetTrackerCount.
        __result - an OVRTrackerDesc. An empty OVRTrackerDesc will be returned if trackerDescIndex is out of range.
      • ovr_Create

        public static int ovr_Create(PointerBuffer pSession,
                                     OVRGraphicsLuid luid)
        Creates a handle to a VR session.

        Upon success the returned ovrSession 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.

        Parameters:
        pSession - a pointer to an ovrSession which will be written to upon success
        luid - 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.
        Returns:
        an ovrResult indicating success or failure. Upon failure the returned pHmd will be NULL.
      • ovr_Destroy

        public static void ovr_Destroy(long session)
        Destroys the HMD.
        Parameters:
        session - an ovrSession previously returned by Create
      • ovr_GetSessionStatus

        public static int ovr_GetSessionStatus(long session,
                                               OVRSessionStatus sessionStatus)
        Returns status information for the application.
        Parameters:
        session - an ovrSession previously returned by Create
        sessionStatus - an OVRSessionStatus that is filled in
      • ovr_SetTrackingOriginType

        public static int ovr_SetTrackingOriginType(long session,
                                                    int origin)
        Sets the tracking origin type.

        When the tracking origin is changed, all of the calls that either provide or accept ovrPosef will use the new tracking origin provided.

        Parameters:
        session - an ovrSession previously returned by Create
        origin - an ovrTrackingOrigin to be used for all OVRPosef
      • ovr_GetTrackingOriginType

        public static int ovr_GetTrackingOriginType(long session)
        Gets the tracking origin state.
        Parameters:
        session - an ovrSession previously returned by Create
      • ovr_RecenterTrackingOrigin

        public static int ovr_RecenterTrackingOrigin(long session)
        Re-centers the sensor position and orientation.

        This resets the (x,y,z) positional components and the yaw orientation component. The Roll and pitch orientation components are always determined by gravity and cannot be redefined. All future tracking will report values relative to this new reference position. If you are using OVRTrackerPose then you will need to call GetTrackerPose after this, because the sensor position(s) will change as a result of this.

        The headset cannot be facing vertically upward or downward but rather must be roughly level otherwise this function will fail with Error_InvalidHeadsetOrientation.

        For more info, see the notes on each ovrTrackingOrigin enumeration to understand how recenter will vary slightly in its behavior based on the current ovrTrackingOrigin setting.

        Parameters:
        session - an ovrSession previously returned by Create
      • ovr_ClearShouldRecenterFlag

        public static void ovr_ClearShouldRecenterFlag(long session)
        Clears the ShouldRecenter status bit in ovrSessionStatus.

        Clears the ShouldRecenter status bit in OVRSessionStatus, allowing further recenter requests to be detected. Since this is automatically done by RecenterTrackingOrigin, this is only needs to be called when application is doing its own re-centering.

        Parameters:
        session - an ovrSession previously returned by Create
      • ovr_GetTrackingState

        public static OVRTrackingState ovr_GetTrackingState(long session,
                                                            double absTime,
                                                            boolean latencyMarker,
                                                            OVRTrackingState __result)
        Returns tracking state reading based on the specified absolute system time.

        Pass an absTime value of 0.0 to request the most recent sensor reading. In this case both PredictedPose and SamplePose will have the same value.

        This may also be used for more refined timing of front buffer rendering logic, and so on.

        This may be called by multiple threads.

        Parameters:
        session - an ovrSession previously returned by Create
        absTime - the absolute future time to predict the return OVRTrackingState value. Use 0 to request the most recent tracking state.
        latencyMarker - specifies that this call is the point in time where the "App-to-Mid-Photon" latency timer starts from. If a given ovrLayer provides "SensorSampleTimestamp", that will override the value stored here.
        __result - the OVRTrackingState that is predicted for the given absTime
      • ovr_GetTrackerPose

        public static OVRTrackerPose ovr_GetTrackerPose(long session,
                                                        int trackerPoseIndex,
                                                        OVRTrackerPose __result)
        Returns the OVRTrackerPose for the given sensor.
        Parameters:
        session - an ovrSession previously returned by Create
        trackerPoseIndex - index of the sensor being requested.
      • ovr_GetInputState

        public static int ovr_GetInputState(long session,
                                            int controllerType,
                                            OVRInputState inputState)
        Returns the most recent input state for controllers, without positional tracking info. Developers can tell whether the same state was returned by checking the PacketNumber.
        Parameters:
        session - an ovrSession previously returned by Create
        controllerType - which controllers the input will be returned for
        inputState - the input state that will be filled in
        Returns:
        Success if the new state was successfully obtained
      • ovr_GetConnectedControllerTypes

        public static int ovr_GetConnectedControllerTypes(long session)
        Returns controller types connected to the system OR'ed together.
        Parameters:
        session - an ovrSession previously returned by Create
      • ovr_SetControllerVibration

        public static int ovr_SetControllerVibration(long session,
                                                     int controllerType,
                                                     float frequency,
                                                     float amplitude)
        Turns on vibration of the given controller.

        To disable vibration, call SetControllerVibration with an amplitude of 0. Vibration automatically stops after a nominal amount of time, so if you want vibration to be continuous over multiple seconds then you need to call this function periodically.

        Parameters:
        session - an ovrSession previously returned by Create
        controllerType - the controller to apply the vibration to
        frequency - a vibration frequency in the range of 0.0 to 1.0. Currently the only valid values are 0.0, 0.5, and 1.0 and other values will be clamped to one of these.
        amplitude - a vibration amplitude in the range of 0.0 to 1.0.
        Returns:
        Success upon success
      • ovr_GetTextureSwapChainLength

        public static int ovr_GetTextureSwapChainLength(long session,
                                                        long chain,
                                                        java.nio.IntBuffer out_Length)
        Gets the number of buffers in an ovrTextureSwapChain.
        Parameters:
        session - an ovrSession previously returned by Create
        chain - the ovrTextureSwapChain for which the length should be retrieved
        out_Length - returns the number of buffers in the specified chain
      • ovr_GetTextureSwapChainCurrentIndex

        public static int ovr_GetTextureSwapChainCurrentIndex(long session,
                                                              long chain,
                                                              java.nio.IntBuffer out_Index)
        Gets the current index in an ovrTextureSwapChain.
        Parameters:
        session - an ovrSession previously returned by Create
        chain - the ovrTextureSwapChain for which the index should be retrieved
        out_Index - returns the current (free) index in specified chain
      • ovr_GetTextureSwapChainDesc

        public static int ovr_GetTextureSwapChainDesc(long session,
                                                      long chain,
                                                      OVRTextureSwapChainDesc out_Desc)
        Gets the description of the buffers in an ovrTextureSwapChain.
        Parameters:
        session - an ovrSession previously returned by Create
        chain - the ovrTextureSwapChain for which the description should be retrieved
        out_Desc - returns the description of the specified chain
      • ovr_CommitTextureSwapChain

        public static int ovr_CommitTextureSwapChain(long session,
                                                     long chain)
        Commits any pending changes to an ovrTextureSwapChain, and advances its current index.

        When Commit is called, the texture at the current index is considered ready for use by the runtime, and further writes to it should be avoided. The swap chain's current index is advanced, providing there's room in the chain. The next time the SDK dereferences this texture swap chain, it will synchronize with the app's graphics context and pick up the submitted index, opening up room in the swap chain for further commits.

        Parameters:
        session - an ovrSession previously returned by Create
        chain - the ovrTextureSwapChain to commit
      • ovr_DestroyTextureSwapChain

        public static void ovr_DestroyTextureSwapChain(long session,
                                                       long chain)
        Destroys an ovrTextureSwapChain and frees all the resources associated with it.
        Parameters:
        session - an ovrSession previously returned by Create
        chain - the ovrTextureSwapChain to destroy. If it is NULL then this function has no effect.
      • ovr_DestroyMirrorTexture

        public static void ovr_DestroyMirrorTexture(long session,
                                                    long mirrorTexture)
        Destroys a mirror texture previously created by one of the mirror texture creation functions.
        Parameters:
        session - an ovrSession previously returned by Create
        mirrorTexture - the ovrTexture to destroy. If it is NULL then this function has no effect.
      • ovr_GetFovTextureSize

        public static OVRSizei ovr_GetFovTextureSize(long session,
                                                     int eye,
                                                     OVRFovPort fov,
                                                     float pixelsPerDisplayPixel,
                                                     OVRSizei __result)
        Calculates the recommended viewport size for rendering a given eye within the HMD with a given FOV cone.

        Higher FOV will generally require larger textures to maintain quality. Apps packing multiple eye views together on the same texture should ensure there are at least 8 pixels of padding between them to prevent texture filtering and chromatic aberration causing images to leak between the two eye views.

        Example code:

        ovrHmdDesc hmdDesc = ovr_GetHmdDesc(session);
        ovrSizei eyeSizeLeft  = ovr_GetFovTextureSize(session, ovrEye_Left,  hmdDesc.DefaultEyeFov[ovrEye_Left],  1.0f);
        ovrSizei eyeSizeRight = ovr_GetFovTextureSize(session, ovrEye_Right, hmdDesc.DefaultEyeFov[ovrEye_Right], 1.0f);
        Parameters:
        session - an ovrSession previously returned by Create
        eye - which eye (left or right) to calculate for. One of:
        Eye_LeftEye_Right
        fov - the OVRFovPort to use
        pixelsPerDisplayPixel - the ratio of the number of render target pixels to display pixels at the center of distortion. 1.0 is the default value. Lower values can improve performance, higher values give improved quality.
        __result - the texture width and height size
      • ovr_GetRenderDesc

        public static OVREyeRenderDesc ovr_GetRenderDesc(long session,
                                                         int eyeType,
                                                         OVRFovPort fov,
                                                         OVREyeRenderDesc __result)
        Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye.
        Parameters:
        session - an ovrSession previously returned by Create
        eyeType - which eye (left or right) for which to perform calculations. One of:
        Eye_LeftEye_Right
        fov - the OVRFovPort to use.
        __result - the computed OVREyeRenderDesc for the given eyeType and field of view
      • ovr_SubmitFrame

        public static int ovr_SubmitFrame(long session,
                                          long frameIndex,
                                          OVRViewScaleDesc viewScaleDesc,
                                          PointerBuffer layerPtrList)
        Submits layers for distortion and display.

        ovr_SubmitFrame triggers distortion and processing which might happen asynchronously. The function will return when there is room in the submission queue and surfaces are available. Distortion might or might not have completed.

        • Layers are drawn in the order they are specified in the array, regardless of the layer type.
        • Layers are not remembered between successive calls to ovr_SubmitFrame. A layer must be specified in every call to ovr_SubmitFrame or it won't be displayed.
        • If a layerPtrList entry that was specified in a previous call to ovr_SubmitFrame is passed as NULL or is of type LayerType_Disabled, that layer is no longer displayed.
        • A layerPtrList entry can be of any layer type and multiple entries of the same layer type are allowed. No layerPtrList entry may be duplicated (i.e. the same pointer as an earlier entry).

        Example code

        ovrLayerEyeFov  layer0;
        ovrLayerQuad    layer1;
        ...
        ovrLayerHeader* layers[2] = { &layer0.Header, &layer1.Header };
        ovrResult result = ovr_SubmitFrame(hmd, frameIndex, nullptr, layers, 2);
        Parameters:
        session - an ovrSession previously returned by Create
        frameIndex - the targeted application frame index, or 0 to refer to one frame after the last time SubmitFrame was called
        viewScaleDesc - provides additional information needed only if layerPtrList contains an LayerType_Quad. If NULL, a default version is used based on the current configuration and a 1.0 world scale.
        layerPtrList - a list of ovrLayer pointers, which can include NULL entries to indicate that any previously shown layer at that index is to not be displayed. Each layer header must be a part of a layer structure such as OVRLayerEyeFov or OVRLayerQuad, with Header.Type identifying its type. A NULL layerPtrList entry in the array indicates the absence of the given layer.
        Returns:
        an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon one of the possible success values:
        • Success: rendering completed successfully.
        • Success_NotVisible: rendering completed successfully but was not displayed on the HMD, usually because another application currently has ownership of the HMD. Applications receiving this result should stop rendering new content, but continue to call ovr_SubmitFrame periodically until it returns a value other than Success_NotVisible.
        • Error_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (DestroyTextureSwapChain), the session needs to destroyed (Destroy) and recreated (Create), and new resources need to be created (ovr_CreateTextureSwapChainXXX). The application's existing private graphics resources do not need to be recreated unless the new ovr_Create call returns a different GraphicsLuid.
        • Error_TextureSwapChainInvalid: The ovrTextureSwapChain is in an incomplete or inconsistent state. Ensure CommitTextureSwapChain was called at least once first.
      • ovr_GetPredictedDisplayTime

        public static double ovr_GetPredictedDisplayTime(long session,
                                                         long frameIndex)
        Gets the time of the specified frame midpoint.

        Predicts the time at which the given frame will be displayed. The predicted time is the middle of the time period during which the corresponding eye images will be displayed.

        The application should increment frameIndex for each successively targeted frame, and pass that index to any relevent OVR functions that need to apply to the frame identified by that index.

        This function is thread-safe and allows for multiple application threads to target their processing to the same displayed frame.

        In the event that prediction fails due to various reasons (e.g. the display being off or app has yet to present any frames), the return value will be current CPU time.

        Parameters:
        session - an ovrSession previously returned by Create
        frameIndex - the frame the caller wishes to target. A value of zero returns the next frame index.
        Returns:
        the absolute frame midpoint time for the given frameIndex
      • ovr_GetTimeInSeconds

        public static double ovr_GetTimeInSeconds()
        Returns global, absolute high-resolution time in seconds.

        The time frame of reference for this function is not specified and should not be depended upon.

        Returns:
        seconds as a floating point value
      • ovr_GetBool

        public static boolean ovr_GetBool(long session,
                                          java.nio.ByteBuffer propertyName,
                                          boolean defaultVal)
        Reads a boolean property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid for only the call
        defaultVal - specifes the value to return if the property couldn't be read
        Returns:
        the property interpreted as a boolean value. Returns defaultVal if the property doesn't exist.
      • ovr_GetBool

        public static boolean ovr_GetBool(long session,
                                          java.lang.CharSequence propertyName,
                                          boolean defaultVal)
        Reads a boolean property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid for only the call
        defaultVal - specifes the value to return if the property couldn't be read
        Returns:
        the property interpreted as a boolean value. Returns defaultVal if the property doesn't exist.
      • ovr_SetBool

        public static boolean ovr_SetBool(long session,
                                          java.nio.ByteBuffer propertyName,
                                          boolean value)
        Writes or creates a boolean property.

        If the property wasn't previously a boolean property, it is changed to a boolean property.

        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        value - the value to write
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_SetBool

        public static boolean ovr_SetBool(long session,
                                          java.lang.CharSequence propertyName,
                                          boolean value)
        Writes or creates a boolean property.

        If the property wasn't previously a boolean property, it is changed to a boolean property.

        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        value - the value to write
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_GetInt

        public static int ovr_GetInt(long session,
                                     java.nio.ByteBuffer propertyName,
                                     int defaultVal)
        Reads an integer property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        defaultVal - specifes the value to return if the property couldn't be read
        Returns:
        the property interpreted as an integer value. Returns defaultVal if the property doesn't exist.
      • ovr_GetInt

        public static int ovr_GetInt(long session,
                                     java.lang.CharSequence propertyName,
                                     int defaultVal)
        Reads an integer property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        defaultVal - specifes the value to return if the property couldn't be read
        Returns:
        the property interpreted as an integer value. Returns defaultVal if the property doesn't exist.
      • ovr_SetInt

        public static boolean ovr_SetInt(long session,
                                         java.nio.ByteBuffer propertyName,
                                         int value)
        Writes or creates an integer property.

        If the property wasn't previously an integer property, it is changed to an integer property.

        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        value - the value to write
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_SetInt

        public static boolean ovr_SetInt(long session,
                                         java.lang.CharSequence propertyName,
                                         int value)
        Writes or creates an integer property.

        If the property wasn't previously an integer property, it is changed to an integer property.

        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        value - the value to write
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_GetFloat

        public static float ovr_GetFloat(long session,
                                         java.nio.ByteBuffer propertyName,
                                         float defaultVal)
        Reads a float property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        defaultVal - specifes the value to return if the property couldn't be read
        Returns:
        the property interpreted as a float value. Returns defaultVal if the property doesn't exist.
      • ovr_GetFloat

        public static float ovr_GetFloat(long session,
                                         java.lang.CharSequence propertyName,
                                         float defaultVal)
        Reads a float property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        defaultVal - specifes the value to return if the property couldn't be read
        Returns:
        the property interpreted as a float value. Returns defaultVal if the property doesn't exist.
      • ovr_SetFloat

        public static boolean ovr_SetFloat(long session,
                                           java.nio.ByteBuffer propertyName,
                                           float value)
        Writes or creates a float property.

        If the property wasn't previously a float property, it's changed to a float property.

        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        value - the value to write
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_SetFloat

        public static boolean ovr_SetFloat(long session,
                                           java.lang.CharSequence propertyName,
                                           float value)
        Writes or creates a float property.

        If the property wasn't previously a float property, it's changed to a float property.

        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        value - the value to write
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_GetFloatArray

        public static int ovr_GetFloatArray(long session,
                                            java.nio.ByteBuffer propertyName,
                                            java.nio.FloatBuffer values)
        Reads a float array property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        values - an array of float to write to
        Returns:
        the number of elements read, or 0 if property doesn't exist or is empty
      • ovr_GetFloatArray

        public static int ovr_GetFloatArray(long session,
                                            java.lang.CharSequence propertyName,
                                            java.nio.FloatBuffer values)
        Reads a float array property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        values - an array of float to write to
        Returns:
        the number of elements read, or 0 if property doesn't exist or is empty
      • ovr_SetFloatArray

        public static boolean ovr_SetFloatArray(long session,
                                                java.nio.ByteBuffer propertyName,
                                                java.nio.FloatBuffer values)
        Writes or creates a float array property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        values - an array of float to write from
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_SetFloatArray

        public static boolean ovr_SetFloatArray(long session,
                                                java.lang.CharSequence propertyName,
                                                java.nio.FloatBuffer values)
        Writes or creates a float array property.
        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        values - an array of float to write from
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_GetString

        public static java.lang.String ovr_GetString(long session,
                                                     java.nio.ByteBuffer propertyName,
                                                     java.nio.ByteBuffer defaultVal)
        Reads a string property.

        Strings are UTF8-encoded and null-terminated.

        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        defaultVal - specifes the value to return if the property couldn't be read
        Returns:
        the string property if it exists. Otherwise returns defaultVal, which can be specified as NULL. The return memory is guaranteed to be valid until next call to ovr_GetString or until the HMD is destroyed, whichever occurs first.
      • ovr_GetString

        public static java.lang.String ovr_GetString(long session,
                                                     java.lang.CharSequence propertyName,
                                                     java.lang.CharSequence defaultVal)
        Reads a string property.

        Strings are UTF8-encoded and null-terminated.

        Parameters:
        session - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        defaultVal - specifes the value to return if the property couldn't be read
        Returns:
        the string property if it exists. Otherwise returns defaultVal, which can be specified as NULL. The return memory is guaranteed to be valid until next call to ovr_GetString or until the HMD is destroyed, whichever occurs first.
      • ovr_SetString

        public static boolean ovr_SetString(long hmddesc,
                                            java.nio.ByteBuffer propertyName,
                                            java.nio.ByteBuffer value)
        Writes or creates a string property.

        Strings are UTF8-encoded and null-terminated.

        Parameters:
        hmddesc - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        value - the string property, which only needs to be valid for the duration of the call
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_SetString

        public static boolean ovr_SetString(long hmddesc,
                                            java.lang.CharSequence propertyName,
                                            java.lang.CharSequence value)
        Writes or creates a string property.

        Strings are UTF8-encoded and null-terminated.

        Parameters:
        hmddesc - an ovrSession previously returned by Create
        propertyName - the name of the property, which needs to be valid only for the call
        value - the string property, which only needs to be valid for the duration of the call
        Returns:
        true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
      • ovr_GetTextureSwapChainLength

        public static int ovr_GetTextureSwapChainLength(long session,
                                                        long chain,
                                                        int[] out_Length)
        Array version of: GetTextureSwapChainLength
      • ovr_GetTextureSwapChainCurrentIndex

        public static int ovr_GetTextureSwapChainCurrentIndex(long session,
                                                              long chain,
                                                              int[] out_Index)
      • ovr_GetFloatArray

        public static int ovr_GetFloatArray(long session,
                                            java.nio.ByteBuffer propertyName,
                                            float[] values)
        Array version of: GetFloatArray
      • ovr_GetFloatArray

        public static int ovr_GetFloatArray(long session,
                                            java.lang.CharSequence propertyName,
                                            float[] values)
        Array version of: GetFloatArray
      • ovr_SetFloatArray

        public static boolean ovr_SetFloatArray(long session,
                                                java.nio.ByteBuffer propertyName,
                                                float[] values)
        Array version of: SetFloatArray
      • ovr_SetFloatArray

        public static boolean ovr_SetFloatArray(long session,
                                                java.lang.CharSequence propertyName,
                                                float[] values)
        Array version of: SetFloatArray