Class OVR
- java.lang.Object
-
- org.lwjgl.ovr.OVR
-
public class OVR extends java.lang.Object
Native bindings to libOVR, using the Oculus SDK C API.Overview of the API:
Setup
Initialize
Create
(&hmd, &graphicsId)- Use hmd members and
GetFovTextureSize
to determine graphics configuration andGetRenderDesc
to get per-eye rendering parameters. - Allocate texture swap chains with
ovr_CreateTextureSwapChainDX()
orCreateTextureSwapChainGL
. Create any associated render target views or frame buffer objects.
Application Loop
- Call
GetPredictedDisplayTime
to get the current frame timing information. - Call
GetTrackingState
andCalcEyePoses
to obtain the predicted rendering pose for each eye based on timing. - Render the scene content into the current buffer of the texture swapchains for each eye and layer you plan to update this frame. If you render into
a texture swap chain, you must call
CommitTextureSwapChain
on it to commit the changes before you reference the chain this frame (otherwise, your latest changes won't be picked up). - Call
SubmitFrame
to render the distorted layers to and present them on the HMD. IfSubmitFrame
returnsSuccess_NotVisible
, there is no need to render the scene for the next loop iteration. Instead, just callSubmitFrame
again until it returnsSuccess
.
Shutdown
-
-
Field Summary
Fields Modifier and Type Field and Description static int
OVR_FORMAT_B4G4R4A4_UNORM
OVR_FORMAT_B5G5R5A1_UNORM
OVR_FORMAT_B5G6R5_UNORMNot currently supported on PC.static int
OVR_FORMAT_B8G8R8A8_UNORM
The format of a texture.static int
OVR_FORMAT_B8G8R8A8_UNORM_SRGB
OVR_FORMAT_B8G8R8X8_UNORM
OVR_FORMAT_B8G8R8X8_UNORM_SRGBNot supported for OpenGL applications.static int
OVR_FORMAT_D16_UNORM
OVR_FORMAT_D24_UNORM_S8_UINT
OVR_FORMAT_D32_FLOAT
OVR_FORMAT_D32_FLOAT_S8X24_UINT
OVR_FORMAT_R16G16B16A16_FLOAT
OVR_FORMAT_R8G8B8A8_UNORM
OVR_FORMAT_R8G8B8A8_UNORM_SRGB
OVR_FORMAT_UNKNOWNThe format of a texture.static int
ovrButton_A
Button Astatic int
ovrButton_B
Button Bstatic int
ovrButton_Back
Button Backstatic int
ovrButton_Down
Button Downstatic int
ovrButton_Enter
Button Enterstatic int
ovrButton_Home
Button Homestatic int
ovrButton_Left
Button Leftstatic int
ovrButton_LMask
Bit mask of all buttons on the left Touch controllerstatic int
ovrButton_LShoulder
Button LShoulderstatic int
ovrButton_LThumb
Button LThumbstatic int
ovrButton_Private
Button input types.static int
ovrButton_Right
Button Rightstatic int
ovrButton_RMask
Bit mask of all buttons on the right Touch controllerstatic int
ovrButton_RShoulder
Button RShoulderstatic int
ovrButton_RThumb
Button RThumbstatic int
ovrButton_Up
Button Upstatic int
ovrButton_VolDown
Button VolDownstatic int
ovrButton_VolUp
Button VolUpstatic int
ovrButton_X
Button Xstatic int
ovrButton_Y
Button Ystatic int
ovrControllerType_Active
Operate on or query whichever controller is active.static int
ovrControllerType_LTouch
ovrControllerType_None
ovrControllerType_Remote
ovrControllerType_RTouch
ovrControllerType_Touch
ovrControllerType_XBoxWhich controller is connected; multiple can be connected at once.static int
ovrDebugHudStereo_CrosshairAtInfinity
ovrDebugHudStereo_Off
ovrDebugHudStereo_Quad
ovrDebugHudStereo_QuadWithCrosshairVisual properties of the stereo guide.static int
ovrEye_Left
The left eye, from the viewer's perspective.static int
ovrEye_Right
The right eye, from the viewer's perspective.static int
ovrFalse
Boolean valuesstatic int
ovrHand_Left
ovrHand_RightNames for the left and right hand array indexes.static int
ovrHmd_CB
ovrHmd_CV1
ovrHmd_DK1
ovrHmd_DK2
ovrHmd_DKHD
ovrHmd_E3_2015
ovrHmd_ES06
ovrHmd_ES09
ovrHmd_ES11
ovrHmd_None
ovrHmd_OtherHMD types.static int
ovrHmdCap_DebugDevice
(read only) Specifies that the HMD is a virtual debug device.static int
ovrInit_Debug
When a debug library is requested, a slower debugging version of the library will run which can be used to help solve problems in the library and debug application code.static int
ovrInit_RequestVersion
When a version is requested, the LibOVR runtime respects theRequestedMinorVersion
field and verifies that theRequestedMinorVersion
is supported.static int
ovrInit_WritableBits
These bits are writable by user code.static int
ovrLayerFlag_HeadLocked
Mark this surface as "headlocked", which means it is specified relative to the HMD and moves with it, rather than being specified relative to sensor/torso space and remaining still while the head moves.static int
ovrLayerFlag_HighQuality
Enables 4x anisotropic sampling during the composition of the layer.static int
ovrLayerFlag_TextureOriginAtBottomLeft
the opposite is TopLeft.static int
ovrLayerHud_Info
Shows info about a specific layerstatic int
ovrLayerHud_Off
Turns off the layer HUDstatic int
ovrLayerType_Disabled
Layer is disabled.static int
ovrLayerType_EyeFov
Described byOVRLayerEyeFov
.static int
ovrLayerType_EyeMatrix
Described byOVRLayerEyeMatrix
.static int
ovrLayerType_Quad
Described byOVRLayerQuad
.static int
ovrLogLevel_Debug
Debug-level log event.static int
ovrLogLevel_Error
Error-level log event.static int
ovrLogLevel_Info
Info-level log event.static int
ovrMaxLayerCount
Specifies the maximum number of layers supported bySubmitFrame
.static int
ovrPerfHud_AppRenderTiming
Shows render timing info for applicationstatic int
ovrPerfHud_CompRenderTiming
Shows render timing info for OVR compositorstatic int
ovrPerfHud_LatencyTiming
Shows latency related timing infostatic int
ovrPerfHud_Off
Turns off the performance HUDstatic int
ovrPerfHud_PerfSummary
Shows performance summary and headroomstatic int
ovrPerfHud_VersionInfo
Shows SDK & HMD version Infostatic int
ovrStatus_OrientationTracked
Orientation is currently tracked (connected and in use).static int
ovrStatus_PositionTracked
Position is currently tracked (false if out of range).static int
ovrTexture_2D
2D texturesstatic int
ovrTexture_2D_External
External 2D texture.static int
ovrTexture_Cube
Cube maps.static int
ovrTextureBind_DX_DepthStencil
The chain buffers can be bound as depth and/or stencil buffersstatic int
ovrTextureBind_DX_RenderTarget
The application can write into the chain with pixel shaderstatic int
ovrTextureBind_DX_UnorderedAccess
The application can write to the chain with compute shaderstatic int
ovrTextureBind_None
The bindings required for texture swap chain.static int
ovrTextureMisc_AllowGenerateMips
DX only: Allow generation of the mip chain on the GPU via the GenerateMips call.static int
ovrTextureMisc_DX_Typeless
DX only: The underlying texture is created with a TYPELESS equivalent of the format specified in the texture desc.static int
ovrTextureMisc_None
Misc flags overriding particular behaviors of a texture swap chain.static int
ovrTextureMisc_ProtectedContent
Texture swap chain contains protected content, and requires HDCP connection in order to display to HMD.static int
ovrTouch_A
Touch Astatic int
ovrTouch_B
Touch Bstatic int
ovrTouch_LButtonMask
Bit mask of all the button touches on the left controllerstatic int
ovrTouch_LIndexPointing
Touch LIndexPointingstatic int
ovrTouch_LIndexTrigger
Touch LIndexTriggerstatic int
ovrTouch_LPoseMask
Bit mask of all left controller poses.static int
ovrTouch_LThumb
Touch LThumbstatic int
ovrTouch_LThumbUp
Touch LThumbUpstatic int
ovrTouch_RButtonMask
Bit mask of all the button touches on the right controllerstatic int
ovrTouch_RIndexPointing
TouchRIndexPointingstatic int
ovrTouch_RIndexTrigger
Touch RIndexTriggerstatic int
ovrTouch_RPoseMask
Bit mask of all right controller posesstatic int
ovrTouch_RThumb
Touch RThumbstatic int
ovrTouch_RThumbUp
Touch RThumbUpstatic int
ovrTouch_X
Touch Xstatic int
ovrTouch_Y
Touch Ystatic int
ovrTracker_Connected
The sensor is present, else the sensor is absent or offline.static int
ovrTracker_PoseTracked
The sensor has a valid pose, else the pose is unavailable.static int
ovrTrackingCap_MagYawCorrection
Supports yaw drift correction via a magnetometer or other means.static int
ovrTrackingCap_Orientation
Supports orientation tracking (IMU).static int
ovrTrackingCap_Position
Supports positional tracking.static int
ovrTrackingOrigin_EyeLevel
Tracking system origin reported at eye (HMD) height.static int
ovrTrackingOrigin_FloorLevel
Tracking system origin reported at floor height.static int
ovrTrue
Boolean values
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static void
ovr_ClearShouldRecenterFlag(long session)
Clears the ShouldRecenter status bit in ovrSessionStatus.static int
ovr_CommitTextureSwapChain(long session, long chain)
Commits any pending changes to anovrTextureSwapChain
, and advances its current index.static int
ovr_Create(PointerBuffer pSession, OVRGraphicsLuid luid)
Creates a handle to a VR session.static void
ovr_Destroy(long session)
Destroys the HMD.static void
ovr_DestroyMirrorTexture(long session, long mirrorTexture)
Destroys a mirror texture previously created by one of the mirror texture creation functions.static void
ovr_DestroyTextureSwapChain(long session, long chain)
Destroys anovrTextureSwapChain
and frees all the resources associated with it.static boolean
ovr_GetBool(long session, java.nio.ByteBuffer propertyName, boolean defaultVal)
Reads a boolean property.static boolean
ovr_GetBool(long session, java.lang.CharSequence propertyName, boolean defaultVal)
Reads a boolean property.static int
ovr_GetConnectedControllerTypes(long session)
Returns controller types connected to the system OR'ed together.static float
ovr_GetFloat(long session, java.nio.ByteBuffer propertyName, float defaultVal)
Reads a float property.static float
ovr_GetFloat(long session, java.lang.CharSequence propertyName, float defaultVal)
Reads a float property.static int
ovr_GetFloatArray(long session, java.nio.ByteBuffer propertyName, float[] values)
Array version of:GetFloatArray
static int
ovr_GetFloatArray(long session, java.nio.ByteBuffer propertyName, java.nio.FloatBuffer values)
Reads a float array property.static int
ovr_GetFloatArray(long session, java.lang.CharSequence propertyName, float[] values)
Array version of:GetFloatArray
static int
ovr_GetFloatArray(long session, java.lang.CharSequence propertyName, java.nio.FloatBuffer values)
Reads a float array property.static OVRSizei
ovr_GetFovTextureSize(long session, int eye, OVRFovPort fov, float pixelsPerDisplayPixel, OVRSizei __result)
Calculates the recommended viewport size for rendering a given eye within the HMD with a given FOV cone.static OVRHmdDesc
ovr_GetHmdDesc(long session, OVRHmdDesc __result)
Returns information about the current HMD.static int
ovr_GetInputState(long session, int controllerType, OVRInputState inputState)
Returns the most recent input state for controllers, without positional tracking info.static int
ovr_GetInt(long session, java.nio.ByteBuffer propertyName, int defaultVal)
Reads an integer property.static int
ovr_GetInt(long session, java.lang.CharSequence propertyName, int defaultVal)
Reads an integer property.static void
ovr_GetLastErrorInfo(OVRErrorInfo errorInfo)
Returns information about the most recent failed return value by the current thread for this library.static double
ovr_GetPredictedDisplayTime(long session, long frameIndex)
Gets the time of the specified frame midpoint.static OVREyeRenderDesc
ovr_GetRenderDesc(long session, int eyeType, OVRFovPort fov, OVREyeRenderDesc __result)
Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye.static int
ovr_GetSessionStatus(long session, OVRSessionStatus sessionStatus)
Returns status information for the application.static java.lang.String
ovr_GetString(long session, java.nio.ByteBuffer propertyName, java.nio.ByteBuffer defaultVal)
Reads a string property.static java.lang.String
ovr_GetString(long session, java.lang.CharSequence propertyName, java.lang.CharSequence defaultVal)
Reads a string property.static int
ovr_GetTextureSwapChainCurrentIndex(long session, long chain, int[] out_Index)
Array version of:GetTextureSwapChainCurrentIndex
static int
ovr_GetTextureSwapChainCurrentIndex(long session, long chain, java.nio.IntBuffer out_Index)
Gets the current index in anovrTextureSwapChain
.static int
ovr_GetTextureSwapChainDesc(long session, long chain, OVRTextureSwapChainDesc out_Desc)
Gets the description of the buffers in anovrTextureSwapChain
.static int
ovr_GetTextureSwapChainLength(long session, long chain, int[] out_Length)
Array version of:GetTextureSwapChainLength
static int
ovr_GetTextureSwapChainLength(long session, long chain, java.nio.IntBuffer out_Length)
Gets the number of buffers in anovrTextureSwapChain
.static double
ovr_GetTimeInSeconds()
Returns global, absolute high-resolution time in seconds.static int
ovr_GetTrackerCount(long session)
Returns the number of sensors.static OVRTrackerDesc
ovr_GetTrackerDesc(long session, int trackerDescIndex, OVRTrackerDesc __result)
Returns a given sensor description.static OVRTrackerPose
ovr_GetTrackerPose(long session, int trackerPoseIndex, OVRTrackerPose __result)
Returns theOVRTrackerPose
for the given sensor.static int
ovr_GetTrackingOriginType(long session)
Gets the tracking origin state.static OVRTrackingState
ovr_GetTrackingState(long session, double absTime, boolean latencyMarker, OVRTrackingState __result)
Returns tracking state reading based on the specified absolute system time.static java.lang.String
ovr_GetVersionString()
Returns the version string representing the LibOVRRT version.static int
ovr_Initialize(OVRInitParams params)
Initialize LibOVR for application usage.static int
ovr_RecenterTrackingOrigin(long session)
Re-centers the sensor position and orientation.static boolean
ovr_SetBool(long session, java.nio.ByteBuffer propertyName, boolean value)
Writes or creates a boolean property.static boolean
ovr_SetBool(long session, java.lang.CharSequence propertyName, boolean value)
Writes or creates a boolean property.static int
ovr_SetControllerVibration(long session, int controllerType, float frequency, float amplitude)
Turns on vibration of the given controller.static boolean
ovr_SetFloat(long session, java.nio.ByteBuffer propertyName, float value)
Writes or creates a float property.static boolean
ovr_SetFloat(long session, java.lang.CharSequence propertyName, float value)
Writes or creates a float property.static boolean
ovr_SetFloatArray(long session, java.nio.ByteBuffer propertyName, float[] values)
Array version of:SetFloatArray
static boolean
ovr_SetFloatArray(long session, java.nio.ByteBuffer propertyName, java.nio.FloatBuffer values)
Writes or creates a float array property.static boolean
ovr_SetFloatArray(long session, java.lang.CharSequence propertyName, float[] values)
Array version of:SetFloatArray
static boolean
ovr_SetFloatArray(long session, java.lang.CharSequence propertyName, java.nio.FloatBuffer values)
Writes or creates a float array property.static boolean
ovr_SetInt(long session, java.nio.ByteBuffer propertyName, int value)
Writes or creates an integer property.static boolean
ovr_SetInt(long session, java.lang.CharSequence propertyName, int value)
Writes or creates an integer property.static boolean
ovr_SetString(long hmddesc, java.nio.ByteBuffer propertyName, java.nio.ByteBuffer value)
Writes or creates a string property.static boolean
ovr_SetString(long hmddesc, java.lang.CharSequence propertyName, java.lang.CharSequence value)
Writes or creates a string property.static int
ovr_SetTrackingOriginType(long session, int origin)
Sets the tracking origin type.static void
ovr_Shutdown()
Shuts down LibOVR.static int
ovr_SubmitFrame(long session, long frameIndex, OVRViewScaleDesc viewScaleDesc, PointerBuffer layerPtrList)
Submits layers for distortion and display.static java.lang.String
ovr_TraceMessage(int level, java.nio.ByteBuffer message)
Writes a message string to the LibOVR tracing mechanism (if enabled).static java.lang.String
ovr_TraceMessage(int level, java.lang.CharSequence message)
Writes a message string to the LibOVR tracing mechanism (if enabled).
-
-
-
Field Detail
-
ovrFalse
public static final int ovrFalse
Boolean values- See Also:
- Constant Field Values
-
ovrTrue
public static final int ovrTrue
Boolean values- See Also:
- Constant Field Values
-
ovrInit_Debug
public static final int ovrInit_Debug
When a debug library is requested, a slower debugging version of the library will run which can be used to help solve problems in the library and debug application code.- See Also:
- Constant Field Values
-
ovrInit_RequestVersion
public static final int ovrInit_RequestVersion
When a version is requested, the LibOVR runtime respects theRequestedMinorVersion
field and verifies that theRequestedMinorVersion
is supported.- See Also:
- Constant Field Values
-
ovrInit_WritableBits
public static final int ovrInit_WritableBits
These bits are writable by user code.- See Also:
- Constant Field Values
-
ovrLogLevel_Debug
public static final int ovrLogLevel_Debug
Debug-level log event.- See Also:
- Constant Field Values
-
ovrLogLevel_Info
public static final int ovrLogLevel_Info
Info-level log event.- See Also:
- Constant Field Values
-
ovrLogLevel_Error
public static final int ovrLogLevel_Error
Error-level log event.- See Also:
- Constant Field Values
-
ovrHmd_None
public static final int ovrHmd_None
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_DK1
public static final int ovrHmd_DK1
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_DKHD
public static final int ovrHmd_DKHD
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_DK2
public static final int ovrHmd_DK2
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_CB
public static final int ovrHmd_CB
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_Other
public static final int ovrHmd_Other
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_E3_2015
public static final int ovrHmd_E3_2015
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_ES06
public static final int ovrHmd_ES06
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_ES09
public static final int ovrHmd_ES09
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_ES11
public static final int ovrHmd_ES11
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmd_CV1
public static final int ovrHmd_CV1
HMD types. (ovrHmdType
)- See Also:
- Constant Field Values
-
ovrHmdCap_DebugDevice
public static final int ovrHmdCap_DebugDevice
(read only) Specifies that the HMD is a virtual debug device.- See Also:
- Constant Field Values
-
ovrTrackingCap_Orientation
public static final int ovrTrackingCap_Orientation
Supports orientation tracking (IMU).- See Also:
- Constant Field Values
-
ovrTrackingCap_MagYawCorrection
public static final int ovrTrackingCap_MagYawCorrection
Supports yaw drift correction via a magnetometer or other means.- See Also:
- Constant Field Values
-
ovrTrackingCap_Position
public static final int ovrTrackingCap_Position
Supports positional tracking.- See Also:
- Constant Field Values
-
ovrEye_Left
public static final int ovrEye_Left
The left eye, from the viewer's perspective.- See Also:
- Constant Field Values
-
ovrEye_Right
public static final int ovrEye_Right
The right eye, from the viewer's perspective.- See Also:
- Constant Field Values
-
ovrTrackingOrigin_EyeLevel
public static final int ovrTrackingOrigin_EyeLevel
Tracking system origin reported at eye (HMD) height.Prefer using this origin when your application requires matching user's current physical head pose to a virtual head pose without any regards to a the height of the floor. Cockpit-based, or 3rd-person experiences are ideal candidates. When used, all poses in
OVRTrackingState
are reported as an offset transform from the profile calibrated or recentered HMD pose. It is recommended that apps using this origin type callRecenterTrackingOrigin
prior to starting the VR experience, but notify the user before doing so to make sure the user is in a comfortable pose, facing a comfortable direction.- See Also:
- Constant Field Values
-
ovrTrackingOrigin_FloorLevel
public static final int ovrTrackingOrigin_FloorLevel
Tracking system origin reported at floor height.Prefer using this origin when your application requires the physical floor height to match the virtual floor height, such as standing experiences. When used, all poses in
OVRTrackingState
are reported as an offset transform from the profile calibrated floor pose. CallingRecenterTrackingOrigin
will recenter the X & Z axes as well as yaw, but the Y-axis (i.e. height) will continue to be reported using the floor height as the origin for all poses.- See Also:
- Constant Field Values
-
ovrStatus_OrientationTracked
public static final int ovrStatus_OrientationTracked
Orientation is currently tracked (connected and in use).- See Also:
- Constant Field Values
-
ovrStatus_PositionTracked
public static final int ovrStatus_PositionTracked
Position is currently tracked (false if out of range).- See Also:
- Constant Field Values
-
ovrTracker_Connected
public static final int ovrTracker_Connected
The sensor is present, else the sensor is absent or offline.- See Also:
- Constant Field Values
-
ovrTracker_PoseTracked
public static final int ovrTracker_PoseTracked
The sensor has a valid pose, else the pose is unavailable. This will only be set if ovrTracker_Connected is set.- See Also:
- Constant Field Values
-
ovrTexture_2D
public static final int ovrTexture_2D
2D textures- See Also:
- Constant Field Values
-
ovrTexture_2D_External
public static final int ovrTexture_2D_External
External 2D texture. Not used on PC- See Also:
- Constant Field Values
-
ovrTexture_Cube
public static final int ovrTexture_Cube
Cube maps. Not currently supported on PC.- See Also:
- Constant Field Values
-
ovrTextureBind_None
public static final int ovrTextureBind_None
The bindings required for texture swap chain. (ovrTextureBindFlags
)All texture swap chains are automatically bindable as shader input resources since the Oculus runtime needs this to read them.
- See Also:
- Constant Field Values
-
ovrTextureBind_DX_RenderTarget
public static final int ovrTextureBind_DX_RenderTarget
The application can write into the chain with pixel shader- See Also:
- Constant Field Values
-
ovrTextureBind_DX_UnorderedAccess
public static final int ovrTextureBind_DX_UnorderedAccess
The application can write to the chain with compute shader- See Also:
- Constant Field Values
-
ovrTextureBind_DX_DepthStencil
public static final int ovrTextureBind_DX_DepthStencil
The chain buffers can be bound as depth and/or stencil buffers- See Also:
- Constant Field Values
-
OVR_FORMAT_UNKNOWN
public static final int OVR_FORMAT_UNKNOWN
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_R8G8B8A8_UNORM
public static final int OVR_FORMAT_R8G8B8A8_UNORM
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_R8G8B8A8_UNORM_SRGB
public static final int OVR_FORMAT_R8G8B8A8_UNORM_SRGB
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_B8G8R8A8_UNORM
public static final int OVR_FORMAT_B8G8R8A8_UNORM
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_R16G16B16A16_FLOAT
public static final int OVR_FORMAT_R16G16B16A16_FLOAT
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_D16_UNORM
public static final int OVR_FORMAT_D16_UNORM
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_D24_UNORM_S8_UINT
public static final int OVR_FORMAT_D24_UNORM_S8_UINT
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_D32_FLOAT
public static final int OVR_FORMAT_D32_FLOAT
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_D32_FLOAT_S8X24_UINT
public static final int OVR_FORMAT_D32_FLOAT_S8X24_UINT
The format of a texture. (ovrTextureFormat
)- See Also:
- Constant Field Values
-
OVR_FORMAT_B5G6R5_UNORM
public static final int OVR_FORMAT_B5G6R5_UNORM
Not currently supported on PC. Would require a DirectX 11.1 device.- See Also:
- Constant Field Values
-
OVR_FORMAT_B5G5R5A1_UNORM
public static final int OVR_FORMAT_B5G5R5A1_UNORM
Not currently supported on PC. Would require a DirectX 11.1 device.- See Also:
- Constant Field Values
-
OVR_FORMAT_B4G4R4A4_UNORM
public static final int OVR_FORMAT_B4G4R4A4_UNORM
Not currently supported on PC. Would require a DirectX 11.1 device.- See Also:
- Constant Field Values
-
OVR_FORMAT_B8G8R8A8_UNORM_SRGB
public static final int OVR_FORMAT_B8G8R8A8_UNORM_SRGB
Not supported for OpenGL applications.- See Also:
- Constant Field Values
-
OVR_FORMAT_B8G8R8X8_UNORM
public static final int OVR_FORMAT_B8G8R8X8_UNORM
Not supported for OpenGL applications.- See Also:
- Constant Field Values
-
OVR_FORMAT_B8G8R8X8_UNORM_SRGB
public static final int OVR_FORMAT_B8G8R8X8_UNORM_SRGB
Not supported for OpenGL applications.- See Also:
- Constant Field Values
-
ovrTextureMisc_None
public static final int ovrTextureMisc_None
Misc flags overriding particular behaviors of a texture swap chain. (ovrTextureFlags
)- See Also:
- Constant Field Values
-
ovrTextureMisc_DX_Typeless
public static final int ovrTextureMisc_DX_Typeless
DX only: The underlying texture is created with a TYPELESS equivalent of the format specified in the texture desc. The SDK will still access the texture using the format specified in the texture desc, but the app can create views with different formats if this is specified.- See Also:
- Constant Field Values
-
ovrTextureMisc_AllowGenerateMips
public static final int ovrTextureMisc_AllowGenerateMips
DX only: Allow generation of the mip chain on the GPU via the GenerateMips call. This flag requires that RenderTarget binding also be specified.- See Also:
- Constant Field Values
-
ovrTextureMisc_ProtectedContent
public static final int ovrTextureMisc_ProtectedContent
Texture swap chain contains protected content, and requires HDCP connection in order to display to HMD. Also prevents mirroring or other redirection of any frame containing this contents- See Also:
- Constant Field Values
-
ovrButton_A
public static final int ovrButton_A
Button A- See Also:
- Constant Field Values
-
ovrButton_B
public static final int ovrButton_B
Button B- See Also:
- Constant Field Values
-
ovrButton_RThumb
public static final int ovrButton_RThumb
Button RThumb- See Also:
- Constant Field Values
-
ovrButton_RShoulder
public static final int ovrButton_RShoulder
Button RShoulder- See Also:
- Constant Field Values
-
ovrButton_RMask
public static final int ovrButton_RMask
Bit mask of all buttons on the right Touch controller- See Also:
- Constant Field Values
-
ovrButton_X
public static final int ovrButton_X
Button X- See Also:
- Constant Field Values
-
ovrButton_Y
public static final int ovrButton_Y
Button Y- See Also:
- Constant Field Values
-
ovrButton_LThumb
public static final int ovrButton_LThumb
Button LThumb- See Also:
- Constant Field Values
-
ovrButton_LShoulder
public static final int ovrButton_LShoulder
Button LShoulder- See Also:
- Constant Field Values
-
ovrButton_LMask
public static final int ovrButton_LMask
Bit mask of all buttons on the left Touch controller- See Also:
- Constant Field Values
-
ovrButton_Up
public static final int ovrButton_Up
Button Up- See Also:
- Constant Field Values
-
ovrButton_Down
public static final int ovrButton_Down
Button Down- See Also:
- Constant Field Values
-
ovrButton_Left
public static final int ovrButton_Left
Button Left- See Also:
- Constant Field Values
-
ovrButton_Right
public static final int ovrButton_Right
Button Right- See Also:
- Constant Field Values
-
ovrButton_Enter
public static final int ovrButton_Enter
Button Enter- See Also:
- Constant Field Values
-
ovrButton_Back
public static final int ovrButton_Back
Button Back- See Also:
- Constant Field Values
-
ovrButton_VolUp
public static final int ovrButton_VolUp
Button VolUp- See Also:
- Constant Field Values
-
ovrButton_VolDown
public static final int ovrButton_VolDown
Button VolDown- See Also:
- Constant Field Values
-
ovrButton_Home
public static final int ovrButton_Home
Button Home- See Also:
- Constant Field Values
-
ovrButton_Private
public static final int ovrButton_Private
Button input types. (ovrTouch
)- See Also:
- Constant Field Values
-
ovrTouch_A
public static final int ovrTouch_A
Touch A- See Also:
- Constant Field Values
-
ovrTouch_B
public static final int ovrTouch_B
Touch B- See Also:
- Constant Field Values
-
ovrTouch_RThumb
public static final int ovrTouch_RThumb
Touch RThumb- See Also:
- Constant Field Values
-
ovrTouch_RIndexTrigger
public static final int ovrTouch_RIndexTrigger
Touch RIndexTrigger- See Also:
- Constant Field Values
-
ovrTouch_RButtonMask
public static final int ovrTouch_RButtonMask
Bit mask of all the button touches on the right controller- See Also:
- Constant Field Values
-
ovrTouch_X
public static final int ovrTouch_X
Touch X- See Also:
- Constant Field Values
-
ovrTouch_Y
public static final int ovrTouch_Y
Touch Y- See Also:
- Constant Field Values
-
ovrTouch_LThumb
public static final int ovrTouch_LThumb
Touch LThumb- See Also:
- Constant Field Values
-
ovrTouch_LIndexTrigger
public static final int ovrTouch_LIndexTrigger
Touch LIndexTrigger- See Also:
- Constant Field Values
-
ovrTouch_LButtonMask
public static final int ovrTouch_LButtonMask
Bit mask of all the button touches on the left controller- See Also:
- Constant Field Values
-
ovrTouch_RIndexPointing
public static final int ovrTouch_RIndexPointing
TouchRIndexPointing- See Also:
- Constant Field Values
-
ovrTouch_RThumbUp
public static final int ovrTouch_RThumbUp
Touch RThumbUp- See Also:
- Constant Field Values
-
ovrTouch_RPoseMask
public static final int ovrTouch_RPoseMask
Bit mask of all right controller poses- See Also:
- Constant Field Values
-
ovrTouch_LIndexPointing
public static final int ovrTouch_LIndexPointing
Touch LIndexPointing- See Also:
- Constant Field Values
-
ovrTouch_LThumbUp
public static final int ovrTouch_LThumbUp
Touch LThumbUp- See Also:
- Constant Field Values
-
ovrTouch_LPoseMask
public static final int ovrTouch_LPoseMask
Bit mask of all left controller poses.- See Also:
- Constant Field Values
-
ovrControllerType_None
public static final int ovrControllerType_None
Which controller is connected; multiple can be connected at once. (ovrControllerType
)- See Also:
- Constant Field Values
-
ovrControllerType_LTouch
public static final int ovrControllerType_LTouch
Which controller is connected; multiple can be connected at once. (ovrControllerType
)- See Also:
- Constant Field Values
-
ovrControllerType_RTouch
public static final int ovrControllerType_RTouch
Which controller is connected; multiple can be connected at once. (ovrControllerType
)- See Also:
- Constant Field Values
-
ovrControllerType_Touch
public static final int ovrControllerType_Touch
Which controller is connected; multiple can be connected at once. (ovrControllerType
)- See Also:
- Constant Field Values
-
ovrControllerType_Remote
public static final int ovrControllerType_Remote
Which controller is connected; multiple can be connected at once. (ovrControllerType
)- See Also:
- Constant Field Values
-
ovrControllerType_XBox
public static final int ovrControllerType_XBox
Which controller is connected; multiple can be connected at once. (ovrControllerType
)- See Also:
- Constant Field Values
-
ovrControllerType_Active
public static final int ovrControllerType_Active
Operate on or query whichever controller is active.- See Also:
- Constant Field Values
-
ovrHand_Left
public static final int ovrHand_Left
Names for the left and right hand array indexes. (ovrHandType
)- See Also:
- Constant Field Values
-
ovrHand_Right
public static final int ovrHand_Right
Names for the left and right hand array indexes. (ovrHandType
)- See Also:
- Constant Field Values
-
ovrMaxLayerCount
public static final int ovrMaxLayerCount
Specifies the maximum number of layers supported bySubmitFrame
.- See Also:
- Constant Field Values
-
ovrLayerType_Disabled
public static final int ovrLayerType_Disabled
Layer is disabled.- See Also:
- Constant Field Values
-
ovrLayerType_EyeFov
public static final int ovrLayerType_EyeFov
Described byOVRLayerEyeFov
.- See Also:
- Constant Field Values
-
ovrLayerType_Quad
public static final int ovrLayerType_Quad
Described byOVRLayerQuad
.- See Also:
- Constant Field Values
-
ovrLayerType_EyeMatrix
public static final int ovrLayerType_EyeMatrix
Described byOVRLayerEyeMatrix
.- See Also:
- Constant Field Values
-
ovrLayerFlag_HighQuality
public static final int ovrLayerFlag_HighQuality
Enables 4x anisotropic sampling during the composition of the layer. The benefits are mostly visible at the periphery for high-frequency & high-contrast visuals. For best results consider combining this flag with anovrTextureSwapChain
that has mipmaps and instead of using arbitrary sized textures, prefer texture sizes that are powers-of-two. Actual rendered viewport and doesn't necessarily have to fill the whole texture.- See Also:
- Constant Field Values
-
ovrLayerFlag_TextureOriginAtBottomLeft
public static final int ovrLayerFlag_TextureOriginAtBottomLeft
the opposite is TopLeft. Generally this is false for D3D, true for OpenGL.- See Also:
- Constant Field Values
-
ovrLayerFlag_HeadLocked
public static final int ovrLayerFlag_HeadLocked
Mark this surface as "headlocked", which means it is specified relative to the HMD and moves with it, rather than being specified relative to sensor/torso space and remaining still while the head moves. What used to beovrLayerType_QuadHeadLocked
is nowLayerType_Quad
plus this flag. However the flag can be applied to any layer type to achieve a similar effect.- See Also:
- Constant Field Values
-
ovrPerfHud_Off
public static final int ovrPerfHud_Off
Turns off the performance HUD- See Also:
- Constant Field Values
-
ovrPerfHud_PerfSummary
public static final int ovrPerfHud_PerfSummary
Shows performance summary and headroom- See Also:
- Constant Field Values
-
ovrPerfHud_LatencyTiming
public static final int ovrPerfHud_LatencyTiming
Shows latency related timing info- See Also:
- Constant Field Values
-
ovrPerfHud_AppRenderTiming
public static final int ovrPerfHud_AppRenderTiming
Shows render timing info for application- See Also:
- Constant Field Values
-
ovrPerfHud_CompRenderTiming
public static final int ovrPerfHud_CompRenderTiming
Shows render timing info for OVR compositor- See Also:
- Constant Field Values
-
ovrPerfHud_VersionInfo
public static final int ovrPerfHud_VersionInfo
Shows SDK & HMD version Info- See Also:
- Constant Field Values
-
ovrLayerHud_Off
public static final int ovrLayerHud_Off
Turns off the layer HUD- See Also:
- Constant Field Values
-
ovrLayerHud_Info
public static final int ovrLayerHud_Info
Shows info about a specific layer- See Also:
- Constant Field Values
-
ovrDebugHudStereo_Off
public static final int ovrDebugHudStereo_Off
Visual properties of the stereo guide.- See Also:
- Constant Field Values
-
ovrDebugHudStereo_Quad
public static final int ovrDebugHudStereo_Quad
Visual properties of the stereo guide.- See Also:
- Constant Field Values
-
ovrDebugHudStereo_QuadWithCrosshair
public static final int ovrDebugHudStereo_QuadWithCrosshair
Visual properties of the stereo guide.- See Also:
- Constant Field Values
-
ovrDebugHudStereo_CrosshairAtInfinity
public static final int ovrDebugHudStereo_CrosshairAtInfinity
Visual properties of the stereo guide.- See Also:
- Constant Field Values
-
-
Method Detail
-
ovr_Initialize
public static int ovr_Initialize(OVRInitParams params)
Initialize LibOVR for application usage. This includes finding and loading the LibOVRRT shared library. No LibOVR API functions, other thanGetLastErrorInfo
and_Detect
, can be called unlessInitialize
succeeds. A successful call toovr_Initialize
must be eventually followed by a call toShutdown
.ovr_Initialize
calls are idempotent. Callingovr_Initialize
twice does not require two matching calls toovr_Shutdown
. If already initialized, the return value isSuccess
.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 directory
- Development directory (only if OVR_ENABLE_DEVELOPER_SEARCH is enabled, which is off by default).
- Standard OS shared library search location(s) (OS-specific).
- Parameters:
params
- anOVRInitParams
struct that cpecifies custom initialization options. May beNULL
to indicate default options.- Returns:
- an
ovrResult
indicating success or failure. In the case of failure, useGetLastErrorInfo
to get more information. Example failed results include:Error_Initialize
: Generic initialization error.Error_LibLoad
: Couldn't load LibOVRRT.Error_LibVersion
: LibOVRRT version incompatibility.Error_ServiceConnection
: Couldn't connect to the OVR Service.Error_ServiceVersion
: OVR Service version incompatibility.Error_IncompatibleOS
: The operating system version is incompatible.Error_DisplayInit
: Unable to initialize the HMD display.Error_ServerStart
: Unable to start the server. Is it already running?Error_Reinitialization
: Attempted to re-initialize with a different version.
-
ovr_Shutdown
public static void ovr_Shutdown()
Shuts down LibOVR.A successful call to
Initialize
must be eventually matched by a call toovr_Shutdown
. After callingovr_Shutdown
, no LibOVR functions can be called exceptGetLastErrorInfo
or anotherInitialize
.ovr_Shutdown
invalidates all pointers, references, and created objects previously returned by LibOVR functions. The LibOVRRT shared library can be unloaded byovr_Shutdown
.
-
ovr_GetLastErrorInfo
public static void ovr_GetLastErrorInfo(OVRErrorInfo errorInfo)
Returns information about the most recent failed return value by the current thread for this library.This function itself can never generate an error. The last error is never cleared by LibOVR, but will be overwritten by new errors. Do not use this call to determine if there was an error in the last API call as successful API calls don't clear the last
OVRErrorInfo
. To avoid any inconsistency,GetLastErrorInfo
should be called immediately after an API function that returned a failedovrResult
, with no other API functions called in the interim.- Parameters:
errorInfo
- The lastOVRErrorInfo
for the current thread
-
ovr_GetVersionString
public static java.lang.String ovr_GetVersionString()
Returns the version string representing the LibOVRRT version.The returned string pointer is valid until the next call to
Shutdown
.Note that the returned version string doesn't necessarily match the current OVR_MAJOR_VERSION, etc., as the returned string refers to the LibOVRRT shared library version and not the locally compiled interface version.
The format of this string is subject to change in future versions and its contents should not be interpreted.
- Returns:
- a UTF8-encoded null-terminated version string
-
ovr_TraceMessage
public static java.lang.String ovr_TraceMessage(int level, java.nio.ByteBuffer message)
Writes a message string to the LibOVR tracing mechanism (if enabled).This message will be passed back to the application via the
OVRLogCallback
if it was registered.- Parameters:
level
- anovrLogLevel
constant. One of:LogLevel_Debug
LogLevel_Info
LogLevel_Error
message
- a UTF8-encoded null-terminated string- Returns:
- the
strlen
of the message or a negative value if the message is too large
-
ovr_TraceMessage
public static java.lang.String ovr_TraceMessage(int level, java.lang.CharSequence message)
Writes a message string to the LibOVR tracing mechanism (if enabled).This message will be passed back to the application via the
OVRLogCallback
if it was registered.- Parameters:
level
- anovrLogLevel
constant. One of:LogLevel_Debug
LogLevel_Info
LogLevel_Error
message
- a UTF8-encoded null-terminated string- Returns:
- the
strlen
of the message or a negative value if the message is too large
-
ovr_GetHmdDesc
public static OVRHmdDesc ovr_GetHmdDesc(long session, OVRHmdDesc __result)
Returns information about the current HMD.Initialize
must have first been called in order for this to succeed, otherwise ovrHmdDesc::Type will be reported asHmd_None
.- Parameters:
session
- anovrSession
previously returned byCreate
, elseNULL
in which case this function detects whether an HMD is present and returns its info if so.__result
- anOVRHmdDesc
. If thehmd
isNULL
and ovrHmdDesc::Type isHmd_None
then no HMD is present.
-
ovr_GetTrackerCount
public static int ovr_GetTrackerCount(long session)
Returns the number of sensors.The number of sensors may change at any time, so this function should be called before use as opposed to once on startup.
- Parameters:
session
- anovrSession
previously returned byCreate
-
ovr_GetTrackerDesc
public static OVRTrackerDesc ovr_GetTrackerDesc(long session, int trackerDescIndex, OVRTrackerDesc __result)
Returns a given sensor description.It's possible that sensor
desc [0]
may indicate a unconnnected or non-pose tracked sensor, but sensordesc [1]
may be connected.Initialize
must have first been called in order for this to succeed, otherwise the returnedtrackerDescArray
will be zero-initialized. The data returned by this function can change at runtime.- Parameters:
session
- anovrSession
previously returned byCreate
trackerDescIndex
- a sensor index. The valid indexes are in the range of 0 to the sensor count returned byGetTrackerCount
.__result
- anOVRTrackerDesc
. An emptyOVRTrackerDesc
will be returned iftrackerDescIndex
is out of range.
-
ovr_Create
public static int ovr_Create(PointerBuffer pSession, OVRGraphicsLuid luid)
Creates a handle to a VR session.Upon success the returned
ovrSession
must be eventually freed withDestroy
when it is no longer needed. A second call toCreate
will result in an error return value if the previousHmd
has not been destroyed.- Parameters:
pSession
- a pointer to anovrSession
which will be written to upon successluid
- 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 returnedpHmd
will beNULL
.
-
ovr_Destroy
public static void ovr_Destroy(long session)
Destroys the HMD.- Parameters:
session
- anovrSession
previously returned byCreate
-
ovr_GetSessionStatus
public static int ovr_GetSessionStatus(long session, OVRSessionStatus sessionStatus)
Returns status information for the application.- Parameters:
session
- anovrSession
previously returned byCreate
sessionStatus
- anOVRSessionStatus
that is filled in
-
ovr_SetTrackingOriginType
public static int ovr_SetTrackingOriginType(long session, int origin)
Sets the tracking origin type.When the tracking origin is changed, all of the calls that either provide or accept ovrPosef will use the new tracking origin provided.
-
ovr_GetTrackingOriginType
public static int ovr_GetTrackingOriginType(long session)
Gets the tracking origin state.- Parameters:
session
- anovrSession
previously returned byCreate
-
ovr_RecenterTrackingOrigin
public static int ovr_RecenterTrackingOrigin(long session)
Re-centers the sensor position and orientation.This resets the (x,y,z) positional components and the yaw orientation component. The Roll and pitch orientation components are always determined by gravity and cannot be redefined. All future tracking will report values relative to this new reference position. If you are using
OVRTrackerPose
then you will need to callGetTrackerPose
after this, because the sensor position(s) will change as a result of this.The headset cannot be facing vertically upward or downward but rather must be roughly level otherwise this function will fail with
Error_InvalidHeadsetOrientation
.For more info, see the notes on each
ovrTrackingOrigin
enumeration to understand how recenter will vary slightly in its behavior based on the currentovrTrackingOrigin
setting.- Parameters:
session
- anovrSession
previously returned byCreate
-
ovr_ClearShouldRecenterFlag
public static void ovr_ClearShouldRecenterFlag(long session)
Clears the ShouldRecenter status bit in ovrSessionStatus.Clears the
ShouldRecenter
status bit inOVRSessionStatus
, allowing further recenter requests to be detected. Since this is automatically done byRecenterTrackingOrigin
, this is only needs to be called when application is doing its own re-centering.- Parameters:
session
- anovrSession
previously returned byCreate
-
ovr_GetTrackingState
public static OVRTrackingState ovr_GetTrackingState(long session, double absTime, boolean latencyMarker, OVRTrackingState __result)
Returns tracking state reading based on the specified absolute system time.Pass an
absTime
value of 0.0 to request the most recent sensor reading. In this case bothPredictedPose
andSamplePose
will have the same value.This may also be used for more refined timing of front buffer rendering logic, and so on.
This may be called by multiple threads.
- Parameters:
session
- anovrSession
previously returned byCreate
absTime
- the absolute future time to predict the returnOVRTrackingState
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 givenovrLayer
provides "SensorSampleTimestamp", that will override the value stored here.__result
- theOVRTrackingState
that is predicted for the givenabsTime
-
ovr_GetTrackerPose
public static OVRTrackerPose ovr_GetTrackerPose(long session, int trackerPoseIndex, OVRTrackerPose __result)
Returns theOVRTrackerPose
for the given sensor.- Parameters:
session
- anovrSession
previously returned byCreate
trackerPoseIndex
- index of the sensor being requested.
-
ovr_GetInputState
public static int ovr_GetInputState(long session, int controllerType, OVRInputState inputState)
Returns the most recent input state for controllers, without positional tracking info. Developers can tell whether the same state was returned by checking thePacketNumber
.
-
ovr_GetConnectedControllerTypes
public static int ovr_GetConnectedControllerTypes(long session)
Returns controller types connected to the system OR'ed together.- Parameters:
session
- anovrSession
previously returned byCreate
-
ovr_SetControllerVibration
public static int ovr_SetControllerVibration(long session, int controllerType, float frequency, float amplitude)
Turns on vibration of the given controller.To disable vibration, call
SetControllerVibration
with an amplitude of 0. Vibration automatically stops after a nominal amount of time, so if you want vibration to be continuous over multiple seconds then you need to call this function periodically.- Parameters:
session
- anovrSession
previously returned byCreate
controllerType
- the controller to apply the vibration tofrequency
- a vibration frequency in the range of 0.0 to 1.0. Currently the only valid values are 0.0, 0.5, and 1.0 and other values will be clamped to one of these.amplitude
- a vibration amplitude in the range of 0.0 to 1.0.- Returns:
Success
upon success
-
ovr_GetTextureSwapChainLength
public static int ovr_GetTextureSwapChainLength(long session, long chain, java.nio.IntBuffer out_Length)
Gets the number of buffers in anovrTextureSwapChain
.- Parameters:
session
- anovrSession
previously returned byCreate
chain
- theovrTextureSwapChain
for which the length should be retrievedout_Length
- returns the number of buffers in the specified chain
-
ovr_GetTextureSwapChainCurrentIndex
public static int ovr_GetTextureSwapChainCurrentIndex(long session, long chain, java.nio.IntBuffer out_Index)
Gets the current index in anovrTextureSwapChain
.- Parameters:
session
- anovrSession
previously returned byCreate
chain
- theovrTextureSwapChain
for which the index should be retrievedout_Index
- returns the current (free) index in specified chain
-
ovr_GetTextureSwapChainDesc
public static int ovr_GetTextureSwapChainDesc(long session, long chain, OVRTextureSwapChainDesc out_Desc)
Gets the description of the buffers in anovrTextureSwapChain
.- Parameters:
session
- anovrSession
previously returned byCreate
chain
- theovrTextureSwapChain
for which the description should be retrievedout_Desc
- returns the description of the specified chain
-
ovr_CommitTextureSwapChain
public static int ovr_CommitTextureSwapChain(long session, long chain)
Commits any pending changes to anovrTextureSwapChain
, and advances its current index.When Commit is called, the texture at the current index is considered ready for use by the runtime, and further writes to it should be avoided. The swap chain's current index is advanced, providing there's room in the chain. The next time the SDK dereferences this texture swap chain, it will synchronize with the app's graphics context and pick up the submitted index, opening up room in the swap chain for further commits.
- Parameters:
session
- anovrSession
previously returned byCreate
chain
- theovrTextureSwapChain
to commit
-
ovr_DestroyTextureSwapChain
public static void ovr_DestroyTextureSwapChain(long session, long chain)
Destroys anovrTextureSwapChain
and frees all the resources associated with it.- Parameters:
session
- anovrSession
previously returned byCreate
chain
- theovrTextureSwapChain
to destroy. If it isNULL
then this function has no effect.
-
ovr_DestroyMirrorTexture
public static void ovr_DestroyMirrorTexture(long session, long mirrorTexture)
Destroys a mirror texture previously created by one of the mirror texture creation functions.- Parameters:
session
- anovrSession
previously returned byCreate
mirrorTexture
- theovrTexture
to destroy. If it isNULL
then this function has no effect.
-
ovr_GetFovTextureSize
public static OVRSizei ovr_GetFovTextureSize(long session, int eye, OVRFovPort fov, float pixelsPerDisplayPixel, OVRSizei __result)
Calculates the recommended viewport size for rendering a given eye within the HMD with a given FOV cone.Higher FOV will generally require larger textures to maintain quality. Apps packing multiple eye views together on the same texture should ensure there are at least 8 pixels of padding between them to prevent texture filtering and chromatic aberration causing images to leak between the two eye views.
Example code:
ovrHmdDesc hmdDesc = ovr_GetHmdDesc(session); ovrSizei eyeSizeLeft = ovr_GetFovTextureSize(session, ovrEye_Left, hmdDesc.DefaultEyeFov[ovrEye_Left], 1.0f); ovrSizei eyeSizeRight = ovr_GetFovTextureSize(session, ovrEye_Right, hmdDesc.DefaultEyeFov[ovrEye_Right], 1.0f);
- Parameters:
session
- anovrSession
previously returned byCreate
eye
- which eye (left or right) to calculate for. One of:Eye_Left
Eye_Right
fov
- theOVRFovPort
to usepixelsPerDisplayPixel
- the ratio of the number of render target pixels to display pixels at the center of distortion. 1.0 is the default value. Lower values can improve performance, higher values give improved quality.__result
- the texture width and height size
-
ovr_GetRenderDesc
public static OVREyeRenderDesc ovr_GetRenderDesc(long session, int eyeType, OVRFovPort fov, OVREyeRenderDesc __result)
Computes the distortion viewport, view adjust, and other rendering parameters for the specified eye.- Parameters:
session
- anovrSession
previously returned byCreate
eyeType
- which eye (left or right) for which to perform calculations. One of:Eye_Left
Eye_Right
fov
- theOVRFovPort
to use.__result
- the computedOVREyeRenderDesc
for the giveneyeType
and field of view
-
ovr_SubmitFrame
public static int ovr_SubmitFrame(long session, long frameIndex, OVRViewScaleDesc viewScaleDesc, PointerBuffer layerPtrList)
Submits layers for distortion and display.ovr_SubmitFrame
triggers distortion and processing which might happen asynchronously. The function will return when there is room in the submission queue and surfaces are available. Distortion might or might not have completed.- Layers are drawn in the order they are specified in the array, regardless of the layer type.
- Layers are not remembered between successive calls to
ovr_SubmitFrame
. A layer must be specified in every call toovr_SubmitFrame
or it won't be displayed. - If a
layerPtrList
entry that was specified in a previous call toovr_SubmitFrame
is passed asNULL
or is of typeLayerType_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. NolayerPtrList
entry may be duplicated (i.e. the same pointer as an earlier entry).
Example code
ovrLayerEyeFov layer0; ovrLayerQuad layer1; ... ovrLayerHeader* layers[2] = { &layer0.Header, &layer1.Header }; ovrResult result = ovr_SubmitFrame(hmd, frameIndex, nullptr, layers, 2);
- Parameters:
session
- anovrSession
previously returned byCreate
frameIndex
- the targeted application frame index, or 0 to refer to one frame after the last timeSubmitFrame
was calledviewScaleDesc
- provides additional information needed only iflayerPtrList
contains anLayerType_Quad
. IfNULL
, a default version is used based on the current configuration and a 1.0 world scale.layerPtrList
- a list ofovrLayer
pointers, which can includeNULL
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 asOVRLayerEyeFov
orOVRLayerQuad
, withHeader.Type
identifying its type. ANULL
layerPtrList
entry in the array indicates the absence of the given layer.- Returns:
- an
ovrResult
for whichOVR_SUCCESS(result)
is false upon error and true upon one of the possible success values:Success
: rendering completed successfully.Success_NotVisible
: rendering completed successfully but was not displayed on the HMD, usually because another application currently has ownership of the HMD. Applications receiving this result should stop rendering new content, but continue to callovr_SubmitFrame
periodically until it returns a value other thanSuccess_NotVisible
.Error_DisplayLost
: The session has become invalid (such as due to a device removal) and the shared resources need to be released (DestroyTextureSwapChain
), the session needs to destroyed (Destroy
) and recreated (Create
), and new resources need to be created (ovr_CreateTextureSwapChainXXX
). The application's existing private graphics resources do not need to be recreated unless the newovr_Create
call returns a differentGraphicsLuid
.Error_TextureSwapChainInvalid
: TheovrTextureSwapChain
is in an incomplete or inconsistent state. EnsureCommitTextureSwapChain
was called at least once first.
-
ovr_GetPredictedDisplayTime
public static double ovr_GetPredictedDisplayTime(long session, long frameIndex)
Gets the time of the specified frame midpoint.Predicts the time at which the given frame will be displayed. The predicted time is the middle of the time period during which the corresponding eye images will be displayed.
The application should increment frameIndex for each successively targeted frame, and pass that index to any relevent OVR functions that need to apply to the frame identified by that index.
This function is thread-safe and allows for multiple application threads to target their processing to the same displayed frame.
In the event that prediction fails due to various reasons (e.g. the display being off or app has yet to present any frames), the return value will be current CPU time.
- Parameters:
session
- anovrSession
previously returned byCreate
frameIndex
- the frame the caller wishes to target. A value of zero returns the next frame index.- Returns:
- the absolute frame midpoint time for the given
frameIndex
-
ovr_GetTimeInSeconds
public static double ovr_GetTimeInSeconds()
Returns global, absolute high-resolution time in seconds.The time frame of reference for this function is not specified and should not be depended upon.
- Returns:
- seconds as a floating point value
-
ovr_GetBool
public static boolean ovr_GetBool(long session, java.nio.ByteBuffer propertyName, boolean defaultVal)
Reads a boolean property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid for only the calldefaultVal
- specifes the value to return if the property couldn't be read- Returns:
- the property interpreted as a boolean value. Returns
defaultVal
if the property doesn't exist.
-
ovr_GetBool
public static boolean ovr_GetBool(long session, java.lang.CharSequence propertyName, boolean defaultVal)
Reads a boolean property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid for only the calldefaultVal
- specifes the value to return if the property couldn't be read- Returns:
- the property interpreted as a boolean value. Returns
defaultVal
if the property doesn't exist.
-
ovr_SetBool
public static boolean ovr_SetBool(long session, java.nio.ByteBuffer propertyName, boolean value)
Writes or creates a boolean property.If the property wasn't previously a boolean property, it is changed to a boolean property.
- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalue
- the value to write- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_SetBool
public static boolean ovr_SetBool(long session, java.lang.CharSequence propertyName, boolean value)
Writes or creates a boolean property.If the property wasn't previously a boolean property, it is changed to a boolean property.
- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalue
- the value to write- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_GetInt
public static int ovr_GetInt(long session, java.nio.ByteBuffer propertyName, int defaultVal)
Reads an integer property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the calldefaultVal
- specifes the value to return if the property couldn't be read- Returns:
- the property interpreted as an integer value. Returns
defaultVal
if the property doesn't exist.
-
ovr_GetInt
public static int ovr_GetInt(long session, java.lang.CharSequence propertyName, int defaultVal)
Reads an integer property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the calldefaultVal
- specifes the value to return if the property couldn't be read- Returns:
- the property interpreted as an integer value. Returns
defaultVal
if the property doesn't exist.
-
ovr_SetInt
public static boolean ovr_SetInt(long session, java.nio.ByteBuffer propertyName, int value)
Writes or creates an integer property.If the property wasn't previously an integer property, it is changed to an integer property.
- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalue
- the value to write- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_SetInt
public static boolean ovr_SetInt(long session, java.lang.CharSequence propertyName, int value)
Writes or creates an integer property.If the property wasn't previously an integer property, it is changed to an integer property.
- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalue
- the value to write- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_GetFloat
public static float ovr_GetFloat(long session, java.nio.ByteBuffer propertyName, float defaultVal)
Reads a float property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the calldefaultVal
- specifes the value to return if the property couldn't be read- Returns:
- the property interpreted as a float value. Returns
defaultVal
if the property doesn't exist.
-
ovr_GetFloat
public static float ovr_GetFloat(long session, java.lang.CharSequence propertyName, float defaultVal)
Reads a float property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the calldefaultVal
- specifes the value to return if the property couldn't be read- Returns:
- the property interpreted as a float value. Returns
defaultVal
if the property doesn't exist.
-
ovr_SetFloat
public static boolean ovr_SetFloat(long session, java.nio.ByteBuffer propertyName, float value)
Writes or creates a float property.If the property wasn't previously a float property, it's changed to a float property.
- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalue
- the value to write- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_SetFloat
public static boolean ovr_SetFloat(long session, java.lang.CharSequence propertyName, float value)
Writes or creates a float property.If the property wasn't previously a float property, it's changed to a float property.
- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalue
- the value to write- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_GetFloatArray
public static int ovr_GetFloatArray(long session, java.nio.ByteBuffer propertyName, java.nio.FloatBuffer values)
Reads a float array property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalues
- an array of float to write to- Returns:
- the number of elements read, or 0 if property doesn't exist or is empty
-
ovr_GetFloatArray
public static int ovr_GetFloatArray(long session, java.lang.CharSequence propertyName, java.nio.FloatBuffer values)
Reads a float array property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalues
- an array of float to write to- Returns:
- the number of elements read, or 0 if property doesn't exist or is empty
-
ovr_SetFloatArray
public static boolean ovr_SetFloatArray(long session, java.nio.ByteBuffer propertyName, java.nio.FloatBuffer values)
Writes or creates a float array property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalues
- an array of float to write from- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_SetFloatArray
public static boolean ovr_SetFloatArray(long session, java.lang.CharSequence propertyName, java.nio.FloatBuffer values)
Writes or creates a float array property.- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalues
- an array of float to write from- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_GetString
public static java.lang.String ovr_GetString(long session, java.nio.ByteBuffer propertyName, java.nio.ByteBuffer defaultVal)
Reads a string property.Strings are UTF8-encoded and null-terminated.
- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the calldefaultVal
- 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 asNULL
. The return memory is guaranteed to be valid until next call toovr_GetString
or until the HMD is destroyed, whichever occurs first.
-
ovr_GetString
public static java.lang.String ovr_GetString(long session, java.lang.CharSequence propertyName, java.lang.CharSequence defaultVal)
Reads a string property.Strings are UTF8-encoded and null-terminated.
- Parameters:
session
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the calldefaultVal
- 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 asNULL
. The return memory is guaranteed to be valid until next call toovr_GetString
or until the HMD is destroyed, whichever occurs first.
-
ovr_SetString
public static boolean ovr_SetString(long hmddesc, java.nio.ByteBuffer propertyName, java.nio.ByteBuffer value)
Writes or creates a string property.Strings are UTF8-encoded and null-terminated.
- Parameters:
hmddesc
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalue
- the string property, which only needs to be valid for the duration of the call- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_SetString
public static boolean ovr_SetString(long hmddesc, java.lang.CharSequence propertyName, java.lang.CharSequence value)
Writes or creates a string property.Strings are UTF8-encoded and null-terminated.
- Parameters:
hmddesc
- anovrSession
previously returned byCreate
propertyName
- the name of the property, which needs to be valid only for the callvalue
- the string property, which only needs to be valid for the duration of the call- Returns:
- true if successful, otherwise false. A false result should only occur if the property name is empty or if the property is read-only.
-
ovr_GetTextureSwapChainLength
public static int ovr_GetTextureSwapChainLength(long session, long chain, int[] out_Length)
Array version of:GetTextureSwapChainLength
-
ovr_GetTextureSwapChainCurrentIndex
public static int ovr_GetTextureSwapChainCurrentIndex(long session, long chain, int[] out_Index)
Array version of:GetTextureSwapChainCurrentIndex
-
ovr_GetFloatArray
public static int ovr_GetFloatArray(long session, java.nio.ByteBuffer propertyName, float[] values)
Array version of:GetFloatArray
-
ovr_GetFloatArray
public static int ovr_GetFloatArray(long session, java.lang.CharSequence propertyName, float[] values)
Array version of:GetFloatArray
-
ovr_SetFloatArray
public static boolean ovr_SetFloatArray(long session, java.nio.ByteBuffer propertyName, float[] values)
Array version of:SetFloatArray
-
ovr_SetFloatArray
public static boolean ovr_SetFloatArray(long session, java.lang.CharSequence propertyName, float[] values)
Array version of:SetFloatArray
-
-