HMD Management

ovrHmdDesc
Returns information about the current HMD.
unsigned int
Returns the number of attached trackers.
ovrTrackerDesc
ovr_GetTrackerDesc ( ovrSession session, unsigned int trackerDescIndex )
Returns a given attached tracker description.
ovrResult
ovr_Create ( ovrSession * pSession, ovrGraphicsLuid * pLuid )
Creates a handle to a VR session.
void
ovr_Destroy ( ovrSession session )
Destroys the session.
ovrResult
ovr_GetSessionStatus ( ovrSession session, ovrSessionStatus * sessionStatus )
Returns status information for the application.
ovrResult
ovr_IsExtensionSupported ( ovrSession session, ovrExtensions extension, ovrBool * outExtensionSupported )
Query extension support status.
ovrResult
Enable extension.

Tracking

ovrResult
Sets the tracking origin type.
ovrTrackingOrigin
Gets the tracking origin state.
ovrResult
Re-centers the sensor position and orientation.
ovrResult
Allows manually tweaking the sensor position and orientation.
void
Clears the ShouldRecenter status bit in ovrSessionStatus.
ovrTrackingState
ovr_GetTrackingState ( ovrSession session, double absTime, ovrBool latencyMarker )
Returns tracking state reading based on the specified absolute system time.
ovrResult
ovr_GetDevicePoses ( ovrSession session, ovrTrackedDeviceType * deviceTypes, int deviceCount, double absTime, ovrPoseStatef * outDevicePoses )
Returns an array of poses, where each pose matches a device type provided by the deviceTypes array parameter.
ovrTrackerPose
ovr_GetTrackerPose ( ovrSession session, unsigned int trackerPoseIndex )
Returns the ovrTrackerPose for the given attached tracker.
ovrResult
ovr_GetInputState ( ovrSession session, ovrControllerType controllerType, ovrInputState * inputState )
Returns the most recent input state for controllers, without positional tracking info.
unsigned int
Returns controller types connected to the system OR'ed together.
ovrTouchHapticsDesc
Gets information about Haptics engine for the specified Touch controller.
ovrResult
ovr_SetControllerVibration ( ovrSession session, ovrControllerType controllerType, float frequency, float amplitude )
Sets constant vibration (with specified frequency and amplitude) to a controller.
ovrResult
ovr_SubmitControllerVibration ( ovrSession session, ovrControllerType controllerType, const ovrHapticsBuffer * buffer )
Submits a Haptics buffer (used for vibration) to Touch (only) controllers.
ovrResult
Gets the Haptics engine playback state of a specific Touch controller.
ovrResult
ovr_TestBoundary ( ovrSession session, ovrTrackedDeviceType deviceBitmask, ovrBoundaryType boundaryType, ovrBoundaryTestResult * outTestResult )
Tests collision/proximity of position tracked devices (e.g.
ovrResult
ovr_TestBoundaryPoint ( ovrSession session, const ovrVector3f * point, ovrBoundaryType singleBoundaryType, ovrBoundaryTestResult * outTestResult )
Tests collision/proximity of a 3D point against the Boundary System.
ovrResult
Sets the look and feel of the Boundary System.
ovrResult
Resets the look and feel of the Boundary System to its default state.
ovrResult
ovr_GetBoundaryGeometry ( ovrSession session, ovrBoundaryType boundaryType, ovrVector3f * outFloorPoints, int * outFloorPointsCount )
Gets the geometry of the Boundary System's "play area" or "outer boundary" as 3D floor points.
ovrResult
ovr_GetBoundaryDimensions ( ovrSession session, ovrBoundaryType boundaryType, ovrVector3f * outDimensions )
Gets the dimension of the Boundary System's "play area" or "outer boundary".
ovrResult
ovr_GetBoundaryVisible ( ovrSession session, ovrBool * outIsVisible )
Returns if the boundary is currently visible.
ovrResult
Requests boundary to be visible.

Mixed reality capture support

ovrResult
ovr_GetExternalCameras ( ovrSession session, ovrExternalCamera * cameras, unsigned int * inoutCameraCount )
Returns the number of camera properties of all cameras.
ovrResult
ovr_SetExternalCameraProperties ( ovrSession session, const char * name, const ovrCameraIntrinsics *const intrinsics, const ovrCameraExtrinsics *const extrinsics )
Sets the camera intrinsics and/or extrinsics stored for the cameraName camera Names must be < 32 characters and null-terminated.

User Defined

enum
@0 {
}
Specifies the maximum number of layers supported by ovr_SubmitFrame.
enum
ovrLayerType {
}
Describes layer types that can be passed to ovr_SubmitFrame.
enum
ovrLayerFlags {
}
Identifies flags used by ovrLayerHeader and which are passed to ovr_SubmitFrame.
enum
ovrTextureLayout {
}
Describes eye texture layouts.

SDK Distortion Rendering

ovrResult
ovr_GetTextureSwapChainLength ( ovrSession session, ovrTextureSwapChain chain, int * out_Length )
TextureSwapChain creation is rendering API-specific.
ovrResult
ovr_GetTextureSwapChainCurrentIndex ( ovrSession session, ovrTextureSwapChain chain, int * out_Index )
Gets the current index in an ovrTextureSwapChain.
ovrResult
ovr_GetTextureSwapChainDesc ( ovrSession session, ovrTextureSwapChain chain, ovrTextureSwapChainDesc * out_Desc )
Gets the description of the buffers in an ovrTextureSwapChain.
ovrResult
ovr_CommitTextureSwapChain ( ovrSession session, ovrTextureSwapChain chain )
Commits any pending changes to an ovrTextureSwapChain, and advances its current index.
void
ovr_DestroyTextureSwapChain ( ovrSession session, ovrTextureSwapChain chain )
Destroys an ovrTextureSwapChain and frees all the resources associated with it.
void
ovr_DestroyMirrorTexture ( ovrSession session, ovrMirrorTexture mirrorTexture )
MirrorTexture creation is rendering API-specific.
ovrSizei
ovr_GetFovTextureSize ( ovrSession session, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel )
Calculates the recommended viewport size for rendering a given eye within the HMD with a given FOV cone.
ovrEyeRenderDesc
Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye.
ovrResult
ovr_WaitToBeginFrame ( ovrSession session, long long frameIndex )
Waits until surfaces are available and it is time to begin rendering the frame.
ovrResult
ovr_BeginFrame ( ovrSession session, long long frameIndex )
Called from render thread before application begins rendering.
ovrResult
ovr_EndFrame ( ovrSession session, long long frameIndex, const ovrViewScaleDesc * viewScaleDesc, ovrLayerHeader const *const * layerPtrList, unsigned int layerCount )
Called from render thread after application has finished rendering.
ovrResult
ovr_SubmitFrame ( ovrSession session, long long frameIndex, const ovrViewScaleDesc * viewScaleDesc, ovrLayerHeader const *const * layerPtrList, unsigned int layerCount )
Submits layers for distortion and display.

Frame Timing

enum
@1 {
}
Maximum number of frames of performance stats provided back to the caller of ovr_GetPerfStats.
enum
ovrPerfHudMode {
}
Performance HUD enables the HMD user to see information critical to the real-time operation of the VR application such as latency timing, and CPU & GPU performance metrics.
enum
ovrLayerHudMode {
}
Layer HUD enables the HMD user to see information about a layer.
ovrResult
ovr_GetPerfStats ( ovrSession session, ovrPerfStats * outStats )
Retrieves performance stats for the VR app as well as the SDK compositor.
ovrResult
Resets the accumulated stats reported in each ovrPerfStatsPerCompositorFrame back to zero.
double
ovr_GetPredictedDisplayTime ( ovrSession session, long long frameIndex )
Gets the time of the specified frame midpoint.
double
Returns global, absolute high-resolution time in seconds.

Property Access

ovrBool
ovr_GetBool ( ovrSession session, const char * propertyName, ovrBool defaultVal )
Reads a boolean property.
ovrBool
ovr_SetBool ( ovrSession session, const char * propertyName, ovrBool value )
Writes or creates a boolean property.
int
ovr_GetInt ( ovrSession session, const char * propertyName, int defaultVal )
Reads an integer property.
ovrBool
ovr_SetInt ( ovrSession session, const char * propertyName, int value )
Writes or creates an integer property.
float
ovr_GetFloat ( ovrSession session, const char * propertyName, float defaultVal )
Reads a float property.
ovrBool
ovr_SetFloat ( ovrSession session, const char * propertyName, float value )
Writes or creates a float property.
unsigned int
ovr_GetFloatArray ( ovrSession session, const char * propertyName, float values, unsigned int valuesCapacity )
Reads a float array property.
ovrBool
ovr_SetFloatArray ( ovrSession session, const char * propertyName, const float values, unsigned int valuesSize )
Writes or creates a float array property.
const char *
ovr_GetString ( ovrSession session, const char * propertyName, const char * defaultVal )
Reads a string property.
ovrBool
ovr_SetString ( ovrSession session, const char * propertyName, const char * value )
Writes or creates a string property.

Macros

#define
OVR_OS_WIN32
#define
OVR_CDECL
LibOVR calling convention for 32-bit Windows builds.
#define
OVR_EXTERN_C
Defined as extern "C" when built from C++ code.
#define
OVR_CC_HAS_FEATURE
Provided for backward compatibility with older versions of this library.
#define
OVR_SA_UNUSED
#define
OVR_SA_PASTE
#define
OVR_SA_HELP
#define
OVR_STATIC_ASSERT
#define
OVR_UNUSED_STRUCT_PAD
Defines explicitly unused space for a struct.
#define
OVR_PTR_SIZE
Specifies the size of a pointer on the given platform.
#define
OVR_ON32
#define
OVR_ON64
#define
ovrFalse
ovrBool value of false.
#define
ovrTrue
ovrBool value of true.
#define
VK_DEFINE_HANDLE
Fallback definitions for when the vulkan header isn't being included.
#define
VK_DEFINE_NON_DISPATCHABLE_HANDLE
#define
OVR_HAPTICS_BUFFER_SAMPLES_MAX
Maximum number of samples in ovrHapticsBuffer.
#define
OVR_MAX_EXTERNAL_CAMERA_COUNT
#define
OVR_EXTERNAL_CAMERA_NAME_SIZE

Enumerations

enum
ovrHmdType {
}
Enumerates all HMD types that we support.
enum
ovrHmdCaps {
}
HMD capability bits reported by device.
enum
ovrTrackingCaps {
}
Tracking capability bits reported by the device.
enum
ovrExtensions {
}
Optional extensions.
enum
ovrEyeType {
}
Specifies which eye is being used for rendering.
enum
ovrTrackingOrigin {
}
Specifies the coordinate system ovrTrackingState returns tracking poses in.
enum
ovrStatusBits {
}
Bit flags describing the current status of sensor tracking.
enum
ovrTrackerFlags {
}
Specifies sensor flags.
enum
ovrTextureType {
}
The type of texture resource.
enum
ovrTextureBindFlags {
}
The bindings required for texture swap chain.
enum
ovrTextureFormat {
ovrTextureFormat.OVR_FORMAT_UNKNOWN = 0, ovrTextureFormat.OVR_FORMAT_B5G6R5_UNORM = 1, ovrTextureFormat.OVR_FORMAT_B5G5R5A1_UNORM = 2, ovrTextureFormat.OVR_FORMAT_B4G4R4A4_UNORM = 3, ovrTextureFormat.OVR_FORMAT_R8G8B8A8_UNORM = 4, ovrTextureFormat.OVR_FORMAT_R8G8B8A8_UNORM_SRGB = 5, ovrTextureFormat.OVR_FORMAT_B8G8R8A8_UNORM = 6, ovrTextureFormat.OVR_FORMAT_B8G8R8_UNORM = 27, ovrTextureFormat.OVR_FORMAT_B8G8R8A8_UNORM_SRGB = 7, ovrTextureFormat.OVR_FORMAT_B8G8R8X8_UNORM = 8, ovrTextureFormat.OVR_FORMAT_B8G8R8X8_UNORM_SRGB = 9, ovrTextureFormat.OVR_FORMAT_R16G16B16A16_FLOAT = 10, ovrTextureFormat.OVR_FORMAT_R11G11B10_FLOAT = 25, ovrTextureFormat.OVR_FORMAT_D16_UNORM = 11, ovrTextureFormat.OVR_FORMAT_D24_UNORM_S8_UINT = 12, ovrTextureFormat.OVR_FORMAT_D32_FLOAT = 13, ovrTextureFormat.OVR_FORMAT_D32_FLOAT_S8X24_UINT = 14, ovrTextureFormat.OVR_FORMAT_BC1_UNORM = 15, ovrTextureFormat.OVR_FORMAT_BC1_UNORM_SRGB = 16, ovrTextureFormat.OVR_FORMAT_BC2_UNORM = 17, ovrTextureFormat.OVR_FORMAT_BC2_UNORM_SRGB = 18, ovrTextureFormat.OVR_FORMAT_BC3_UNORM = 19, ovrTextureFormat.OVR_FORMAT_BC3_UNORM_SRGB = 20, ovrTextureFormat.OVR_FORMAT_BC6H_UF16 = 21, ovrTextureFormat.OVR_FORMAT_BC6H_SF16 = 22, ovrTextureFormat.OVR_FORMAT_BC7_UNORM = 23, ovrTextureFormat.OVR_FORMAT_BC7_UNORM_SRGB = 24, ovrTextureFormat.OVR_FORMAT_ENUMSIZE = 0x7fffffff
}
The format of a texture.
enum
ovrTextureFlags {
}
Misc flags overriding particular behaviors of a texture swap chain.
enum
ovrMirrorOptions {
}
Bit flags used as part of ovrMirrorTextureDesc's MirrorOptions field.
enum
ovrButton {
ovrButton.ovrButton_A = 0x00000001, ovrButton.ovrButton_B = 0x00000002, ovrButton.ovrButton_RThumb = 0x00000004, ovrButton.ovrButton_RShoulder = 0x00000008, ovrButton.ovrButton_X = 0x00000100, ovrButton.ovrButton_Y = 0x00000200, ovrButton.ovrButton_LThumb = 0x00000400, ovrButton.ovrButton_LShoulder = 0x00000800, ovrButton.ovrButton_Up = 0x00010000, ovrButton.ovrButton_Down = 0x00020000, ovrButton.ovrButton_Left = 0x00040000, ovrButton.ovrButton_Right = 0x00080000, ovrButton.ovrButton_Enter = 0x00100000, ovrButton.ovrButton_Back = 0x00200000, ovrButton.ovrButton_VolUp = 0x00400000, ovrButton.ovrButton_VolDown = 0x00800000, ovrButton.ovrButton_Home = 0x01000000, ovrButton.ovrButton_Private = ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home, ovrButton.ovrButton_RMask = ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder, ovrButton.ovrButton_LMask = ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder | ovrButton_Enter, ovrButton.ovrButton_EnumSize = 0x7fffffff
}
Describes button input types.
enum
ovrTouch {
ovrTouch.ovrTouch_A = ovrButton_A, ovrTouch.ovrTouch_B = ovrButton_B, ovrTouch.ovrTouch_RThumb = ovrButton_RThumb, ovrTouch.ovrTouch_RThumbRest = 0x00000008, ovrTouch.ovrTouch_RIndexTrigger = 0x00000010, ovrTouch.ovrTouch_RButtonMask = ovrTouch_A | ovrTouch_B | ovrTouch_RThumb | ovrTouch_RThumbRest | ovrTouch_RIndexTrigger, ovrTouch.ovrTouch_X = ovrButton_X, ovrTouch.ovrTouch_Y = ovrButton_Y, ovrTouch.ovrTouch_LThumb = ovrButton_LThumb, ovrTouch.ovrTouch_LThumbRest = 0x00000800, ovrTouch.ovrTouch_LIndexTrigger = 0x00001000, ovrTouch.ovrTouch_LButtonMask = ovrTouch_X | ovrTouch_Y | ovrTouch_LThumb | ovrTouch_LThumbRest | ovrTouch_LIndexTrigger, ovrTouch.ovrTouch_RIndexPointing = 0x00000020, ovrTouch.ovrTouch_RThumbUp = 0x00000040, ovrTouch.ovrTouch_LIndexPointing = 0x00002000, ovrTouch.ovrTouch_LThumbUp = 0x00004000, ovrTouch.ovrTouch_RPoseMask = ovrTouch_RIndexPointing | ovrTouch_RThumbUp, ovrTouch.ovrTouch_LPoseMask = ovrTouch_LIndexPointing | ovrTouch_LThumbUp, ovrTouch.ovrTouch_EnumSize = 0x7fffffff
}
Describes touch input types.
enum
ovrControllerType {
}
Specifies which controller is connected; multiple can be connected at once.
enum
ovrHapticsBufferSubmitMode {
}
Haptics buffer submit mode.
enum
ovrTrackedDeviceType {
}
Position tracked devices.
enum
ovrBoundaryType {
}
Boundary types that specified while using the boundary system.
enum
ovrHandType {
}
Provides names for the left and right hand array indexes.
enum
ovrCameraStatusFlags {
}
enum
ovrInitFlags {
}
Initialization flags.
enum
ovrLogLevel {
}
Logging levels.
enum
ovrDebugHudStereoMode {
}
Debug HUD is provided to help developers gauge and debug the fidelity of their app's stereo rendering characteristics.

Typedefs

char
ovrBool ( )
Boolean type.
struct ovrHmdStruct *
Used as an opaque pointer to an OVR session.
uint32_t
struct ovrTextureSwapChainData *
struct ovrMirrorTextureData *
void(OVR_CDECL *
Signature of the logging callback function pointer type.

Functions

ovrResult
ovr_Initialize ( const ovrInitParams * params )
Initializes LibOVR.
void
Shuts down LibOVR.
void
Returns information about the most recent failed return value by the current thread for this library.
const char *
Returns the version string representing the LibOVRRT version.
int
ovr_TraceMessage ( int level, const char * message )
Writes a message string to the LibOVR tracing mechanism (if enabled).
ovrResult
ovr_IdentifyClient ( const char * identity )
Identify client application info.

Detailed Description

Copyright 2015 Oculus VR, LLC All Rights reserved.

HMD Management Documentation

ovrHmdDesc ovr_GetHmdDesc ( ovrSession session )
Returns information about the current HMD.
ovr_Initialize must be called prior to calling this function, otherwise ovrHmdDesc::Type will be set to ovrHmd_None without checking for the HMD presence. session Specifies an ovrSession previously returned by ovr_Create() or NULL. Returns an ovrHmdDesc. If invoked with NULL session argument, ovrHmdDesc::Type set to ovrHmd_None indicates that the HMD is not connected.
unsigned int ovr_GetTrackerCount ( ovrSession session )
Returns the number of attached trackers.
The number of trackers may change at any time, so this function should be called before use as opposed to once on startup. session Specifies an ovrSession previously returned by ovr_Create. Returns unsigned int count.
ovrTrackerDesc ovr_GetTrackerDesc ( ovrSession session, unsigned int trackerDescIndex )
Returns a given attached tracker description.
ovr_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. session Specifies an ovrSession previously returned by ovr_Create. trackerDescIndex Specifies a tracker index. The valid indexes are in the range of 0 to the tracker count returned by ovr_GetTrackerCount. Returns ovrTrackerDesc. An empty ovrTrackerDesc will be returned if trackerDescIndex is out of range. ovrTrackerDesc, ovr_GetTrackerCount
ovrResult ovr_Create ( ovrSession * pSession, ovrGraphicsLuid * pLuid )
Creates a handle to a VR session.
Upon success the returned ovrSession must be eventually freed with ovr_Destroy when it is no longer needed. A second call to ovr_Create will result in an error return value if the previous session has not been destroyed. pSession Provides a pointer to an ovrSession which will be written to upon success. 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. Returns an ovrResult indicating success or failure. Upon failure the returned ovrSession will be NULL. Example code ovrSessionsession; ovrGraphicsLuidluid; ovrResultresult=ovr_Create(&session,&luid); if(OVR_FAILURE(result)) ... ovr_Destroy
void ovr_Destroy ( ovrSession session )
Destroys the session.
session Specifies an ovrSession previously returned by ovr_Create. ovr_Create
ovrResult ovr_GetSessionStatus ( ovrSession session, ovrSessionStatus * sessionStatus )
Returns status information for the application.
session Specifies an ovrSession previously returned by ovr_Create. sessionStatus Provides an ovrSessionStatus that is filled in. Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Return values include but aren't limited to: ovrSuccess: Completed successfully.ovrError_ServiceConnection: The service connection was lost and the application must destroy the session.
ovrResult ovr_IsExtensionSupported ( ovrSession session, ovrExtensions extension, ovrBool * outExtensionSupported )
Query extension support status.
session Specifies an ovrSession previously returned by ovr_Create. extension Extension to query. outExtensionSupported Set to extension support status. ovrTrue if supported. Returns an ovrResult indicating success or failure. In the case of failure use ovr_GetLastErrorInfo to get more information. ovrExtensions
ovrResult ovr_EnableExtension ( ovrSession session, ovrExtensions extension )
Enable extension.
Extensions must be enabled after ovr_Create is called. session Specifies an ovrSession previously returned by ovr_Create. extension Extension to enable. Returns an ovrResult indicating success or failure. Extension is only enabled if successful. In the case of failure use ovr_GetLastErrorInfo to get more information. ovrExtensions

Tracking Documentation

ovrResult ovr_SetTrackingOriginType ( ovrSession session, ovrTrackingOrigin 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. session Specifies an ovrSession previously returned by ovr_Create. origin Specifies an ovrTrackingOrigin to be used for all ovrPosef Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. ovrTrackingOrigin, ovr_GetTrackingOriginType
ovrTrackingOrigin ovr_GetTrackingOriginType ( ovrSession session )
Gets the tracking origin state.
session Specifies an ovrSession previously returned by ovr_Create. Returns the ovrTrackingOrigin that was either set by default, or previous set by the application. ovrTrackingOrigin, ovr_SetTrackingOriginType
ovrResult ovr_RecenterTrackingOrigin ( ovrSession session )
Re-centers the sensor position and orientation.
This resets the (x,y,z) positional components and the yaw orientation component of the tracking space for the HMD and controllers using the HMD's current tracking pose. If the caller requires some tweaks on top of the HMD's current tracking pose, consider using ovr_SpecifyTrackingOrigin instead.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 ovrTrackerPoses then you will need to call ovr_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 ovrError_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. session Specifies an ovrSession previously returned by ovr_Create. Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Return values include but aren't limited to: ovrSuccess: Completed successfully.ovrError_InvalidHeadsetOrientation: The headset was facing an invalid direction when attempting recentering, such as facing vertically. ovrTrackingOrigin, ovr_GetTrackerPose, ovr_SpecifyTrackingOrigin
ovrResult ovr_SpecifyTrackingOrigin ( ovrSession session, ovrPosef originPose )
Allows manually tweaking the sensor position and orientation.
This function is similar to ovr_RecenterTrackingOrigin in that it modifies the (x,y,z) positional components and the yaw orientation component of the tracking space for the HMD and controllers.While ovr_RecenterTrackingOrigin resets the tracking origin in reference to the HMD's current pose, ovr_SpecifyTrackingOrigin allows the caller to explicitly specify a transform for the tracking origin. This transform is expected to be an offset to the most recent recentered origin, so calling this function repeatedly with the same originPose will keep nudging the recentered origin in that direction.There are several use cases for this function. For example, if the application decides to limit the yaw, or translation of the recentered pose instead of directly using the HMD pose the application can query the current tracking state via ovr_GetTrackingState, and apply some limitations to the HMD pose because feeding this pose back into this function. Similarly, this can be used to "adjust the seating position" incrementally in apps that feature seated experiences such as cockpit-based games.This function can emulate ovr_RecenterTrackingOrigin as such: ovrTrackingState ts = ovr_GetTrackingState(session, 0.0, ovrFalse); ovr_SpecifyTrackingOrigin(session, ts.HeadPose.ThePose);The roll and pitch orientation components are determined by gravity and cannot be redefined. If you are using ovrTrackerPoses then you will need to call ovr_GetTrackerPose after this, because the sensor position(s) will change as a result of this.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. session Specifies an ovrSession previously returned by ovr_Create. originPose Specifies a pose that will be used to transform the current tracking origin. Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Return values include but aren't limited to: ovrSuccess: Completed successfully.ovrError_InvalidParameter: The heading direction in originPose was invalid, such as facing vertically. This can happen if the caller is directly feeding the pose of a position-tracked device such as an HMD or controller into this function. ovrTrackingOrigin, ovr_GetTrackerPose, ovr_RecenterTrackingOrigin
void ovr_ClearShouldRecenterFlag ( ovrSession 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 ovr_RecenterTrackingOrigin and ovr_SpecifyTrackingOrigin, this function only needs to be called when application is doing its own re-centering logic.
ovrTrackingState ovr_GetTrackingState ( ovrSession session, double absTime, ovrBool latencyMarker )
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. session Specifies an ovrSession previously returned by ovr_Create. absTime Specifies 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 "SensorSampleTime", that will override the value stored here. Returns the ovrTrackingState that is predicted for the given absTime. ovrTrackingState, ovr_GetEyePoses, ovr_GetTimeInSeconds
ovrResult ovr_GetDevicePoses ( ovrSession session, ovrTrackedDeviceType * deviceTypes, int deviceCount, double absTime, ovrPoseStatef * outDevicePoses )
Returns an array of poses, where each pose matches a device type provided by the deviceTypes array parameter.
If any pose cannot be retrieved, it will return a reason for the missing pose and the device pose will be zeroed out with a pose quaternion [x=0, y=0, z=0, w=1]. session Specifies an ovrSession previously returned by ovr_Create. deviceTypes Array of device types to query for their poses. deviceCount Number of queried poses. This number must match the length of the outDevicePoses and deviceTypes array. absTime Specifies the absolute future time to predict the return ovrTrackingState value. Use 0 to request the most recent tracking state. outDevicePoses Array of poses, one for each device type in deviceTypes arrays. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success.
ovrTrackerPose ovr_GetTrackerPose ( ovrSession session, unsigned int trackerPoseIndex )
Returns the ovrTrackerPose for the given attached tracker.
session Specifies an ovrSession previously returned by ovr_Create. trackerPoseIndex Index of the tracker being requested. Returns the requested ovrTrackerPose. An empty ovrTrackerPose will be returned if trackerPoseIndex is out of range. ovr_GetTrackerCount
ovrResult ovr_GetInputState ( ovrSession session, ovrControllerType controllerType, ovrInputState * inputState )
Returns the most recent input state for controllers, without positional tracking info.
inputState Input state that will be filled in. ovrControllerType Specifies which controller the input will be returned for. Returns ovrSuccess if the new state was successfully obtained. ovrControllerType
unsigned int ovr_GetConnectedControllerTypes ( ovrSession session )
Returns controller types connected to the system OR'ed together.
A bitmask of ovrControllerTypes connected to the system. ovrControllerType
ovrTouchHapticsDesc ovr_GetTouchHapticsDesc ( ovrSession session, ovrControllerType controllerType )
Gets information about Haptics engine for the specified Touch controller.
session Specifies an ovrSession previously returned by ovr_Create. controllerType The controller to retrieve the information from. Returns an ovrTouchHapticsDesc.
ovrResult ovr_SetControllerVibration ( ovrSession session, ovrControllerType controllerType, float frequency, float amplitude )
Sets constant vibration (with specified frequency and amplitude) to a controller.
Note: ovr_SetControllerVibration cannot be used interchangeably with ovr_SubmitControllerVibration.This method should be called periodically, vibration lasts for a maximum of 2.5 seconds. session Specifies an ovrSession previously returned by ovr_Create. controllerType The controller to set the vibration to. frequency Vibration frequency. Supported values are: 0.0 (disabled), 0.5 and 1.0. Non valid values will be clamped. amplitude Vibration amplitude in the [0.0, 1.0] range. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: The call succeeded and a result was returned.ovrSuccess_DeviceUnavailable: The call succeeded but the device referred to by controllerType is not available.
ovrResult ovr_SubmitControllerVibration ( ovrSession session, ovrControllerType controllerType, const ovrHapticsBuffer * buffer )
Submits a Haptics buffer (used for vibration) to Touch (only) controllers.
Note: ovr_SubmitControllerVibration cannot be used interchangeably with ovr_SetControllerVibration. session Specifies an ovrSession previously returned by ovr_Create. controllerType Controller where the Haptics buffer will be played. buffer Haptics buffer containing amplitude samples to be played. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: The call succeeded and a result was returned.ovrSuccess_DeviceUnavailable: The call succeeded but the device referred to by controllerType is not available. ovrHapticsBuffer
ovrResult ovr_GetControllerVibrationState ( ovrSession session, ovrControllerType controllerType, ovrHapticsPlaybackState * outState )
Gets the Haptics engine playback state of a specific Touch controller.
session Specifies an ovrSession previously returned by ovr_Create. controllerType Controller where the Haptics buffer wil be played. outState State of the haptics engine. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: The call succeeded and a result was returned.ovrSuccess_DeviceUnavailable: The call succeeded but the device referred to by controllerType is not available. ovrHapticsPlaybackState
ovrResult ovr_TestBoundary ( ovrSession session, ovrTrackedDeviceType deviceBitmask, ovrBoundaryType boundaryType, ovrBoundaryTestResult * outTestResult )
Tests collision/proximity of position tracked devices (e.g.
HMD and/or Touch) against the Boundary System. Note: this method is similar to ovr_BoundaryTestPoint but can be more precise as it may take into account device acceleration/momentum. session Specifies an ovrSession previously returned by ovr_Create. deviceBitmask Bitmask of one or more tracked devices to test. boundaryType Must be either ovrBoundary_Outer or ovrBoundary_PlayArea. outTestResult Result of collision/proximity test, contains information such as distance and closest point. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: The call succeeded and a result was returned.ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.ovrSuccess_DeviceUnavailable: The call succeeded but the device referred to by deviceBitmask is not available. ovrBoundaryTestResult
ovrResult ovr_TestBoundaryPoint ( ovrSession session, const ovrVector3f * point, ovrBoundaryType singleBoundaryType, ovrBoundaryTestResult * outTestResult )
Tests collision/proximity of a 3D point against the Boundary System.
session Specifies an ovrSession previously returned by ovr_Create. point 3D point to test. singleBoundaryType Must be either ovrBoundary_Outer or ovrBoundary_PlayArea to test against outTestResult Result of collision/proximity test, contains information such as distance and closest point. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: The call succeeded and a result was returned.ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up. ovrBoundaryTestResult
ovrResult ovr_SetBoundaryLookAndFeel ( ovrSession session, const ovrBoundaryLookAndFeel * lookAndFeel )
Sets the look and feel of the Boundary System.
session Specifies an ovrSession previously returned by ovr_Create. lookAndFeel Look and feel parameters. Returns ovrSuccess upon success. ovrBoundaryLookAndFeel
ovrResult ovr_ResetBoundaryLookAndFeel ( ovrSession session )
Resets the look and feel of the Boundary System to its default state.
session Specifies an ovrSession previously returned by ovr_Create. Returns ovrSuccess upon success. ovrBoundaryLookAndFeel
ovrResult ovr_GetBoundaryGeometry ( ovrSession session, ovrBoundaryType boundaryType, ovrVector3f * outFloorPoints, int * outFloorPointsCount )
Gets the geometry of the Boundary System's "play area" or "outer boundary" as 3D floor points.
session Specifies an ovrSession previously returned by ovr_Create. boundaryType Must be either ovrBoundary_Outer or ovrBoundary_PlayArea. outFloorPoints Array of 3D points (in clockwise order) defining the boundary at floor height (can be NULL to retrieve only the number of points). outFloorPointsCount Number of 3D points returned in the array. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: The call succeeded and a result was returned.ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.
ovrResult ovr_GetBoundaryDimensions ( ovrSession session, ovrBoundaryType boundaryType, ovrVector3f * outDimensions )
Gets the dimension of the Boundary System's "play area" or "outer boundary".
session Specifies an ovrSession previously returned by ovr_Create. boundaryType Must be either ovrBoundary_Outer or ovrBoundary_PlayArea. outDimensions Dimensions of the axis aligned bounding box that encloses the area in meters (width, height and length). Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: The call succeeded and a result was returned.ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.
ovrResult ovr_GetBoundaryVisible ( ovrSession session, ovrBool * outIsVisible )
Returns if the boundary is currently visible.
Note: visibility is false if the user has turned off boundaries, otherwise, it's true if the app has requested boundaries to be visible or if any tracked device is currently triggering it. This may not exactly match rendering due to fade-in and fade-out effects. session Specifies an ovrSession previously returned by ovr_Create. outIsVisible ovrTrue, if the boundary is visible. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: Result was successful and a result was returned.ovrSuccess_BoundaryInvalid: The call succeeded but the result is not a valid boundary due to not being set up.
ovrResult ovr_RequestBoundaryVisible ( ovrSession session, ovrBool visible )
Requests boundary to be visible.
session Specifies an ovrSession previously returned by ovr_Create. visible forces the outer boundary to be visible. An application can't force it to be invisible, but can cancel its request by passing false. Returns ovrSuccess upon success.

Mixed reality capture support Documentation

ovrResult ovr_GetExternalCameras ( ovrSession session, ovrExternalCamera * cameras, unsigned int * inoutCameraCount )
Returns the number of camera properties of all cameras.
session Specifies an ovrSession previously returned by ovr_Create.
ovrResult ovr_SetExternalCameraProperties ( ovrSession session, const char * name, const ovrCameraIntrinsics *const intrinsics, const ovrCameraExtrinsics *const extrinsics )
Sets the camera intrinsics and/or extrinsics stored for the cameraName camera Names must be < 32 characters and null-terminated.
session Specifies an ovrSession previously returned by ovr_Create. name Specifies which camera to set the intrinsics or extrinsics for. The name must be at most OVR_EXTERNAL_CAMERA_NAME_SIZE - 1 characters. Otherwise, ovrError_ExternalCameraNameWrongSize is returned. intrinsics Contains the intrinsic parameters to set, can be null extrinsics Contains the extrinsic parameters to set, can be null Returns ovrSuccess or an ovrError code

User Defined Documentation

enum OVR_CAPI.h.@0
Specifies the maximum number of layers supported by ovr_SubmitFrame.
Enumerator
ovrMaxLayerCount= 16
enum OVR_CAPI.h.ovrLayerType
Describes layer types that can be passed to ovr_SubmitFrame.
Enumerator
ovrLayerType_Disabled
Layer is disabled.
ovrLayerType_EyeFov
Described by ovrLayerEyeFov.
ovrLayerType_EyeFovDepth
Described by ovrLayerEyeFovDepth.
ovrLayerType_Quad
Described by ovrLayerQuad. Previously called ovrLayerType_QuadInWorld.
ovrLayerType_EyeMatrix
Described by ovrLayerEyeMatrix.
ovrLayerType_EyeFovMultires
Described by ovrLayerEyeFovMultires.
ovrLayerType_Cylinder
Described by ovrLayerCylinder.
ovrLayerType_Cube
Described by ovrLayerCube.
ovrLayerType_EnumSize
Force type int32_t.
enum OVR_CAPI.h.ovrLayerFlags
Identifies flags used by ovrLayerHeader and which are passed to ovr_SubmitFrame.
Enumerator
ovrLayerFlag_HighQuality
ovrLayerFlag_HighQuality enables 4x anisotropic sampling during the composition of the layer.
ovrLayerFlag_TextureOriginAtBottomLeft
ovrLayerFlag_TextureOriginAtBottomLeft: the opposite is TopLeft.
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.
enum OVR_CAPI.h.ovrTextureLayout
Describes eye texture layouts.
Enumerator
ovrTextureLayout_Rectilinear
Regular eyeFov layer.
ovrTextureLayout_Octilinear
Octilinear extension must be enabled.
ovrTextureLayout_EnumSize
Force type int32_t.

SDK Distortion Rendering Documentation

ovrResult ovr_GetTextureSwapChainLength ( ovrSession session, ovrTextureSwapChain chain, int * out_Length )
TextureSwapChain creation is rendering API-specific.
ovr_CreateTextureSwapChainDX and ovr_CreateTextureSwapChainGL can be found in the rendering API-specific headers, such as OVR_CAPI_D3D.h and OVR_CAPI_GL.h Gets the number of buffers in an ovrTextureSwapChain. session Specifies an ovrSession previously returned by ovr_Create. chain Specifies the ovrTextureSwapChain for which the length should be retrieved. out_Length Returns the number of buffers in the specified chain. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error. ovr_CreateTextureSwapChainDX, ovr_CreateTextureSwapChainGL
ovrResult ovr_GetTextureSwapChainCurrentIndex ( ovrSession session, ovrTextureSwapChain chain, int * out_Index )
Gets the current index in an ovrTextureSwapChain.
session Specifies an ovrSession previously returned by ovr_Create. chain Specifies the ovrTextureSwapChain for which the index should be retrieved. out_Index Returns the current (free) index in specified chain. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error. ovr_CreateTextureSwapChainDX, ovr_CreateTextureSwapChainGL
ovrResult ovr_GetTextureSwapChainDesc ( ovrSession session, ovrTextureSwapChain chain, ovrTextureSwapChainDesc * out_Desc )
Gets the description of the buffers in an ovrTextureSwapChain.
session Specifies an ovrSession previously returned by ovr_Create. chain Specifies the ovrTextureSwapChain for which the description should be retrieved. out_Desc Returns the description of the specified chain. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error. ovr_CreateTextureSwapChainDX, ovr_CreateTextureSwapChainGL
ovrResult ovr_CommitTextureSwapChain ( ovrSession session, ovrTextureSwapChain chain )
Commits any pending changes to an ovrTextureSwapChain, and advances its current index.
session Specifies an ovrSession previously returned by ovr_Create. chain Specifies the ovrTextureSwapChain to commit. 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. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error. Failures include but aren't limited to: ovrError_TextureSwapChainFull: ovr_CommitTextureSwapChain was called too many times on a texture swapchain without calling submit to use the chain. ovr_CreateTextureSwapChainDX, ovr_CreateTextureSwapChainGL
void ovr_DestroyTextureSwapChain ( ovrSession session, ovrTextureSwapChain chain )
Destroys an ovrTextureSwapChain and frees all the resources associated with it.
session Specifies an ovrSession previously returned by ovr_Create. chain Specifies the ovrTextureSwapChain to destroy. If it is NULL then this function has no effect. ovr_CreateTextureSwapChainDX, ovr_CreateTextureSwapChainGL
void ovr_DestroyMirrorTexture ( ovrSession session, ovrMirrorTexture mirrorTexture )
MirrorTexture creation is rendering API-specific.
ovr_CreateMirrorTextureWithOptionsDX and ovr_CreateMirrorTextureWithOptionsGL can be found in rendering API-specific headers, such as OVR_CAPI_D3D.h and OVR_CAPI_GL.h Destroys a mirror texture previously created by one of the mirror texture creation functions. session Specifies an ovrSession previously returned by ovr_Create. mirrorTexture Specifies the ovrTexture to destroy. If it is NULL then this function has no effect. ovr_CreateMirrorTextureWithOptionsDX, ovr_CreateMirrorTextureWithOptionsGL
ovrSizei ovr_GetFovTextureSize ( ovrSession session, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel )
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. session Specifies an ovrSession previously returned by ovr_Create. eye Specifies which eye (left or right) to calculate for. fov Specifies the ovrFovPort to use. pixelsPerDisplayPixel Specifies 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. Example code ovrHmdDeschmdDesc=ovr_GetHmdDesc(session); ovrSizeieyeSizeLeft=ovr_GetFovTextureSize(session,ovrEye_Left, hmdDesc.DefaultEyeFov[ovrEye_Left],1.0f); ovrSizeieyeSizeRight=ovr_GetFovTextureSize(session,ovrEye_Right, hmdDesc.DefaultEyeFov[ovrEye_Right],1.0f); Returns the texture width and height size.
ovrEyeRenderDesc ovr_GetRenderDesc ( ovrSession session, ovrEyeType eyeType, ovrFovPort fov )
Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye.
session Specifies an ovrSession previously returned by ovr_Create. eyeType Specifies which eye (left or right) for which to perform calculations. fov Specifies the ovrFovPort to use. Returns the computed ovrEyeRenderDesc for the given eyeType and field of view. ovrEyeRenderDesc
ovrResult ovr_WaitToBeginFrame ( ovrSession session, long long frameIndex )
Waits until surfaces are available and it is time to begin rendering the frame.
Must be called before ovr_BeginFrame, but not necessarily from the same thread. session Specifies an ovrSession previously returned by ovr_Create. frameIndex Specifies the targeted application frame index. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: command completed successfully.ovrSuccess_NotVisible: rendering of a previous frame 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 and call ovr_GetSessionStatus to detect visibility.ovrError_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (ovr_DestroyTextureSwapChain), the session needs to destroyed (ovr_Destroy) and recreated (ovr_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. ovr_BeginFrame, ovr_EndFrame, ovr_GetSessionStatus
ovrResult ovr_BeginFrame ( ovrSession session, long long frameIndex )
Called from render thread before application begins rendering.
Must be called after ovr_WaitToBeginFrame and before ovr_EndFrame, but not necessarily from the same threads. session Specifies an ovrSession previously returned by ovr_Create. frameIndex Specifies the targeted application frame index. It must match what was passed to ovr_WaitToBeginFrame. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: command completed successfully.ovrError_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (ovr_DestroyTextureSwapChain), the session needs to destroyed (ovr_Destroy) and recreated (ovr_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. ovr_WaitToBeginFrame, ovr_EndFrame
ovrResult ovr_EndFrame ( ovrSession session, long long frameIndex, const ovrViewScaleDesc * viewScaleDesc, ovrLayerHeader const *const * layerPtrList, unsigned int layerCount )
Called from render thread after application has finished rendering.
Must be called after ovr_BeginFrame, but not necessarily from the same thread. Submits layers for distortion and display, which will happen asynchronously. session Specifies an ovrSession previously returned by ovr_Create. frameIndex Specifies the targeted application frame index. It must match what was passed to ovr_BeginFrame. viewScaleDesc Provides additional information needed only if layerPtrList contains an ovrLayerType_Quad. If NULL, a default version is used based on the current configuration and a 1.0 world scale. layerPtrList Specifies 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. layerCount Indicates the number of valid elements in layerPtrList. The maximum supported layerCount is not currently specified, but may be specified in a future version. 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 ovrLayerType_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 ovrLayerEyeFovlayer0; ovrLayerQuadlayer1; ... ovrLayerHeader*layers[2]={&layer0.Header,&layer1.Header}; ovrResultresult=ovr_EndFrame(session,frameIndex,nullptr,layers,2); Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: rendering completed successfully.ovrError_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (ovr_DestroyTextureSwapChain), the session needs to destroyed (ovr_Destroy) and recreated (ovr_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.ovrError_TextureSwapChainInvalid: The ovrTextureSwapChain is in an incomplete or inconsistent state. Ensure ovr_CommitTextureSwapChain was called at least once first. ovr_WaitToBeginFrame, ovr_BeginFrame, ovrViewScaleDesc, ovrLayerHeader
ovrResult ovr_SubmitFrame ( ovrSession session, long long frameIndex, const ovrViewScaleDesc * viewScaleDesc, ovrLayerHeader const *const * layerPtrList, unsigned int layerCount )
Submits layers for distortion and display.
Deprecated. Use ovr_WaitToBeginFrame, ovr_BeginFrame, and ovr_EndFrame instead.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. session Specifies an ovrSession previously returned by ovr_Create. frameIndex Specifies the targeted application frame index, or 0 to refer to one frame after the last time ovr_SubmitFrame was called. viewScaleDesc Provides additional information needed only if layerPtrList contains an ovrLayerType_Quad. If NULL, a default version is used based on the current configuration and a 1.0 world scale. layerPtrList Specifies 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. layerCount Indicates the number of valid elements in layerPtrList. The maximum supported layerCount is not currently specified, but may be specified in a future version. 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 ovrLayerType_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 ovrLayerEyeFovlayer0; ovrLayerQuadlayer1; ... ovrLayerHeader*layers[2]={&layer0.Header,&layer1.Header}; ovrResultresult=ovr_SubmitFrame(session,frameIndex,nullptr,layers,2); Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. Return values include but aren't limited to: ovrSuccess: rendering completed successfully.ovrSuccess_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, call ovr_GetSessionStatus to detect visibility.ovrError_DisplayLost: The session has become invalid (such as due to a device removal) and the shared resources need to be released (ovr_DestroyTextureSwapChain), the session needs to destroyed (ovr_Destroy) and recreated (ovr_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.ovrError_TextureSwapChainInvalid: The ovrTextureSwapChain is in an incomplete or inconsistent state. Ensure ovr_CommitTextureSwapChain was called at least once first. ovr_GetPredictedDisplayTime, ovrViewScaleDesc, ovrLayerHeader, ovr_GetSessionStatus

Frame Timing Documentation

enum OVR_CAPI.h.@1
Maximum number of frames of performance stats provided back to the caller of ovr_GetPerfStats.
Enumerator
ovrMaxProvidedFrameStats= 5
enum OVR_CAPI.h.ovrPerfHudMode
Performance HUD enables the HMD user to see information critical to the real-time operation of the VR application such as latency timing, and CPU & GPU performance metrics.
Enumerator
ovrPerfHud_Off
Turns off the performance HUD.
ovrPerfHud_PerfSummary
Shows performance summary and headroom.
ovrPerfHud_LatencyTiming
Shows latency related timing info.
ovrPerfHud_AppRenderTiming
Shows render timing info for application.
ovrPerfHud_CompRenderTiming
Shows render timing info for OVR compositor.
ovrPerfHud_AswStats
Shows Async Spacewarp-specific info.
ovrPerfHud_VersionInfo
Shows SDK & HMD version Info.
ovrPerfHud_Count= 7
ovrPerfHud_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrLayerHudMode
Layer HUD enables the HMD user to see information about a layer.
Enumerator
ovrLayerHud_Off
Turns off the layer HUD.
ovrLayerHud_Info
Shows info about a specific layer.
ovrLayerHud_EnumSize= 0x7fffffff
ovrResult ovr_GetPerfStats ( ovrSession session, ovrPerfStats * outStats )
Retrieves performance stats for the VR app as well as the SDK compositor.
This function will return stats for the VR app that is currently visible in the HMD regardless of what VR app is actually calling this function.If the VR app is trying to make sure the stats returned belong to the same application, the caller can compare the VisibleProcessId with their own process ID. Normally this will be the case if the caller is only calling ovr_GetPerfStats when ovr_GetSessionStatus has IsVisible flag set to be true.If the VR app calling ovr_GetPerfStats is actually the one visible in the HMD, then new perf stats will only be populated after a new call to ovr_SubmitFrame. That means subsequent calls to ovr_GetPerfStats after the first one without calling ovr_SubmitFrame will receive a FrameStatsCount of zero.If the VR app is not visible, or was initially marked as ovrInit_Invisible, then each call to ovr_GetPerfStats will immediately fetch new perf stats from the compositor without a need for the ovr_SubmitFrame call.Even though invisible VR apps do not require ovr_SubmitFrame to be called to gather new perf stats, since stats are generated at the native refresh rate of the HMD (i.e. 90 Hz for CV1), calling it at a higher rate than that would be unnecessary. session Specifies an ovrSession previously returned by ovr_Create. outStats Contains the performance stats for the application and SDK compositor Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. ovrPerfStats, ovrPerfStatsPerCompositorFrame, ovr_ResetPerfStats
ovrResult ovr_ResetPerfStats ( ovrSession session )
Resets the accumulated stats reported in each ovrPerfStatsPerCompositorFrame back to zero.
Only the integer values such as HmdVsyncIndex, AppDroppedFrameCount etc. will be reset as the other fields such as AppMotionToPhotonLatency are independent timing values updated per-frame. session Specifies an ovrSession previously returned by ovr_Create. Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true upon success. ovrPerfStats, ovrPerfStatsPerCompositorFrame, ovr_GetPerfStats
double ovr_GetPredictedDisplayTime ( ovrSession session, long 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 relevant 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 even 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. session Specifies an ovrSession previously returned by ovr_Create. frameIndex Identifies 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
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. ovrPoseStatef, ovrFrameTiming

Property Access Documentation

ovrBool ovr_GetBool ( ovrSession session, const char * propertyName, ovrBool defaultVal )
Reads a boolean property.
session Specifies an ovrSession previously returned by ovr_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.
ovrBool ovr_SetBool ( ovrSession session, const char * propertyName, ovrBool value )
Writes or creates a boolean property.
If the property wasn't previously a boolean property, it is changed to a boolean property. session Specifies an ovrSession previously returned by ovr_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.
int ovr_GetInt ( ovrSession session, const char * propertyName, int defaultVal )
Reads an integer property.
session Specifies an ovrSession previously returned by ovr_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.
ovrBool ovr_SetInt ( ovrSession session, const char * propertyName, int value )
Writes or creates an integer property.
If the property wasn't previously a boolean property, it is changed to an integer property. session Specifies an ovrSession previously returned by ovr_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.
float ovr_GetFloat ( ovrSession session, const char * propertyName, float defaultVal )
Reads a float property.
session Specifies an ovrSession previously returned by ovr_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 float value. Returns defaultVal if the property doesn't exist.
ovrBool ovr_SetFloat ( ovrSession session, const char * 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. session Specifies an ovrSession previously returned by ovr_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.
unsigned int ovr_GetFloatArray ( ovrSession session, const char * propertyName, float values, unsigned int valuesCapacity )
Reads a float array property.
session Specifies an ovrSession previously returned by ovr_Create. propertyName The name of the property, which needs to be valid only for the call. values An array of float to write to. valuesCapacity Specifies the maximum number of elements to write to the values array. Returns the number of elements read, or 0 if property doesn't exist or is empty.
ovrBool ovr_SetFloatArray ( ovrSession session, const char * propertyName, const float values, unsigned int valuesSize )
Writes or creates a float array property.
session Specifies an ovrSession previously returned by ovr_Create. propertyName The name of the property, which needs to be valid only for the call. values An array of float to write from. valuesSize Specifies the number of elements 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.
const char* ovr_GetString ( ovrSession session, const char * propertyName, const char * defaultVal )
Reads a string property.
Strings are UTF8-encoded and null-terminated. session Specifies an ovrSession previously returned by ovr_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 session is destroyed, whichever occurs first.
ovrBool ovr_SetString ( ovrSession session, const char * propertyName, const char * value )
Writes or creates a string property.
Strings are UTF8-encoded and null-terminated. session Specifies an ovrSession previously returned by ovr_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.

Macros Documentation

#define OVR_OS_WIN32
#define OVR_CDECL
LibOVR calling convention for 32-bit Windows builds.
#define OVR_EXTERN_C
Defined as extern "C" when built from C++ code.
#define OVR_CC_HAS_FEATURE
Provided for backward compatibility with older versions of this library.
#define OVR_SA_UNUSED
#define OVR_SA_PASTE
#define OVR_SA_HELP
#define OVR_STATIC_ASSERT
#define OVR_UNUSED_STRUCT_PAD
Defines explicitly unused space for a struct.
When used correcly, usage of this macro should not change the size of the struct. Compile-time and runtime behavior with and without this defined should be identical.
#define OVR_PTR_SIZE
Specifies the size of a pointer on the given platform.
#define OVR_ON32
#define OVR_ON64
#define ovrFalse
ovrBool value of false.
#define ovrTrue
ovrBool value of true.
#define VK_DEFINE_HANDLE
Fallback definitions for when the vulkan header isn't being included.
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE
#define OVR_HAPTICS_BUFFER_SAMPLES_MAX
Maximum number of samples in ovrHapticsBuffer.
#define OVR_MAX_EXTERNAL_CAMERA_COUNT
#define OVR_EXTERNAL_CAMERA_NAME_SIZE

Enumeration Type Documentation

enum OVR_CAPI.h.ovrHmdType
Enumerates all HMD types that we support.
Enumerator
ovrHmd_None= 0
ovrHmd_DK1= 3
ovrHmd_DKHD= 4
ovrHmd_DK2= 6
ovrHmd_CB= 8
ovrHmd_Other= 9
ovrHmd_E3_2015= 10
ovrHmd_ES06= 11
ovrHmd_ES09= 12
ovrHmd_ES11= 13
ovrHmd_CV1= 14
ovrHmd_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrHmdCaps
HMD capability bits reported by device.
Enumerator
ovrHmdCap_DebugDevice
(read only) Specifies that the HMD is a virtual debug device.
ovrHmdCap_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTrackingCaps
Tracking capability bits reported by the device.
Enumerator
ovrTrackingCap_Orientation
Supports orientation tracking (IMU).
ovrTrackingCap_MagYawCorrection
Supports yaw drift correction.
ovrTrackingCap_Position
Supports positional tracking.
ovrTrackingCap_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrExtensions
Optional extensions.
Enumerator
ovrExtension_TextureLayout_Octilinear
Enable before first layer submission.
ovrExtension_Count
ovrExtension_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrEyeType
Specifies which eye is being used for rendering.
Enumerator
ovrEye_Left
The left eye, from the viewer's perspective.
ovrEye_Right
The right eye, from the viewer's perspective.
ovrEye_Count= 2
ovrEye_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTrackingOrigin
Specifies the coordinate system ovrTrackingState returns tracking poses in.
Enumerator
ovrTrackingOrigin_EyeLevel
Tracking system origin reported at eye (HMD) height.
ovrTrackingOrigin_FloorLevel
Tracking system origin reported at floor height.
ovrTrackingOrigin_Count= 2
ovrTrackingOrigin_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrStatusBits
Bit flags describing the current status of sensor tracking.
Enumerator
ovrStatus_OrientationTracked
Orientation is currently tracked (connected & in use).
ovrStatus_PositionTracked
Position is currently tracked (false if out of range).
ovrStatus_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTrackerFlags
Specifies sensor flags.
Enumerator
ovrTracker_Connected
The sensor is present, else the sensor is absent or offline.
ovrTracker_PoseTracked
The sensor has a valid pose, else the pose is unavailable.
enum OVR_CAPI.h.ovrTextureType
The type of texture resource.
Enumerator
ovrTexture_2D
2D textures.
ovrTexture_2D_External
Application-provided 2D texture. Not supported on PC.
ovrTexture_Cube
Cube maps. ovrTextureSwapChainDesc::ArraySize must be 6 for this type.
ovrTexture_Count
ovrTexture_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTextureBindFlags
The bindings required for texture swap chain.
Enumerator
ovrTextureBind_None
ovrTextureBind_DX_RenderTarget
The application can write into the chain with pixel shader.
ovrTextureBind_DX_UnorderedAccess
The application can write to the chain with compute shader.
ovrTextureBind_DX_DepthStencil
The chain buffers can be bound as depth and/or stencil buffers.
ovrTextureBind_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTextureFormat
The format of a texture.
Enumerator
OVR_FORMAT_UNKNOWN= 0
OVR_FORMAT_B5G6R5_UNORM
Not currently supported on PC. Requires a DirectX 11.1 device.
OVR_FORMAT_B5G5R5A1_UNORM
Not currently supported on PC. Requires a DirectX 11.1 device.
OVR_FORMAT_B4G4R4A4_UNORM
Not currently supported on PC. Requires a DirectX 11.1 device.
OVR_FORMAT_R8G8B8A8_UNORM= 4
OVR_FORMAT_R8G8B8A8_UNORM_SRGB= 5
OVR_FORMAT_B8G8R8A8_UNORM= 6
OVR_FORMAT_B8G8R8_UNORM= 27
OVR_FORMAT_B8G8R8A8_UNORM_SRGB
Not supported for OpenGL applications.
OVR_FORMAT_B8G8R8X8_UNORM
Not supported for OpenGL applications.
OVR_FORMAT_B8G8R8X8_UNORM_SRGB
Not supported for OpenGL applications.
OVR_FORMAT_R16G16B16A16_FLOAT= 10
OVR_FORMAT_R11G11B10_FLOAT
Introduced in v1.10.
OVR_FORMAT_D16_UNORM= 11
OVR_FORMAT_D24_UNORM_S8_UINT= 12
OVR_FORMAT_D32_FLOAT= 13
OVR_FORMAT_D32_FLOAT_S8X24_UINT= 14
OVR_FORMAT_BC1_UNORM= 15
OVR_FORMAT_BC1_UNORM_SRGB= 16
OVR_FORMAT_BC2_UNORM= 17
OVR_FORMAT_BC2_UNORM_SRGB= 18
OVR_FORMAT_BC3_UNORM= 19
OVR_FORMAT_BC3_UNORM_SRGB= 20
OVR_FORMAT_BC6H_UF16= 21
OVR_FORMAT_BC6H_SF16= 22
OVR_FORMAT_BC7_UNORM= 23
OVR_FORMAT_BC7_UNORM_SRGB= 24
OVR_FORMAT_ENUMSIZE= 0x7fffffff
enum OVR_CAPI.h.ovrTextureFlags
Misc flags overriding particular behaviors of a texture swap chain.
Enumerator
ovrTextureMisc_None
ovrTextureMisc_DX_Typeless
Vulkan and DX only: The underlying texture is created with a TYPELESS equivalent of the format specified in the texture desc.
ovrTextureMisc_AllowGenerateMips
DX only: Allow generation of the mip chain on the GPU via the GenerateMips call.
ovrTextureMisc_ProtectedContent
Texture swap chain contains protected content, and requires HDCP connection in order to display to HMD.
ovrTextureMisc_AutoGenerateMips
Automatically generate and use the mip chain in composition on each submission.
ovrTextureMisc_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrMirrorOptions
Bit flags used as part of ovrMirrorTextureDesc's MirrorOptions field.
Enumerator
ovrMirrorOption_Default
By default the mirror texture will be:
ovrMirrorOption_PostDistortion
Retrieves the barrel distorted texture contents instead of the rectilinear one This is only recommended for debugging purposes, and not for final desktop presentation.
ovrMirrorOption_LeftEyeOnly
Since ovrMirrorOption_Default renders both eyes into the mirror texture, these two flags are exclusive (i.e.
ovrMirrorOption_RightEyeOnly= 0x0004
ovrMirrorOption_IncludeGuardian
Shows the boundary system aka Guardian on the mirror texture.
ovrMirrorOption_IncludeNotifications
Shows system notifications the user receives on the mirror texture.
ovrMirrorOption_IncludeSystemGui
Shows the system menu (triggered by hitting the Home button) on the mirror texture.
ovrMirrorOption_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrButton
Describes button input types.
Enumerator
ovrButton_A
A button on XBox controllers and right Touch controller. Select button on Oculus Remote.
ovrButton_B
B button on XBox controllers and right Touch controller. Back button on Oculus Remote.
ovrButton_RThumb
Right thumbstick on XBox controllers and Touch controllers. Not present on Oculus Remote.
ovrButton_RShoulder
Right shoulder button on XBox controllers. Not present on Touch controllers or Oculus Remote.
ovrButton_X
X button on XBox controllers and left Touch controller. Not present on Oculus Remote.
ovrButton_Y
Y button on XBox controllers and left Touch controller. Not present on Oculus Remote.
ovrButton_LThumb
Left thumbstick on XBox controllers and Touch controllers. Not present on Oculus Remote.
ovrButton_LShoulder
Left shoulder button on XBox controllers. Not present on Touch controllers or Oculus Remote.
ovrButton_Up
Up button on XBox controllers and Oculus Remote. Not present on Touch controllers.
ovrButton_Down
Down button on XBox controllers and Oculus Remote. Not present on Touch controllers.
ovrButton_Left
Left button on XBox controllers and Oculus Remote. Not present on Touch controllers.
ovrButton_Right
Right button on XBox controllers and Oculus Remote. Not present on Touch controllers.
ovrButton_Enter
Start on XBox 360 controller.
ovrButton_Back
Back on Xbox 360 controller.
ovrButton_VolUp
Volume button on Oculus Remote. Not present on XBox or Touch controllers.
ovrButton_VolDown
Volume button on Oculus Remote. Not present on XBox or Touch controllers.
ovrButton_Home
Home button on XBox controllers. Oculus button on Touch controllers and Oculus Remote.
ovrButton_Private= ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home
ovrButton_RMask= ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder
ovrButton_LMask= ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder | ovrButton_Enter
ovrButton_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrTouch
Describes touch input types.
Enumerator
ovrTouch_A= ovrButton_A
ovrTouch_B= ovrButton_B
ovrTouch_RThumb= ovrButton_RThumb
ovrTouch_RThumbRest= 0x00000008
ovrTouch_RIndexTrigger= 0x00000010
ovrTouch_RButtonMask= ovrTouch_A | ovrTouch_B | ovrTouch_RThumb | ovrTouch_RThumbRest | ovrTouch_RIndexTrigger
ovrTouch_X= ovrButton_X
ovrTouch_Y= ovrButton_Y
ovrTouch_LThumb= ovrButton_LThumb
ovrTouch_LThumbRest= 0x00000800
ovrTouch_LIndexTrigger= 0x00001000
ovrTouch_LButtonMask= ovrTouch_X | ovrTouch_Y | ovrTouch_LThumb | ovrTouch_LThumbRest | ovrTouch_LIndexTrigger
ovrTouch_RIndexPointing= 0x00000020
ovrTouch_RThumbUp= 0x00000040
ovrTouch_LIndexPointing= 0x00002000
ovrTouch_LThumbUp= 0x00004000
ovrTouch_RPoseMask= ovrTouch_RIndexPointing | ovrTouch_RThumbUp
ovrTouch_LPoseMask= ovrTouch_LIndexPointing | ovrTouch_LThumbUp
ovrTouch_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrControllerType
Specifies which controller is connected; multiple can be connected at once.
Enumerator
ovrControllerType_None= 0x0000
ovrControllerType_LTouch= 0x0001
ovrControllerType_RTouch= 0x0002
ovrControllerType_Touch= (ovrControllerType_LTouch | ovrControllerType_RTouch)
ovrControllerType_Remote= 0x0004
ovrControllerType_XBox= 0x0010
ovrControllerType_Object0= 0x0100
ovrControllerType_Object1= 0x0200
ovrControllerType_Object2= 0x0400
ovrControllerType_Object3= 0x0800
ovrControllerType_Active
Operate on or query whichever controller is active.
ovrControllerType_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrHapticsBufferSubmitMode
Haptics buffer submit mode.
Enumerator
ovrHapticsBufferSubmit_Enqueue
Enqueue buffer for later playback.
enum OVR_CAPI.h.ovrTrackedDeviceType
Position tracked devices.
Enumerator
ovrTrackedDevice_None= 0x0000
ovrTrackedDevice_HMD= 0x0001
ovrTrackedDevice_LTouch= 0x0002
ovrTrackedDevice_RTouch= 0x0004
ovrTrackedDevice_Touch= (ovrTrackedDevice_LTouch | ovrTrackedDevice_RTouch)
ovrTrackedDevice_Object0= 0x0010
ovrTrackedDevice_Object1= 0x0020
ovrTrackedDevice_Object2= 0x0040
ovrTrackedDevice_Object3= 0x0080
ovrTrackedDevice_All= 0xFFFF
enum OVR_CAPI.h.ovrBoundaryType
Boundary types that specified while using the boundary system.
Enumerator
ovrBoundary_Outer
Outer boundary - closely represents user setup walls.
ovrBoundary_PlayArea
Play area - safe rectangular area inside outer boundary which can optionally be used to restrict user interactions and motion.
enum OVR_CAPI.h.ovrHandType
Provides names for the left and right hand array indexes.
Enumerator
ovrHand_Left= 0
ovrHand_Right= 1
ovrHand_Count= 2
ovrHand_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrCameraStatusFlags
Enumerator
ovrCameraStatus_None
Initial state of camera.
ovrCameraStatus_Connected
Bit set when the camera is connected to the system.
ovrCameraStatus_Calibrating
Bit set when the camera is undergoing calibration.
ovrCameraStatus_CalibrationFailed
Bit set when the camera has tried & failed calibration.
ovrCameraStatus_Calibrated
Bit set when the camera has tried & passed calibration.
ovrCameraStatus_Capturing
Bit set when the camera is capturing.
ovrCameraStatus_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrInitFlags
Initialization flags.
Enumerator
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.
ovrInit_RequestVersion
When a version is requested, the LibOVR runtime respects the RequestedMinorVersion field and verifies that the RequestedMinorVersion is supported.
ovrInit_Invisible
This client will not be visible in the HMD.
ovrInit_MixedRendering
This client will alternate between VR and 2D rendering.
ovrInit_FocusAware
This client is aware of ovrSessionStatus focus states (e.g.
ovrinit_WritableBits
These bits are writable by user code.
ovrInit_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrLogLevel
Logging levels.
Enumerator
ovrLogLevel_Debug
Debug-level log event.
ovrLogLevel_Info
Info-level log event.
ovrLogLevel_Error
Error-level log event.
ovrLogLevel_EnumSize= 0x7fffffff
enum OVR_CAPI.h.ovrDebugHudStereoMode
Debug HUD is provided to help developers gauge and debug the fidelity of their app's stereo rendering characteristics.
Enumerator
ovrDebugHudStereo_Off
Turns off the Stereo Debug HUD.
ovrDebugHudStereo_Quad
Renders Quad in world for Stereo Debugging.
ovrDebugHudStereo_QuadWithCrosshair
Renders Quad+crosshair in world for Stereo Debugging.
ovrDebugHudStereo_CrosshairAtInfinity
Renders screen-space crosshair at infinity for Stereo Debugging.
ovrDebugHudStereo_Count
ovrDebugHudStereo_EnumSize= 0x7fffffff

Typedef Documentation

typedef char ovrBool ( )
Boolean type.
typedef struct ovrHmdStruct* ovrSession ( )
Used as an opaque pointer to an OVR session.
typedef uint32_t ovrProcessId ( )
typedef struct ovrTextureSwapChainData* ovrTextureSwapChain ( )
typedef struct ovrMirrorTextureData* ovrMirrorTexture ( )
typedef void(OVR_CDECL* ovrLogCallback) (uintptr_t userData, int level, const char *message) ( )
Signature of the logging callback function pointer type.
userData is an arbitrary value specified by the user of ovrInitParams. level is one of the ovrLogLevel constants. message is a UTF8-encoded null-terminated string. ovrInitParams, ovrLogLevel, ovr_Initialize

Function Documentation

ovrResult ovr_Initialize ( const ovrInitParams * params )
Initializes LibOVR.
Initialize LibOVR for application usage. This includes finding and loading the LibOVRRT shared library. No LibOVR API functions, other than ovr_GetLastErrorInfo and ovr_Detect, can be called unless ovr_Initialize succeeds. A successful call to ovr_Initialize must be eventually followed by a call to ovr_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 ovr_Success.LibOVRRT shared library search order: Current working directory (often the same as the application directory).Module directory (usually the same as the application directory, but not if the module is a separate shared library).Application directoryDevelopment directory (only if OVR_ENABLE_DEVELOPER_SEARCH is enabled, which is off by default).Standard OS shared library search location(s) (OS-specific). params Specifies custom initialization options. May be NULL to indicate default options when using the CAPI shim. If you are directly calling the LibOVRRT version of ovr_Initialize in the LibOVRRT DLL then this must be valid and include ovrInit_RequestVersion. Returns an ovrResult indicating success or failure. In the case of failure, use ovr_GetLastErrorInfo to get more information. Example failed results include: ovrError_Initialize: Generic initialization error.ovrError_LibLoad: Couldn't load LibOVRRT.ovrError_LibVersion: LibOVRRT version incompatibility.ovrError_ServiceConnection: Couldn't connect to the OVR Service.ovrError_ServiceVersion: OVR Service version incompatibility.ovrError_IncompatibleOS: The operating system version is incompatible.ovrError_DisplayInit: Unable to initialize the HMD display.ovrError_ServerStart: Unable to start the server. Is it already running?ovrError_Reinitialization: Attempted to re-initialize with a different version. Example code ovrInitParamsinitParams={ovrInit_RequestVersion,OVR_MINOR_VERSION,NULL,0,0}; ovrResultresult=ovr_Initialize(&initParams); if(OVR_FAILURE(result)){ ovrErrorInfoerrorInfo; ovr_GetLastErrorInfo(&errorInfo); DebugLog("ovr_Initializefailed:%s",errorInfo.ErrorString); returnfalse; } [...] ovr_Shutdown
void ovr_Shutdown ( )
Shuts down LibOVR.
A successful call to ovr_Initialize must be eventually matched by a call to ovr_Shutdown. After calling ovr_Shutdown, no LibOVR functions can be called except ovr_GetLastErrorInfo or another ovr_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_Initialize
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, ovr_GetLastErrorInfo should be called immediately after an API function that returned a failed ovrResult, with no other API functions called in the interim. errorInfo The last ovrErrorInfo for the current thread. ovrErrorInfo
const char* ovr_GetVersionString ( )
Returns the version string representing the LibOVRRT version.
The returned string pointer is valid until the next call to ovr_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.
int ovr_TraceMessage ( int level, const char * 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. level One of the ovrLogLevel constants. message A UTF8-encoded null-terminated string. returns the strlen of the message or a negative value if the message is too large. ovrLogLevel, ovrLogCallback
ovrResult ovr_IdentifyClient ( const char * identity )
Identify client application info.
The string is one or more newline-delimited lines of optional info indicating engine name, engine version, engine plugin name, engine plugin version, engine editor. The order of the lines is not relevant. Individual lines are optional. A newline is not necessary at the end of the last line. Call after ovr_Initialize and before the first call to ovr_Create. Each value is limited to 20 characters. Key names such as 'EngineName:' 'EngineVersion:' do not count towards this limit. identity Specifies one or more newline-delimited lines of optional info: EngineName: s EngineVersion: s EnginePluginName: s EnginePluginVersion: s EngineEditor: <boolean> ('true' or 'false') Example code ovr_IdentifyClient("EngineName:Unity\n" "EngineVersion:5.3.3\n" "EnginePluginName:OVRPlugin\n" "EnginePluginVersion:1.2.0\n" "EngineEditor:true");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
60
61
62
63
64
65
66
67
68
69
70
71
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
228
229
230
231
232
233
234
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
272
273
274
275
277
278
279
280
282
283
284
285
288
289
290
291
292
294
295
296
297
299
300
301
302
304
305
306
307
309
310
311
312
315
316
317
318
319
325
326
327
328
329
330
331
332
333
334
340
341
342
343
344
345
346
347
348
349
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
372
373
374
376
377
378
379
380
381
384
385
386
387
388
389
390
392
393
394
395
396
397
401
402
403
404
405
406
407
410
422
423
432
433
434
435
436
437
440
441
442
443
444
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
468
469
470
471
472
473
474
475
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
499
500
501
502
503
504
509
510
511
512
513
514
515
520
522
523
526
527
528
531
533
534
537
538
542
543
544
545
546
552
554
555
557
558
562
563
566
567
575
576
577
578
579
580
588
589
590
591
592
593
594
595
603
604
605
606
607
608
609
624
625
626
627
628
629
630
631
636
637
638
639
640
641
642
643
651
652
653
655
656
658
659
662
663
664
665
666
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
713
714
715
720
721
724
725
729
730
734
735
736
737
738
744
745
746
747
748
749
750
751
752
753
754
755
756
763
768
769
772
773
776
777
778
780
781
783
784
786
787
788
789
790
791
798
799
800
801
802
803
804
805
806
807
808
809
810
816
818
819
821
822
824
825
827
828
829
831
832
834
835
837
838
840
841
843
844
846
847
849
850
852
853
856
857
860
861
863
864
866
867
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
964
966
967
968
970
971
973
975
977
979
980
981
983
984
985
986
987
988
989
990
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1008
1010
1011
1014
1015
1016
1018
1020
1021
1022
1024
1027
1028
1030
1031
1033
1034
1036
1037
1038
1043
1044
1045
1046
1047
1048
1049
1053
1055
1056
1058
1059
1061
1062
1068
1069
1074
1075
1080
1081
1083
1084
1090
1091
1097
1098
1102
1103
1109
1110
1116
1117
1121
1122
1123
1124
1126
1127
1129
1130
1132
1133
1135
1136
1138
1139
1141
1142
1144
1145
1147
1148
1149
1150
1151
1153
1154
1156
1157
1159
1160
1162
1163
1165
1166
1168
1169
1170
1171
1172
1173
1176
1177
1179
1180
1185
1186
1189
1190
1192
1193
1195
1196
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1217
1220
1221
1222
1228
1229
1230
1233
1234
1237
1238
1241
1242
1243
1244
1245
1246
1248
1249
1250
1251
1252
1257
1258
1259
1260
1261
1262
1263
1264
1272
1273
1278
1281
1282
1287
1288
1292
1293
1297
1298
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1365
1366
1378
1379
1395
1396
1410
1411
1423
1424
1451
1452
1453
1458
1470
1471
1481
1482
1499
1500
1501
1530
1531
1537
1538
1539
1540
1545
1547
1548
1550
1551
1553
1554
1556
1557
1559
1560
1563
1564
1568
1569
1573
1574
1577
1578
1579
1580
1581
1582
1595
1596
1597
1598
1610
1611
1612
1613
1614
1615
1627
1628
1629
1631
1632
1641
1642
1655
1656
1657
1666
1667
1697
1698
1743
1744
1751
1752
1771
1772
1773
1789
1790
1791
1792
1793
1794
1795
1796
1797
1808
1809
1810
1819
1820
1821
1828
1829
1837
1838
1839
1857
1858
1859
1860
1861
1862
1863
1879
1880
1881
1882
1883
1884
1898
1899
1900
1901
1902
1903
1924
1925
1926
1927
1928
1929
1930
1947
1948
1949
1950
1951
1952
1953
1961
1962
1963
1970
1971
1985
1986
1987
1988
1989
1990
1991
2004
2005
2006
2007
2008
2009
2023
2024
2032
2033
2034
2039
2049
2050
2051
2052
2053
2054
2065
2066
2067
2068
2069
2070
2071
2073
2074
2075
2076
2077
2078
2080
2085
2086
2092
2094
2095
2097
2098
2100
2101
2103
2104
2105
2106
2107
2109
2110
2111
2113
2114
2116
2117
2119
2120
2121
2122
2123
2124
2125
2130
2136
2137
2140
2141
2147
2148
2149
2150
2151
2159
2160
2161
2162
2163
2179
2181
2182
2185
2186
2189
2190
2192
2193
2197
2198
2203
2204
2205
2206
2225
2227
2228
2231
2232
2235
2236
2238
2239
2243
2244
2249
2250
2253
2254
2257
2258
2259
2260
2263
2264
2265
2266
2267
2268
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2334
2335
2336
2337
2353
2355
2356
2359
2360
2363
2364
2366
2367
2371
2372
2377
2378
2380
2381
2383
2384
2385
2386
2405
2407
2408
2411
2412
2415
2416
2420
2421
2427
2428
2433
2434
2435
2436
2450
2452
2453
2455
2456
2458
2459
2465
2466
2468
2469
2470
2471
2507
2509
2510
2512
2513
2515
2516
2521
2522
2524
2525
2528
2529
2535
2536
2537
2538
2549
2551
2552
2554
2555
2557
2558
2559
2560
2561
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2575
2576
2577
2587
2588
2592
2603
2604
2605
2616
2617
2618
2630
2631
2632
2633
2634
2635
2654
2655
2656
2665
2666
2667
2671
2680
2681
2682
2709
2710
2711
2712
2713
2714
2715
2727
2728
2729
2753
2754
2755
2776
2777
2778
2837
2838
2839
2840
2841
2842
2843
2844
2911
2912
2913
2914
2915
2916
2917
2919
2920
2921
2922
2925
2926
2932
2936
2937
2941
2943
2944
2947
2948
2953
2954
2959
2960
2964
2965
2968
2969
2973
2977
2978
2983
2984
2988
2989
2993
2994
2997
2998
3002
3003
3006
3007
3011
3014
3015
3018
3019
3022
3023
3026
3027
3028
3029
3033
3034
3039
3051
3052
3053
3056
3057
3070
3071
3074
3075
3079
3080
3081
3082
3083
3114
3115
3128
3129
3152
3153
3162
3163
3164
3165
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3196
3197
3198
3199
3200
3201
3203
3219
3221
3222
3224
3225
3227
3228
3230
3231
3233
3234
3235
3236
3237
3238
3239
3240
3246
3247
3255
3256
3257
3267
3268
3269
3277
3278
3288
3289
3297
3298
3299
3308
3309
3310
3318
3319
3320
3321
3322
3323
3324
3333
3334
3335
3336
3337
3338
3339
3349
3350
3351
3360
3361
3362
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3393
3394
/************************************************************************************
 \file      OVR_CAPI.h
 \brief     C Interface to the Oculus PC SDK tracking and rendering library.
 \copyright Copyright 2014 Oculus VR, LLC All Rights reserved.
 ************************************************************************************/

// We don't use version numbers within OVR_CAPI_h, as all versioned variations
// of this file are currently mutually exclusive.
#ifndef OVR_CAPI_h
#define OVR_CAPI_h

#include "OVR_CAPI_Keys.h"
#include "OVR_Version.h"
#include "OVR_ErrorCode.h"

#if !defined(_WIN32)
#include <sys/types.h>
#endif


#include <stdint.h>

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4324) // structure was padded due to __declspec(align())
#pragma warning(disable : 4359) // The alignment specified for a type is less than the
// alignment of the type of one of its data members
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_OS
//
#if !defined(OVR_OS_WIN32) && defined(_WIN32)
#define OVR_OS_WIN32
#endif

#if !defined(OVR_OS_MAC) && defined(__APPLE__)
#define OVR_OS_MAC
#endif

#if !defined(OVR_OS_LINUX) && defined(__linux__)
#define OVR_OS_LINUX
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_CPP
//
#if !defined(OVR_CPP)
#if defined(__cplusplus)
#define OVR_CPP(x) x
#else
#define OVR_CPP(x) /* Not C++ */
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_CDECL
//
//
#if !defined(OVR_CDECL)
#if defined(_WIN32)
#define OVR_CDECL __cdecl
#else
#define OVR_CDECL
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_EXTERN_C
//
//
#if !defined(OVR_EXTERN_C)
#ifdef __cplusplus
#define OVR_EXTERN_C extern "C"
#else
#define OVR_EXTERN_C
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_PUBLIC_FUNCTION / OVR_PRIVATE_FUNCTION
//
// OVR_PUBLIC_FUNCTION  - Functions that externally visible from a shared library.
//                        Corresponds to Microsoft __dllexport.
// OVR_PUBLIC_CLASS     - C++ structs and classes that are externally visible from a
//                        shared library. Corresponds to Microsoft __dllexport.
// OVR_PRIVATE_FUNCTION - Functions that are not visible outside of a shared library.
//                        They are private to the shared library.
// OVR_PRIVATE_CLASS    - C++ structs and classes that are not visible outside of a
//                        shared library. They are private to the shared library.
//
// OVR_DLL_BUILD        - Used to indicate that the current compilation unit is of a shared library.
// OVR_DLL_IMPORT       - Used to indicate that the current compilation unit is a
//                        user of the corresponding shared library.
// OVR_STATIC_BUILD     - used to indicate that the current compilation unit is not a
//                        shared library but rather statically linked code.
//
#if !defined(OVR_PUBLIC_FUNCTION)
#if defined(OVR_DLL_BUILD)
#if defined(_WIN32)
#define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C __declspec(dllexport) rval OVR_CDECL
#define OVR_PUBLIC_CLASS __declspec(dllexport)
#define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL
#define OVR_PRIVATE_CLASS
#else
#define OVR_PUBLIC_FUNCTION(rval) \
  OVR_EXTERN_C __attribute__((visibility("default"))) rval OVR_CDECL /* Requires GCC 4.0+ */
#define OVR_PUBLIC_CLASS __attribute__((visibility("default"))) /* Requires GCC 4.0+ */
#define OVR_PRIVATE_FUNCTION(rval) __attribute__((visibility("hidden"))) rval OVR_CDECL
#define OVR_PRIVATE_CLASS __attribute__((visibility("hidden")))
#endif
#elif defined(OVR_DLL_IMPORT)
#if defined(_WIN32)
#define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C __declspec(dllimport) rval OVR_CDECL
#define OVR_PUBLIC_CLASS __declspec(dllimport)
#else
#define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C rval OVR_CDECL
#define OVR_PUBLIC_CLASS
#endif
#define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL
#define OVR_PRIVATE_CLASS
#else // OVR_STATIC_BUILD
#define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C rval OVR_CDECL
#define OVR_PUBLIC_CLASS
#define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL
#define OVR_PRIVATE_CLASS
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_EXPORT
//
//
#if !defined(OVR_EXPORT)
#ifdef OVR_OS_WIN32
#define OVR_EXPORT __declspec(dllexport)
#else
#define OVR_EXPORT
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_ALIGNAS
//
#if !defined(OVR_ALIGNAS)
#if defined(__GNUC__) || defined(__clang__)
#define OVR_ALIGNAS(n) __attribute__((aligned(n)))
#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
#define OVR_ALIGNAS(n) __declspec(align(n))
#elif defined(__CC_ARM)
#define OVR_ALIGNAS(n) __align(n)
#else
#error Need to define OVR_ALIGNAS
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_CC_HAS_FEATURE
//
// This is a portable way to use compile-time feature identification available
// with some compilers in a clean way. Direct usage of __has_feature in preprocessing
// statements of non-supporting compilers results in a preprocessing error.
//
// Example usage:
//     #if OVR_CC_HAS_FEATURE(is_pod)
//         if(__is_pod(T)) // If the type is plain data then we can safely memcpy it.
//             memcpy(&destObject, &srcObject, sizeof(object));
//     #endif
//
#if !defined(OVR_CC_HAS_FEATURE)
#if defined(__clang__) // http://clang.llvm.org/docs/LanguageExtensions.html#id2
#define OVR_CC_HAS_FEATURE(x) __has_feature(x)
#else
#define OVR_CC_HAS_FEATURE(x) 0
#endif
#endif

// ------------------------------------------------------------------------
// ***** OVR_STATIC_ASSERT
//
// Portable support for C++11 static_assert().
// Acts as if the following were declared:
//     void OVR_STATIC_ASSERT(bool const_expression, const char* msg);
//
// Example usage:
//     OVR_STATIC_ASSERT(sizeof(int32_t) == 4, "int32_t expected to be 4 bytes.");

#if !defined(OVR_STATIC_ASSERT)
#if !(defined(__cplusplus) && (__cplusplus >= 201103L)) /* Other */ && \
    !(defined(__GXX_EXPERIMENTAL_CXX0X__)) /* GCC */ &&                \
    !(defined(__clang__) && defined(__cplusplus) &&                    \
      OVR_CC_HAS_FEATURE(cxx_static_assert)) /* clang */               \
    && !(defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(__cplusplus)) /* VS2010+  */

#if !defined(OVR_SA_UNUSED)
#if defined(OVR_CC_GNU) || defined(OVR_CC_CLANG)
#define OVR_SA_UNUSED __attribute__((unused))
#else
#define OVR_SA_UNUSED
#endif
#define OVR_SA_PASTE(a, b) a##b
#define OVR_SA_HELP(a, b) OVR_SA_PASTE(a, b)
#endif

#if defined(__COUNTER__)
#define OVR_STATIC_ASSERT(expression, msg) \
  typedef char OVR_SA_HELP(staticAssert, __COUNTER__)[((expression) != 0) ? 1 : -1] OVR_SA_UNUSED
#else
#define OVR_STATIC_ASSERT(expression, msg) \
  typedef char OVR_SA_HELP(staticAssert, __LINE__)[((expression) != 0) ? 1 : -1] OVR_SA_UNUSED
#endif

#else
#define OVR_STATIC_ASSERT(expression, msg) static_assert(expression, msg)
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** Padding
//
#if !defined(OVR_UNUSED_STRUCT_PAD)
#define OVR_UNUSED_STRUCT_PAD(padName, size) char padName[size];
#endif

//-----------------------------------------------------------------------------------
// ***** Word Size
//
#if !defined(OVR_PTR_SIZE)
#if defined(__WORDSIZE)
#define OVR_PTR_SIZE ((__WORDSIZE) / 8)
#elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || \
    defined(__ia64__) || defined(__arch64__) || defined(__64BIT__) || defined(__Ptr_Is_64)
#define OVR_PTR_SIZE 8
#elif defined(__CC_ARM) && (__sizeof_ptr == 8)
#define OVR_PTR_SIZE 8
#else
#define OVR_PTR_SIZE 4
#endif
#endif

//-----------------------------------------------------------------------------------
// ***** OVR_ON32 / OVR_ON64
//
#if OVR_PTR_SIZE == 8
#define OVR_ON32(x)
#define OVR_ON64(x) x
#else
#define OVR_ON32(x) x
#define OVR_ON64(x)
#endif

//-----------------------------------------------------------------------------------
// ***** ovrBool

typedefchar ovrBool; 
#define ovrFalse 0 
#define ovrTrue 1 

//-----------------------------------------------------------------------------------
// ***** Simple Math Structures

typedefstruct OVR_ALIGNAS(4) ovrColorf_ {
float r, g, b, a;
} ovrColorf;

typedefstruct OVR_ALIGNAS(4) ovrVector2i_ {
int x, y;
} ovrVector2i;

typedefstruct OVR_ALIGNAS(4) ovrSizei_ {
int w, h;
} ovrSizei;

typedefstruct OVR_ALIGNAS(4) ovrRecti_ {
  ovrVector2i Pos;
  ovrSizei Size;
} ovrRecti;

typedefstruct OVR_ALIGNAS(4) ovrQuatf_ {
float x, y, z, w;
} ovrQuatf;

typedefstruct OVR_ALIGNAS(4) ovrVector2f_ {
float x, y;
} ovrVector2f;

typedefstruct OVR_ALIGNAS(4) ovrVector3f_ {
float x, y, z;
} ovrVector3f;

typedefstruct OVR_ALIGNAS(4) ovrMatrix4f_ {
float M[4][4];
} ovrMatrix4f;

typedefstruct OVR_ALIGNAS(4) ovrPosef_ {
  ovrQuatf Orientation;
  ovrVector3f Position;
} ovrPosef;

typedefstruct OVR_ALIGNAS(8) ovrPoseStatef_ {
  ovrPosef ThePose; 
  ovrVector3f AngularVelocity; 
  ovrVector3f LinearVelocity; 
  ovrVector3f AngularAcceleration; 
  ovrVector3f LinearAcceleration; 
  OVR_UNUSED_STRUCT_PAD(pad0, 4) 
  double TimeInSeconds; 
} ovrPoseStatef;

typedef struct OVR_ALIGNAS(4) ovrFovPort_ {
float UpTan; 
float DownTan; 
float LeftTan; 
float RightTan; 
} ovrFovPort;

//-----------------------------------------------------------------------------------
// ***** HMD Types

typedefenum ovrHmdType_ {
  ovrHmd_None = 0,
  ovrHmd_DK1 = 3,
  ovrHmd_DKHD = 4,
  ovrHmd_DK2 = 6,
  ovrHmd_CB = 8,
  ovrHmd_Other = 9,
  ovrHmd_E3_2015 = 10,
  ovrHmd_ES06 = 11,
  ovrHmd_ES09 = 12,
  ovrHmd_ES11 = 13,
  ovrHmd_CV1 = 14,

  ovrHmd_EnumSize = 0x7fffffff 
} ovrHmdType;

typedefenum ovrHmdCaps_ {
// Read-only flags

  ovrHmdCap_DebugDevice = 0x0010,


  ovrHmdCap_EnumSize = 0x7fffffff 
} ovrHmdCaps;

typedefenum ovrTrackingCaps_ {
  ovrTrackingCap_Orientation = 0x0010, 
  ovrTrackingCap_MagYawCorrection = 0x0020, 
  ovrTrackingCap_Position = 0x0040, 
  ovrTrackingCap_EnumSize = 0x7fffffff 
} ovrTrackingCaps;

typedefenum ovrExtensions_ {
  ovrExtension_TextureLayout_Octilinear = 0, 
  ovrExtension_Count, 
  ovrExtension_EnumSize = 0x7fffffff 
} ovrExtensions;

typedefenum ovrEyeType_ {
  ovrEye_Left = 0, 
  ovrEye_Right = 1, 
  ovrEye_Count = 2, 
  ovrEye_EnumSize = 0x7fffffff 
} ovrEyeType;

typedefenum ovrTrackingOrigin_ {
  ovrTrackingOrigin_EyeLevel = 0,

  ovrTrackingOrigin_FloorLevel = 1,

  ovrTrackingOrigin_Count = 2, 
  ovrTrackingOrigin_EnumSize = 0x7fffffff 
} ovrTrackingOrigin;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrGraphicsLuid_ {
// Public definition reserves space for graphics API-specific implementation
char Reserved[8];
} ovrGraphicsLuid;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrHmdDesc_ {
  ovrHmdType Type; 
  OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) 
  char ProductName[64]; 
char Manufacturer[64]; 
short VendorId; 
short ProductId; 
char SerialNumber[24]; 
short FirmwareMajor; 
short FirmwareMinor; 
unsignedint AvailableHmdCaps; 
unsignedint DefaultHmdCaps; 
unsignedint AvailableTrackingCaps; 
unsignedint DefaultTrackingCaps; 
  ovrFovPort DefaultEyeFov[ovrEye_Count]; 
  ovrFovPort MaxEyeFov[ovrEye_Count]; 
  ovrSizei Resolution; 
float DisplayRefreshRate; 
  OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad1, 4)) 
} ovrHmdDesc;

typedef struct ovrHmdStruct* ovrSession;

#ifdef OVR_OS_WIN32
typedef uint32_t ovrProcessId;
#else
typedef pid_t ovrProcessId;
#endif

#if !defined(VK_VERSION_1_0)
// From <vulkan/vulkan.h>:
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__)) || \
    defined(_M_X64) || defined(__ia64) || defined(_M_IA64) || defined(__aarch64__) ||       \
    defined(__powerpc64__)
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T* object;
#else
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
#endif
VK_DEFINE_HANDLE(VkInstance)
VK_DEFINE_HANDLE(VkPhysicalDevice)
VK_DEFINE_HANDLE(VkDevice)
VK_DEFINE_HANDLE(VkQueue)
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage)
#endif

typedefenum ovrStatusBits_ {
  ovrStatus_OrientationTracked = 0x0001, 
  ovrStatus_PositionTracked = 0x0002, 
  ovrStatus_EnumSize = 0x7fffffff 
} ovrStatusBits;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrTrackerDesc_ {
float FrustumHFovInRadians; 
float FrustumVFovInRadians; 
float FrustumNearZInMeters; 
float FrustumFarZInMeters; 
} ovrTrackerDesc;

typedefenum ovrTrackerFlags_ {
  ovrTracker_Connected = 0x0020,

  ovrTracker_PoseTracked = 0x0004
} ovrTrackerFlags;

typedefstruct OVR_ALIGNAS(8) _ovrTrackerPose {
unsignedint TrackerFlags;

  ovrPosef Pose;

  ovrPosef LeveledPose;

  OVR_UNUSED_STRUCT_PAD(pad0, 4) 
} ovrTrackerPose;

typedefstruct OVR_ALIGNAS(8) ovrTrackingState_ {
  ovrPoseStatef HeadPose;

unsignedint StatusFlags;

  ovrPoseStatef HandPoses[2];

unsignedint HandStatusFlags[2];

  ovrPosef CalibratedOrigin;

} ovrTrackingState;



typedefstruct OVR_ALIGNAS(4) ovrEyeRenderDesc_ {
  ovrEyeType Eye; 
  ovrFovPort Fov; 
  ovrRecti DistortedViewport; 
  ovrVector2f PixelsPerTanAngleAtCenter; 
  ovrPosef HmdToEyePose; 
} ovrEyeRenderDesc;

typedefstruct OVR_ALIGNAS(4) ovrTimewarpProjectionDesc_ {
float Projection22; 
float Projection23; 
float Projection32; 
} ovrTimewarpProjectionDesc;


typedefstruct OVR_ALIGNAS(4) ovrViewScaleDesc_ {
  ovrPosef HmdToEyePose[ovrEye_Count]; 
float HmdSpaceToWorldScaleInMeters; 
} ovrViewScaleDesc;

//-----------------------------------------------------------------------------------
// ***** Platform-independent Rendering Configuration

typedefenum ovrTextureType_ {
  ovrTexture_2D, 
  ovrTexture_2D_External, 
  ovrTexture_Cube, 
  ovrTexture_Count,
  ovrTexture_EnumSize = 0x7fffffff 
} ovrTextureType;

typedefenum ovrTextureBindFlags_ {
  ovrTextureBind_None,

  ovrTextureBind_DX_RenderTarget = 0x0001,

  ovrTextureBind_DX_UnorderedAccess = 0x0002,

  ovrTextureBind_DX_DepthStencil = 0x0004,

  ovrTextureBind_EnumSize = 0x7fffffff 
} ovrTextureBindFlags;

typedefenum ovrTextureFormat_ {
  OVR_FORMAT_UNKNOWN = 0,
  OVR_FORMAT_B5G6R5_UNORM = 1, 
  OVR_FORMAT_B5G5R5A1_UNORM = 2, 
  OVR_FORMAT_B4G4R4A4_UNORM = 3, 
  OVR_FORMAT_R8G8B8A8_UNORM = 4,
  OVR_FORMAT_R8G8B8A8_UNORM_SRGB = 5,
  OVR_FORMAT_B8G8R8A8_UNORM = 6,
  OVR_FORMAT_B8G8R8_UNORM = 27,
  OVR_FORMAT_B8G8R8A8_UNORM_SRGB = 7, 
  OVR_FORMAT_B8G8R8X8_UNORM = 8, 
  OVR_FORMAT_B8G8R8X8_UNORM_SRGB = 9, 
  OVR_FORMAT_R16G16B16A16_FLOAT = 10,
  OVR_FORMAT_R11G11B10_FLOAT = 25, 

// Depth formats
  OVR_FORMAT_D16_UNORM = 11,
  OVR_FORMAT_D24_UNORM_S8_UINT = 12,
  OVR_FORMAT_D32_FLOAT = 13,
  OVR_FORMAT_D32_FLOAT_S8X24_UINT = 14,

// Added in 1.5 compressed formats can be used for static layers
  OVR_FORMAT_BC1_UNORM = 15,
  OVR_FORMAT_BC1_UNORM_SRGB = 16,
  OVR_FORMAT_BC2_UNORM = 17,
  OVR_FORMAT_BC2_UNORM_SRGB = 18,
  OVR_FORMAT_BC3_UNORM = 19,
  OVR_FORMAT_BC3_UNORM_SRGB = 20,
  OVR_FORMAT_BC6H_UF16 = 21,
  OVR_FORMAT_BC6H_SF16 = 22,
  OVR_FORMAT_BC7_UNORM = 23,
  OVR_FORMAT_BC7_UNORM_SRGB = 24,


  OVR_FORMAT_ENUMSIZE = 0x7fffffff 
} ovrTextureFormat;

typedefenum ovrTextureMiscFlags_ {
  ovrTextureMisc_None,

  ovrTextureMisc_DX_Typeless = 0x0001,

  ovrTextureMisc_AllowGenerateMips = 0x0002,

  ovrTextureMisc_ProtectedContent = 0x0004,

  ovrTextureMisc_AutoGenerateMips = 0x0008,

  ovrTextureMisc_EnumSize = 0x7fffffff 
} ovrTextureFlags;

typedefstruct ovrTextureSwapChainDesc_ {
  ovrTextureType Type; 
  ovrTextureFormat Format;
int ArraySize; 
int Width;
int Height;
int MipLevels;
int SampleCount;
  ovrBool StaticImage; 
  OVR_ALIGNAS(4) unsigned int MiscFlags; 
  OVR_ALIGNAS(4) unsignedint BindFlags; 
} ovrTextureSwapChainDesc;

typedef enum ovrMirrorOptions_ {
  ovrMirrorOption_Default = 0x0000,

  ovrMirrorOption_PostDistortion = 0x0001,

  ovrMirrorOption_LeftEyeOnly = 0x0002,
  ovrMirrorOption_RightEyeOnly = 0x0004,

  ovrMirrorOption_IncludeGuardian = 0x0008,

  ovrMirrorOption_IncludeNotifications = 0x0010,

  ovrMirrorOption_IncludeSystemGui = 0x0020,


  ovrMirrorOption_EnumSize = 0x7fffffff 
} ovrMirrorOptions;

typedefstruct ovrMirrorTextureDesc_ {
  ovrTextureFormat Format;
int Width;
int Height;
unsignedint MiscFlags; 
unsignedint MirrorOptions; 
} ovrMirrorTextureDesc;

typedefstruct ovrTextureSwapChainData* ovrTextureSwapChain;
typedefstruct ovrMirrorTextureData* ovrMirrorTexture;

//-----------------------------------------------------------------------------------

typedefenum ovrButton_ {
  ovrButton_A = 0x00000001,

  ovrButton_B = 0x00000002,

  ovrButton_RThumb = 0x00000004,

  ovrButton_RShoulder = 0x00000008,


  ovrButton_X = 0x00000100,

  ovrButton_Y = 0x00000200,

  ovrButton_LThumb = 0x00000400,

  ovrButton_LShoulder = 0x00000800,

  ovrButton_Up = 0x00010000,

  ovrButton_Down = 0x00020000,

  ovrButton_Left = 0x00040000,

  ovrButton_Right = 0x00080000,

  ovrButton_Enter = 0x00100000,

  ovrButton_Back = 0x00200000,

  ovrButton_VolUp = 0x00400000,

  ovrButton_VolDown = 0x00800000,

  ovrButton_Home = 0x01000000,

// Bit mask of all buttons that are for private usage by Oculus
  ovrButton_Private = ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home,

// Bit mask of all buttons on the right Touch controller
  ovrButton_RMask = ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder,

// Bit mask of all buttons on the left Touch controller
  ovrButton_LMask =
      ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder | ovrButton_Enter,

  ovrButton_EnumSize = 0x7fffffff 
} ovrButton;

typedefenum ovrTouch_ {
  ovrTouch_A = ovrButton_A,
  ovrTouch_B = ovrButton_B,
  ovrTouch_RThumb = ovrButton_RThumb,
  ovrTouch_RThumbRest = 0x00000008,
  ovrTouch_RIndexTrigger = 0x00000010,

// Bit mask of all the button touches on the right controller
  ovrTouch_RButtonMask =
      ovrTouch_A | ovrTouch_B | ovrTouch_RThumb | ovrTouch_RThumbRest | ovrTouch_RIndexTrigger,

  ovrTouch_X = ovrButton_X,
  ovrTouch_Y = ovrButton_Y,
  ovrTouch_LThumb = ovrButton_LThumb,
  ovrTouch_LThumbRest = 0x00000800,
  ovrTouch_LIndexTrigger = 0x00001000,

// Bit mask of all the button touches on the left controller
  ovrTouch_LButtonMask =
      ovrTouch_X | ovrTouch_Y | ovrTouch_LThumb | ovrTouch_LThumbRest | ovrTouch_LIndexTrigger,

// Finger pose state
// Derived internally based on distance, proximity to sensors and filtering.
  ovrTouch_RIndexPointing = 0x00000020,
  ovrTouch_RThumbUp = 0x00000040,
  ovrTouch_LIndexPointing = 0x00002000,
  ovrTouch_LThumbUp = 0x00004000,

// Bit mask of all right controller poses
  ovrTouch_RPoseMask = ovrTouch_RIndexPointing | ovrTouch_RThumbUp,

// Bit mask of all left controller poses
  ovrTouch_LPoseMask = ovrTouch_LIndexPointing | ovrTouch_LThumbUp,

  ovrTouch_EnumSize = 0x7fffffff 
} ovrTouch;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrTouchHapticsDesc_ {
// Haptics engine frequency/sample-rate, sample time in seconds equals 1.0/sampleRateHz
int SampleRateHz;
// Size of each Haptics sample, sample value range is [0, 2^(Bytes*8)-1]
int SampleSizeInBytes;

// Queue size that would guarantee Haptics engine would not starve for data
// Make sure size doesn't drop below it for best results
int QueueMinSizeToAvoidStarvation;

// Minimum, Maximum and Optimal number of samples that can be sent to Haptics through
// ovr_SubmitControllerVibration
int SubmitMinSamples;
int SubmitMaxSamples;
int SubmitOptimalSamples;
} ovrTouchHapticsDesc;

typedefenum ovrControllerType_ {
  ovrControllerType_None = 0x0000,
  ovrControllerType_LTouch = 0x0001,
  ovrControllerType_RTouch = 0x0002,
  ovrControllerType_Touch = (ovrControllerType_LTouch | ovrControllerType_RTouch),
  ovrControllerType_Remote = 0x0004,

  ovrControllerType_XBox = 0x0010,

  ovrControllerType_Object0 = 0x0100,
  ovrControllerType_Object1 = 0x0200,
  ovrControllerType_Object2 = 0x0400,
  ovrControllerType_Object3 = 0x0800,

  ovrControllerType_Active = 0xffffffff, 

  ovrControllerType_EnumSize = 0x7fffffff 
} ovrControllerType;

typedefenum ovrHapticsBufferSubmitMode_ {
  ovrHapticsBufferSubmit_Enqueue
} ovrHapticsBufferSubmitMode;

#define OVR_HAPTICS_BUFFER_SAMPLES_MAX 256

typedefstruct ovrHapticsBuffer_ {
constvoid* Samples;
int SamplesCount;
  ovrHapticsBufferSubmitMode SubmitMode;
} ovrHapticsBuffer;

typedefstruct ovrHapticsPlaybackState_ {
// Remaining space available to queue more samples
int RemainingQueueSpace;

// Number of samples currently queued
int SamplesQueued;
} ovrHapticsPlaybackState;

typedefenum ovrTrackedDeviceType_ {
  ovrTrackedDevice_None = 0x0000,
  ovrTrackedDevice_HMD = 0x0001,
  ovrTrackedDevice_LTouch = 0x0002,
  ovrTrackedDevice_RTouch = 0x0004,
  ovrTrackedDevice_Touch = (ovrTrackedDevice_LTouch | ovrTrackedDevice_RTouch),

  ovrTrackedDevice_Object0 = 0x0010,
  ovrTrackedDevice_Object1 = 0x0020,
  ovrTrackedDevice_Object2 = 0x0040,
  ovrTrackedDevice_Object3 = 0x0080,

  ovrTrackedDevice_All = 0xFFFF,
} ovrTrackedDeviceType;

typedefenum ovrBoundaryType_ {
  ovrBoundary_Outer = 0x0001,

  ovrBoundary_PlayArea = 0x0100,
} ovrBoundaryType;

typedefstruct ovrBoundaryLookAndFeel_ {
  ovrColorf Color;
} ovrBoundaryLookAndFeel;

typedefstruct ovrBoundaryTestResult_ {
  ovrBool IsTriggering;

float ClosestDistance;

  ovrVector3f ClosestPoint;

  ovrVector3f ClosestPointNormal;
} ovrBoundaryTestResult;

typedefenum ovrHandType_ {
  ovrHand_Left = 0,
  ovrHand_Right = 1,
  ovrHand_Count = 2,
  ovrHand_EnumSize = 0x7fffffff 
} ovrHandType;

typedefstruct ovrInputState_ {
double TimeInSeconds;

unsignedint Buttons;

unsignedint Touches;

float IndexTrigger[ovrHand_Count];

float HandTrigger[ovrHand_Count];

  ovrVector2f Thumbstick[ovrHand_Count];

  ovrControllerType ControllerType;

float IndexTriggerNoDeadzone[ovrHand_Count];

float HandTriggerNoDeadzone[ovrHand_Count];

  ovrVector2f ThumbstickNoDeadzone[ovrHand_Count];

float IndexTriggerRaw[ovrHand_Count];

float HandTriggerRaw[ovrHand_Count];

  ovrVector2f ThumbstickRaw[ovrHand_Count];
} ovrInputState;

typedefstruct ovrCameraIntrinsics_ {
double LastChangedTime;

  ovrFovPort FOVPort;

float VirtualNearPlaneDistanceMeters;

float VirtualFarPlaneDistanceMeters;

  ovrSizei ImageSensorPixelResolution;

  ovrMatrix4f LensDistortionMatrix;

double ExposurePeriodSeconds;

double ExposureDurationSeconds;

} ovrCameraIntrinsics;

typedefenum ovrCameraStatusFlags_ {
  ovrCameraStatus_None = 0x0,

  ovrCameraStatus_Connected = 0x1,

  ovrCameraStatus_Calibrating = 0x2,

  ovrCameraStatus_CalibrationFailed = 0x4,

  ovrCameraStatus_Calibrated = 0x8,

  ovrCameraStatus_Capturing = 0x10,

  ovrCameraStatus_EnumSize = 0x7fffffff 
} ovrCameraStatusFlags;

typedefstruct ovrCameraExtrinsics_ {
double LastChangedTimeSeconds;

unsignedint CameraStatusFlags;

  ovrTrackedDeviceType AttachedToDevice;

  ovrPosef RelativePose;

double LastExposureTimeSeconds;

double ExposureLatencySeconds;

double AdditionalLatencySeconds;

} ovrCameraExtrinsics;
#define OVR_MAX_EXTERNAL_CAMERA_COUNT 16
#define OVR_EXTERNAL_CAMERA_NAME_SIZE 32
typedefstruct ovrExternalCamera_ {
char Name[OVR_EXTERNAL_CAMERA_NAME_SIZE]; // camera identifier: vid + pid + serial number etc.
  ovrCameraIntrinsics Intrinsics;
  ovrCameraExtrinsics Extrinsics;
} ovrExternalCamera;

//-----------------------------------------------------------------------------------
// ***** Initialize structures

typedefenum ovrInitFlags_ {
  ovrInit_Debug = 0x00000001,


  ovrInit_RequestVersion = 0x00000004,


  ovrInit_Invisible = 0x00000010,

  ovrInit_MixedRendering = 0x00000020,

  ovrInit_FocusAware = 0x00000040,





  ovrinit_WritableBits = 0x00ffffff,

  ovrInit_EnumSize = 0x7fffffff 
} ovrInitFlags;

typedefenum ovrLogLevel_ {
  ovrLogLevel_Debug = 0, 
  ovrLogLevel_Info = 1, 
  ovrLogLevel_Error = 2, 

  ovrLogLevel_EnumSize = 0x7fffffff 
} ovrLogLevel;

typedef void(OVR_CDECL* ovrLogCallback)(uintptr_t userData, int level, constchar* message);

typedefstruct OVR_ALIGNAS(8) ovrInitParams_ {
  uint32_t Flags;

  uint32_t RequestedMinorVersion;

  ovrLogCallback LogCallback;

  uintptr_t UserData;

  uint32_t ConnectionTimeoutMS;

  OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) 

} ovrInitParams;

#ifdef __cplusplus
extern"C" {
#endif

#if !defined(OVR_EXPORTING_CAPI)

// -----------------------------------------------------------------------------------
// ***** API Interfaces

OVR_PUBLIC_FUNCTION(ovrResult) ovr_Initialize(const ovrInitParams* params);

OVR_PUBLIC_FUNCTION(void) ovr_Shutdown();

OVR_PUBLIC_FUNCTION(void) ovr_GetLastErrorInfo(ovrErrorInfo* errorInfo);

OVR_PUBLIC_FUNCTION(constchar*) ovr_GetVersionString();

OVR_PUBLIC_FUNCTION(int) ovr_TraceMessage(int level, constchar* message);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_IdentifyClient(constchar* identity);

//-------------------------------------------------------------------------------------

OVR_PUBLIC_FUNCTION(ovrHmdDesc) ovr_GetHmdDesc(ovrSession session);

OVR_PUBLIC_FUNCTION(unsignedint) ovr_GetTrackerCount(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrTrackerDesc)
ovr_GetTrackerDesc(ovrSession session, unsignedint trackerDescIndex);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_Create(ovrSession* pSession, ovrGraphicsLuid* pLuid);

OVR_PUBLIC_FUNCTION(void) ovr_Destroy(ovrSession session);

#endif // !defined(OVR_EXPORTING_CAPI)

typedefstruct ovrSessionStatus_ {
  ovrBool IsVisible;

  ovrBool HmdPresent;

  ovrBool HmdMounted;

  ovrBool DisplayLost;

  ovrBool ShouldQuit;

  ovrBool ShouldRecenter;

  ovrBool HasInputFocus;

  ovrBool OverlayPresent;

  ovrBool DepthRequested;

} ovrSessionStatus;

#if !defined(OVR_EXPORTING_CAPI)

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetSessionStatus(ovrSession session, ovrSessionStatus* sessionStatus);


OVR_PUBLIC_FUNCTION(ovrResult)
ovr_IsExtensionSupported(
    ovrSession session,
    ovrExtensions extension,
    ovrBool* outExtensionSupported);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_EnableExtension(ovrSession session, ovrExtensions extension);


//-------------------------------------------------------------------------------------


OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SetTrackingOriginType(ovrSession session, ovrTrackingOrigin origin);

OVR_PUBLIC_FUNCTION(ovrTrackingOrigin) ovr_GetTrackingOriginType(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_RecenterTrackingOrigin(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_SpecifyTrackingOrigin(ovrSession session, ovrPosef originPose);

OVR_PUBLIC_FUNCTION(void) ovr_ClearShouldRecenterFlag(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrTrackingState)
ovr_GetTrackingState(ovrSession session, double absTime, ovrBool latencyMarker);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetDevicePoses(
    ovrSession session,
    ovrTrackedDeviceType* deviceTypes,
int deviceCount,
double absTime,
    ovrPoseStatef* outDevicePoses);


OVR_PUBLIC_FUNCTION(ovrTrackerPose)
ovr_GetTrackerPose(ovrSession session, unsignedint trackerPoseIndex);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetInputState(ovrSession session, ovrControllerType controllerType, ovrInputState* inputState);

OVR_PUBLIC_FUNCTION(unsignedint) ovr_GetConnectedControllerTypes(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrTouchHapticsDesc)
ovr_GetTouchHapticsDesc(ovrSession session, ovrControllerType controllerType);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SetControllerVibration(
    ovrSession session,
    ovrControllerType controllerType,
float frequency,
float amplitude);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SubmitControllerVibration(
    ovrSession session,
    ovrControllerType controllerType,
const ovrHapticsBuffer* buffer);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetControllerVibrationState(
    ovrSession session,
    ovrControllerType controllerType,
    ovrHapticsPlaybackState* outState);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_TestBoundary(
    ovrSession session,
    ovrTrackedDeviceType deviceBitmask,
    ovrBoundaryType boundaryType,
    ovrBoundaryTestResult* outTestResult);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_TestBoundaryPoint(
    ovrSession session,
const ovrVector3f* point,
    ovrBoundaryType singleBoundaryType,
    ovrBoundaryTestResult* outTestResult);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SetBoundaryLookAndFeel(ovrSession session, const ovrBoundaryLookAndFeel* lookAndFeel);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_ResetBoundaryLookAndFeel(ovrSession session);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetBoundaryGeometry(
    ovrSession session,
    ovrBoundaryType boundaryType,
    ovrVector3f* outFloorPoints,
int* outFloorPointsCount);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetBoundaryDimensions(
    ovrSession session,
    ovrBoundaryType boundaryType,
    ovrVector3f* outDimensions);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetBoundaryVisible(ovrSession session, ovrBool* outIsVisible);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_RequestBoundaryVisible(ovrSession session, ovrBool visible);

// -----------------------------------------------------------------------------------

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetExternalCameras(
    ovrSession session,
    ovrExternalCamera* cameras,
unsignedint* inoutCameraCount);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SetExternalCameraProperties(
    ovrSession session,
constchar* name,
const ovrCameraIntrinsics* const intrinsics,
const ovrCameraExtrinsics* const extrinsics);


#endif // !defined(OVR_EXPORTING_CAPI)

//-------------------------------------------------------------------------------------
// @name Layers
//

enum { ovrMaxLayerCount = 16 };

typedefenum ovrLayerType_ {
  ovrLayerType_Disabled = 0,

  ovrLayerType_EyeFov = 1,

  ovrLayerType_EyeFovDepth = 2,

  ovrLayerType_Quad = 3,

// enum 4 used to be ovrLayerType_QuadHeadLocked. Instead, use ovrLayerType_Quad with
// ovrLayerFlag_HeadLocked.

  ovrLayerType_EyeMatrix = 5,


  ovrLayerType_EyeFovMultires = 7,

  ovrLayerType_Cylinder = 8,

  ovrLayerType_Cube = 10,


  ovrLayerType_EnumSize = 0x7fffffff 

} ovrLayerType;

typedefenum ovrLayerFlags_ {
  ovrLayerFlag_HighQuality = 0x01,

  ovrLayerFlag_TextureOriginAtBottomLeft = 0x02,

  ovrLayerFlag_HeadLocked = 0x04,


} ovrLayerFlags;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerHeader_ {
  ovrLayerType Type; 
unsigned Flags; 
} ovrLayerHeader;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeFov_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture[ovrEye_Count];

  ovrRecti Viewport[ovrEye_Count];

  ovrFovPort Fov[ovrEye_Count];

  ovrPosef RenderPose[ovrEye_Count];

double SensorSampleTime;

} ovrLayerEyeFov;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeFovDepth_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture[ovrEye_Count];

  ovrRecti Viewport[ovrEye_Count];

  ovrFovPort Fov[ovrEye_Count];

  ovrPosef RenderPose[ovrEye_Count];

double SensorSampleTime;

  ovrTextureSwapChain DepthTexture[ovrEye_Count];

  ovrTimewarpProjectionDesc ProjectionDesc;

} ovrLayerEyeFovDepth;

typedefenum ovrTextureLayout_ {
  ovrTextureLayout_Rectilinear = 0, 
  ovrTextureLayout_Octilinear = 1, 
  ovrTextureLayout_EnumSize = 0x7fffffff 
} ovrTextureLayout;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrTextureLayoutOctilinear_ {
// W warping
float WarpLeft;
float WarpRight;
float WarpUp;
float WarpDown;

// Size of W quadrants.
//
// SizeLeft + SizeRight <= Viewport.Size.w
// SizeUp   + sizeDown  <= Viewport.Size.h
//
// Clip space (0,0) is located at Viewport.Pos + (SizeLeft,SizeUp) where
// Viewport is given in the layer description.
//
// Viewport Top left
// +-----------------------------------------------------+
// |                        ^                       |    |
// |                        |                       |    |
// |           0          SizeUp         1          |    |
// |                        |                       |<--Portion of viewport
// |                        |                       |   determined by sizes
// |                        |                       |    |
// |<--------SizeLeft-------+-------SizeRight------>|    |
// |                        |                       |    |
// |                        |                       |    |
// |           2         SizeDown        3          |    |
// |                        |                       |    |
// |                        |                       |    |
// |                        v                       |    |
// +------------------------------------------------+    |
// |                                                     |
// +-----------------------------------------------------+
//                                                       Viewport bottom right
//
// For example, when rendering quadrant 0 its scissor rectangle will be
//
//  Top    = 0
//  Left   = 0
//  Right  = SizeLeft
//  Bottom = SizeUp
//
// and the scissor rectangle for quadrant 1 will be:
//
//  Top    = 0
//  Left   = SizeLeft
//  Right  = SizeLeft + SizeRight
//  Bottom = SizeUp
//
float SizeLeft;
float SizeRight;
float SizeUp;
float SizeDown;

} ovrTextureLayoutOctilinear;

typedefunion OVR_ALIGNAS(OVR_PTR_SIZE) ovrTextureLayoutDesc_Union_ {
  ovrTextureLayoutOctilinear Octilinear[ovrEye_Count];
} ovrTextureLayoutDesc_Union;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeFovMultires_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture[ovrEye_Count];

  ovrRecti Viewport[ovrEye_Count];

  ovrFovPort Fov[ovrEye_Count];

  ovrPosef RenderPose[ovrEye_Count];

double SensorSampleTime;

  ovrTextureLayout TextureLayout;

  ovrTextureLayoutDesc_Union TextureLayoutDesc;

} ovrLayerEyeFovMultires;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeMatrix_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture[ovrEye_Count];

  ovrRecti Viewport[ovrEye_Count];

  ovrPosef RenderPose[ovrEye_Count];

  ovrMatrix4f Matrix[ovrEye_Count];

double SensorSampleTime;

} ovrLayerEyeMatrix;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerQuad_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture;

  ovrRecti Viewport;

  ovrPosef QuadPoseCenter;

  ovrVector2f QuadSize;

} ovrLayerQuad;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerCylinder_ {
  ovrLayerHeader Header;

  ovrTextureSwapChain ColorTexture;

  ovrRecti Viewport;

  ovrPosef CylinderPoseCenter;

float CylinderRadius;

float CylinderAngle;

float CylinderAspectRatio;

} ovrLayerCylinder;

typedefstruct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerCube_ {
  ovrLayerHeader Header;

  ovrQuatf Orientation;

  ovrTextureSwapChain CubeMapTexture;
} ovrLayerCube;



typedefunion ovrLayer_Union_ {
  ovrLayerHeader Header;
  ovrLayerEyeFov EyeFov;
  ovrLayerEyeFovDepth EyeFovDepth;
  ovrLayerQuad Quad;
  ovrLayerEyeFovMultires Multires;
  ovrLayerCylinder Cylinder;
  ovrLayerCube Cube;
} ovrLayer_Union;


#if !defined(OVR_EXPORTING_CAPI)




OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetTextureSwapChainLength(ovrSession session, ovrTextureSwapChain chain, int* out_Length);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetTextureSwapChainCurrentIndex(ovrSession session, ovrTextureSwapChain chain, int* out_Index);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_GetTextureSwapChainDesc(
    ovrSession session,
    ovrTextureSwapChain chain,
    ovrTextureSwapChainDesc* out_Desc);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_CommitTextureSwapChain(ovrSession session, ovrTextureSwapChain chain);

OVR_PUBLIC_FUNCTION(void)
ovr_DestroyTextureSwapChain(ovrSession session, ovrTextureSwapChain chain);


OVR_PUBLIC_FUNCTION(void)
ovr_DestroyMirrorTexture(ovrSession session, ovrMirrorTexture mirrorTexture);

OVR_PUBLIC_FUNCTION(ovrSizei)
ovr_GetFovTextureSize(
    ovrSession session,
    ovrEyeType eye,
    ovrFovPort fov,
float pixelsPerDisplayPixel);

OVR_PUBLIC_FUNCTION(ovrEyeRenderDesc)
ovr_GetRenderDesc(ovrSession session, ovrEyeType eyeType, ovrFovPort fov);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_WaitToBeginFrame(ovrSession session, longlong frameIndex);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_BeginFrame(ovrSession session, longlong frameIndex);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_EndFrame(
    ovrSession session,
longlong frameIndex,
const ovrViewScaleDesc* viewScaleDesc,
    ovrLayerHeader const* const* layerPtrList,
unsignedint layerCount);

OVR_PUBLIC_FUNCTION(ovrResult)
ovr_SubmitFrame(
    ovrSession session,
longlong frameIndex,
const ovrViewScaleDesc* viewScaleDesc,
    ovrLayerHeader const* const* layerPtrList,
unsignedint layerCount);

#endif // !defined(OVR_EXPORTING_CAPI)

//-------------------------------------------------------------------------------------


typedefstruct OVR_ALIGNAS(4) ovrPerfStatsPerCompositorFrame_ {
int HmdVsyncIndex;


int AppFrameIndex;

int AppDroppedFrameCount;

float AppMotionToPhotonLatency;

float AppQueueAheadTime;

float AppCpuElapsedTime;

float AppGpuElapsedTime;


int CompositorFrameIndex;

int CompositorDroppedFrameCount;

float CompositorLatency;

float CompositorCpuElapsedTime;

float CompositorGpuElapsedTime;

float CompositorCpuStartToGpuEndElapsedTime;

float CompositorGpuEndToVsyncElapsedTime;


  ovrBool AswIsActive;

int AswActivatedToggleCount;

int AswPresentedFrameCount;

int AswFailedFrameCount;

} ovrPerfStatsPerCompositorFrame;

enum { ovrMaxProvidedFrameStats = 5 };

typedefstruct OVR_ALIGNAS(4) ovrPerfStats_ {
  ovrPerfStatsPerCompositorFrame FrameStats[ovrMaxProvidedFrameStats];
int FrameStatsCount;

  ovrBool AnyFrameStatsDropped;

float AdaptiveGpuPerformanceScale;

  ovrBool AswIsAvailable;

  ovrProcessId VisibleProcessId;
} ovrPerfStats;

#if !defined(OVR_EXPORTING_CAPI)

OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetPerfStats(ovrSession session, ovrPerfStats* outStats);

OVR_PUBLIC_FUNCTION(ovrResult) ovr_ResetPerfStats(ovrSession session);

OVR_PUBLIC_FUNCTION(double) ovr_GetPredictedDisplayTime(ovrSession session, longlong frameIndex);

OVR_PUBLIC_FUNCTION(double) ovr_GetTimeInSeconds();

#endif // !defined(OVR_EXPORTING_CAPI)

typedefenum ovrPerfHudMode_ {
  ovrPerfHud_Off = 0, 
  ovrPerfHud_PerfSummary = 1, 
  ovrPerfHud_LatencyTiming = 2, 
  ovrPerfHud_AppRenderTiming = 3, 
  ovrPerfHud_CompRenderTiming = 4, 
  ovrPerfHud_AswStats = 6, 
  ovrPerfHud_VersionInfo = 5, 
  ovrPerfHud_Count = 7, 
  ovrPerfHud_EnumSize = 0x7fffffff 
} ovrPerfHudMode;

typedefenum ovrLayerHudMode_ {
  ovrLayerHud_Off = 0, 
  ovrLayerHud_Info = 1, 
  ovrLayerHud_EnumSize = 0x7fffffff
} ovrLayerHudMode;


typedefenum ovrDebugHudStereoMode_ {
  ovrDebugHudStereo_Off = 0,

  ovrDebugHudStereo_Quad = 1,

  ovrDebugHudStereo_QuadWithCrosshair = 2,

  ovrDebugHudStereo_CrosshairAtInfinity = 3,

  ovrDebugHudStereo_Count,

  ovrDebugHudStereo_EnumSize = 0x7fffffff 
} ovrDebugHudStereoMode;

#if !defined(OVR_EXPORTING_CAPI)

// -----------------------------------------------------------------------------------


OVR_PUBLIC_FUNCTION(ovrBool)
ovr_GetBool(ovrSession session, constchar* propertyName, ovrBool defaultVal);

OVR_PUBLIC_FUNCTION(ovrBool)
ovr_SetBool(ovrSession session, constchar* propertyName, ovrBool value);

OVR_PUBLIC_FUNCTION(int) ovr_GetInt(ovrSession session, constchar* propertyName, int defaultVal);

OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetInt(ovrSession session, constchar* propertyName, int value);

OVR_PUBLIC_FUNCTION(float)
ovr_GetFloat(ovrSession session, constchar* propertyName, float defaultVal);

OVR_PUBLIC_FUNCTION(ovrBool)
ovr_SetFloat(ovrSession session, constchar* propertyName, float value);

OVR_PUBLIC_FUNCTION(unsignedint)
ovr_GetFloatArray(
    ovrSession session,
constchar* propertyName,
float values[],
unsignedint valuesCapacity);

OVR_PUBLIC_FUNCTION(ovrBool)
ovr_SetFloatArray(
    ovrSession session,
constchar* propertyName,
constfloat values[],
unsignedint valuesSize);

OVR_PUBLIC_FUNCTION(constchar*)
ovr_GetString(ovrSession session, constchar* propertyName, constchar* defaultVal);

OVR_PUBLIC_FUNCTION(ovrBool)
ovr_SetString(ovrSession session, constchar* propertyName, constchar* value);


#endif // !defined(OVR_EXPORTING_CAPI)

#ifdef __cplusplus
} // extern "C"
#endif

#if defined(_MSC_VER)
#pragma warning(pop)
#endif



OVR_STATIC_ASSERT(
sizeof(ovrTextureSwapChainDesc) == 10 * 4,
"ovrTextureSwapChainDesc size mismatch");

// -----------------------------------------------------------------------------------
// ***** Backward compatibility #includes
//
// This is at the bottom of this file because the following is dependent on the
// declarations above.

#if !defined(OVR_CAPI_NO_UTILS)
#include "Extras/OVR_CAPI_Util.h"
#endif


#endif // OVR_CAPI_h
The documentation for this file was generated from the following file: Include/OVR_CAPI.h