Top Description Fields Constructors Methods
org.lwjgl.ovr

public Class OVRUtil

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.system.*

Native bindings to the libOVR utility functions.

Field Summary

Modifier and TypeField and Description
public static final int
ovrHapticsGenMode_Count

Modes used to generate Touch Haptics from audio PCM buffer.

public static final int
ovrHapticsGenMode_PointSample

Modes used to generate Touch Haptics from audio PCM buffer.

public static final int
ovrProjection_ClipRangeOpenGL

Enumerates modifications to the projection matrix based on the application's needs.

public static final int
ovrProjection_FarClipAtInfinity

Enumerates modifications to the projection matrix based on the application's needs.

public static final int
ovrProjection_FarLessThanNear

Enumerates modifications to the projection matrix based on the application's needs.

public static final int
ovrProjection_LeftHanded

Enumerates modifications to the projection matrix based on the application's needs.

public static final int
ovrProjection_None

Enumerates modifications to the projection matrix based on the application's needs.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static native void
novr_CalcEyePoses(long headPose, long HmdToEyePose, long outEyePoses)

Unsafe version of: _CalcEyePoses

public static native void
novr_Detect(int timeoutMilliseconds, long __result)

Unsafe version of: _Detect

public static native int
novr_GenHapticsFromAudioData(long outHapticsClip, long audioChannel, int genMode)

Unsafe version of: _GenHapticsFromAudioData

public static native void
novr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, long HmdToEyePose, long outEyePoses, long outSensorSampleTime)

Unsafe version of: _GetEyePoses

public static native void
novr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, long HmdToEyePose, long outEyePoses, double[] outSensorSampleTime)

Array version of: novr_GetEyePoses

public static native int
novr_ReadWavFromBuffer(long outAudioChannel, long inputData, int
size of the buffer in bytes
dataSizeInBytes
,
int stereoChannelToUse)

Unsafe version of: _ReadWavFromBuffer

public static native void
novr_ReleaseAudioChannelData(long audioChannel)

Unsafe version of: _ReleaseAudioChannelData

public static native void
novr_ReleaseHapticsClip(long hapticsClip)

Unsafe version of: _ReleaseHapticsClip

public static native void
novrMatrix4f_OrthoSubProjection(long projection, long orthoScale, float orthoDistance, float HmdToEyeOffsetX, long __result)

Unsafe version of: Matrix4f_OrthoSubProjection

public static native void
novrMatrix4f_Projection(long fov, float znear, float zfar, int projectionModFlags, long __result)

Unsafe version of: Matrix4f_Projection

public static native void
novrPosef_FlipHandedness(long inPose, long outPose)

Unsafe version of: Posef_FlipHandedness

public static native void
novrTimewarpProjectionDesc_FromProjection(long projection, int projectionModFlags, long __result)

Unsafe version of: TimewarpProjectionDesc_FromProjection

public static void
ovr_CalcEyePoses(OVRPosef
indicates the HMD position and orientation to use for the calculation
headPose
,
OVRPosef.Buffer
can be OVREyeRenderDesc.HmdToEyePose returned from GetRenderDesc. For monoscopic rendering, use a position vector that is average of the two position vectors for each eye .
HmdToEyePose
,
OVRPosef.Buffer
if outEyePoses are used for rendering, they should be passed to SubmitFrame in OVRLayerEyeFov::RenderPose or OVRLayerEyeFovDepth::RenderPose
outEyePoses
)

Computes offset eye poses based on headPose returned by OVRTrackingState.

public static OVRDetectResult
ovr_Detect(int
a timeout to wait for HMD to be attached or 0 to poll
timeoutMilliseconds
,
OVRDetectResult __result)

Detects Oculus Runtime and Device Status.

public static int
ovr_GenHapticsFromAudioData(OVRHapticsClip
generated Haptics clip
outHapticsClip
,
OVRAudioChannelData
input audio channel data
audioChannel
,
int
mode used to convert and audio channel data to Haptics data. Must be:
HapticsGenMode_PointSample
genMode
)

Generates playable Touch Haptics data from an audio channel.

public static void
ovr_GetEyePoses(long
an ovrSession previously returned by Create
session
,
long
the targeted frame index, or 0 to refer to one frame after the last time SubmitFrame was called
frameIndex
,
boolean
Specifies that this call is the point in time where the "App-to-Mid-Photon" latency timer starts from. If a given ovrLayer provides "SensorSampleTimestamp", that will override the value stored here.
latencyMarker
,
OVRPosef.Buffer
can be OVREyeRenderDesc.HmdToEyePose returned from GetRenderDesc. For monoscopic rendering, use a position vector that is the average of the two position vectors for each eye.
HmdToEyePose
,
OVRPosef.Buffer
the predicted eye poses
outEyePoses
,
DoubleBuffer
the time when this function was called. May be NULL, in which case it is ignored.
outSensorSampleTime
)

Returns the predicted head pose in outHmdTrackingState and offset eye poses in outEyePoses.

public static void
ovr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses, double[] outSensorSampleTime)

Array version of: _GetEyePoses

public static int
ovr_ReadWavFromBuffer(OVRAudioChannelData
output audio channel data
outAudioChannel
,
ByteBuffer
a binary buffer representing a valid Wav file data
inputData
,
int
audio channel index to extract (0 for mono)
stereoChannelToUse
)

Reads an audio channel from Wav (Waveform Audio File) data.

public static void
ovr_ReleaseAudioChannelData(OVRAudioChannelData
pointer to an audio channel
audioChannel
)

Releases memory allocated for ovrAudioChannelData.

public static void
ovr_ReleaseHapticsClip(OVRHapticsClip
pointer to a haptics clip
hapticsClip
)

Releases memory allocated for ovrHapticsClip.

public static OVRMatrix4f
ovrMatrix4f_OrthoSubProjection(OVRMatrix4f
the perspective matrix that the orthographic matrix is derived from
projection
,
OVRVector2f
equal to 1.0f / pixelsPerTanAngleAtCenter
orthoScale
,
float
equal to the distance from the camera in meters, such as 0.8m
orthoDistance
,
float
the offset of the eye from the center
HmdToEyeOffsetX
,
OVRMatrix4f
the calculated projection matrix
__result
)

Generates an orthographic sub-projection.

public static OVRMatrix4f
ovrMatrix4f_Projection(OVRFovPort
the OVRFovPort to use
fov
,
float
distance to near Z limit
znear
,
float
distance to far Z limit
zfar
,
int
a combination of the ovrProjectionModifier flags. One or more of:
Projection_NoneProjection_FarLessThanNearProjection_FarClipAtInfinity
Projection_ClipRangeOpenGL
projectionModFlags
,
OVRMatrix4f
the calculated projection matrix
__result
)

Used to generate projection from ovrEyeDesc::Fov.

public static void
ovrPosef_FlipHandedness(OVRPosef
a pose that is right-handed
inPose
,
OVRPosef
the pose that is requested to be left-handed (can be the same pointer to inPose)
outPose
)

Tracking poses provided by the SDK come in a right-handed coordinate system.

public static OVRTimewarpProjectionDesc
ovrTimewarpProjectionDesc_FromProjection(OVRMatrix4f
the project matrix from which to extract OVRTimewarpProjectionDesc
projection
,
int projectionModFlags, OVRTimewarpProjectionDesc
the extracted ovrTimewarpProjectionDesc
__result
)

Extracts the required data from the result of Matrix4f_Projection.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ovrHapticsGenMode_Countback to summary
public static final int ovrHapticsGenMode_Count

Modes used to generate Touch Haptics from audio PCM buffer.

Enum values:
ovrHapticsGenMode_PointSampleback to summary
public static final int ovrHapticsGenMode_PointSample

Modes used to generate Touch Haptics from audio PCM buffer.

Enum values:
ovrProjection_ClipRangeOpenGLback to summary
public static final int ovrProjection_ClipRangeOpenGL

Enumerates modifications to the projection matrix based on the application's needs.

Enum values:
  • Projection_None - Use for generating a default projection matrix that is:
    • Right-handed.
    • Near depth values stored in the depth buffer are smaller than far depth values.
    • Both near and far are explicitly defined.
    • With a clipping range that is (0 to w).
  • Projection_LeftHanded - Enable if using left-handed transformations in your application.
  • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
  • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
  • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
ovrProjection_FarClipAtInfinityback to summary
public static final int ovrProjection_FarClipAtInfinity

Enumerates modifications to the projection matrix based on the application's needs.

Enum values:
  • Projection_None - Use for generating a default projection matrix that is:
    • Right-handed.
    • Near depth values stored in the depth buffer are smaller than far depth values.
    • Both near and far are explicitly defined.
    • With a clipping range that is (0 to w).
  • Projection_LeftHanded - Enable if using left-handed transformations in your application.
  • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
  • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
  • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
ovrProjection_FarLessThanNearback to summary
public static final int ovrProjection_FarLessThanNear

Enumerates modifications to the projection matrix based on the application's needs.

Enum values:
  • Projection_None - Use for generating a default projection matrix that is:
    • Right-handed.
    • Near depth values stored in the depth buffer are smaller than far depth values.
    • Both near and far are explicitly defined.
    • With a clipping range that is (0 to w).
  • Projection_LeftHanded - Enable if using left-handed transformations in your application.
  • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
  • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
  • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
ovrProjection_LeftHandedback to summary
public static final int ovrProjection_LeftHanded

Enumerates modifications to the projection matrix based on the application's needs.

Enum values:
  • Projection_None - Use for generating a default projection matrix that is:
    • Right-handed.
    • Near depth values stored in the depth buffer are smaller than far depth values.
    • Both near and far are explicitly defined.
    • With a clipping range that is (0 to w).
  • Projection_LeftHanded - Enable if using left-handed transformations in your application.
  • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
  • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
  • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
ovrProjection_Noneback to summary
public static final int ovrProjection_None

Enumerates modifications to the projection matrix based on the application's needs.

Enum values:
  • Projection_None - Use for generating a default projection matrix that is:
    • Right-handed.
    • Near depth values stored in the depth buffer are smaller than far depth values.
    • Both near and far are explicitly defined.
    • With a clipping range that is (0 to w).
  • Projection_LeftHanded - Enable if using left-handed transformations in your application.
  • Projection_FarLessThanNear - After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
  • Projection_FarClipAtInfinity - When this flag is used, the zfar value pushed into Matrix4f_Projection will be ignored NOTE: Enable only if Projection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
  • Projection_ClipRangeOpenGL - Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.

Constructor Detail

OVRUtilback to summary
protected OVRUtil()

Method Detail

novr_CalcEyePosesback to summary
public static native void novr_CalcEyePoses(long headPose, long HmdToEyePose, long outEyePoses)

Unsafe version of: _CalcEyePoses

novr_Detectback to summary
public static native void novr_Detect(int timeoutMilliseconds, long __result)

Unsafe version of: _Detect

novr_GenHapticsFromAudioDataback to summary
public static native int novr_GenHapticsFromAudioData(long outHapticsClip, long audioChannel, int genMode)

Unsafe version of: _GenHapticsFromAudioData

novr_GetEyePosesback to summary
public static native void novr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, long HmdToEyePose, long outEyePoses, long outSensorSampleTime)

Unsafe version of: _GetEyePoses

novr_GetEyePosesback to summary
public static native void novr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, long HmdToEyePose, long outEyePoses, double[] outSensorSampleTime)

Array version of: novr_GetEyePoses

novr_ReadWavFromBufferback to summary
public static native int novr_ReadWavFromBuffer(long outAudioChannel, long inputData, int dataSizeInBytes, int stereoChannelToUse)

Unsafe version of: _ReadWavFromBuffer

Parameters
dataSizeInBytes:int

size of the buffer in bytes

novr_ReleaseAudioChannelDataback to summary
public static native void novr_ReleaseAudioChannelData(long audioChannel)

Unsafe version of: _ReleaseAudioChannelData

novr_ReleaseHapticsClipback to summary
public static native void novr_ReleaseHapticsClip(long hapticsClip)

Unsafe version of: _ReleaseHapticsClip

novrMatrix4f_OrthoSubProjectionback to summary
public static native void novrMatrix4f_OrthoSubProjection(long projection, long orthoScale, float orthoDistance, float HmdToEyeOffsetX, long __result)

Unsafe version of: Matrix4f_OrthoSubProjection

novrMatrix4f_Projectionback to summary
public static native void novrMatrix4f_Projection(long fov, float znear, float zfar, int projectionModFlags, long __result)

Unsafe version of: Matrix4f_Projection

novrPosef_FlipHandednessback to summary
public static native void novrPosef_FlipHandedness(long inPose, long outPose)

Unsafe version of: Posef_FlipHandedness

novrTimewarpProjectionDesc_FromProjectionback to summary
public static native void novrTimewarpProjectionDesc_FromProjection(long projection, int projectionModFlags, long __result)

Unsafe version of: TimewarpProjectionDesc_FromProjection

ovr_CalcEyePosesback to summary
public static void ovr_CalcEyePoses(OVRPosef headPose, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses)

Computes offset eye poses based on headPose returned by OVRTrackingState.

Parameters
headPose:OVRPosef

indicates the HMD position and orientation to use for the calculation

HmdToEyePose:OVRPosef.Buffer

can be OVREyeRenderDesc.HmdToEyePose returned from GetRenderDesc. For monoscopic rendering, use a position vector that is average of the two position vectors for each eye .

outEyePoses:OVRPosef.Buffer

if outEyePoses are used for rendering, they should be passed to SubmitFrame in OVRLayerEyeFov::RenderPose or OVRLayerEyeFovDepth::RenderPose

ovr_Detectback to summary
public static OVRDetectResult ovr_Detect(int timeoutMilliseconds, OVRDetectResult __result)

Detects Oculus Runtime and Device Status.

Checks for Oculus Runtime and Oculus HMD device status without loading the LibOVRRT shared library. This may be called before Initialize to help decide whether or not to initialize LibOVR.

Parameters
timeoutMilliseconds:int

a timeout to wait for HMD to be attached or 0 to poll

Annotations
@NativeType:ovrDetectResult
ovr_GenHapticsFromAudioDataback to summary
public static int ovr_GenHapticsFromAudioData(OVRHapticsClip outHapticsClip, OVRAudioChannelData audioChannel, int genMode)

Generates playable Touch Haptics data from an audio channel.

Parameters
outHapticsClip:OVRHapticsClip

generated Haptics clip

audioChannel:OVRAudioChannelData

input audio channel data

genMode:int

mode used to convert and audio channel data to Haptics data. Must be:

HapticsGenMode_PointSample
Annotations
@NativeType:ovrResult
ovr_GetEyePosesback to summary
public static void ovr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses, DoubleBuffer outSensorSampleTime)

Returns the predicted head pose in outHmdTrackingState and offset eye poses in outEyePoses.

This is a thread-safe function where caller should increment frameIndex with every frame and pass that index where applicable to functions called on the rendering thread. Assuming outEyePoses are used for rendering, it should be passed as a part of OVRLayerEyeFov. The caller does not need to worry about applying HmdToEyePose to the returned outEyePoses variables.

Parameters
session:long

an ovrSession previously returned by Create

frameIndex:long

the targeted frame index, or 0 to refer to one frame after the last time SubmitFrame was called

latencyMarker:boolean

Specifies that this call is the point in time where the "App-to-Mid-Photon" latency timer starts from. If a given ovrLayer provides "SensorSampleTimestamp", that will override the value stored here.

HmdToEyePose:OVRPosef.Buffer

can be OVREyeRenderDesc.HmdToEyePose returned from GetRenderDesc. For monoscopic rendering, use a position vector that is the average of the two position vectors for each eye.

outEyePoses:OVRPosef.Buffer

the predicted eye poses

outSensorSampleTime:DoubleBuffer

the time when this function was called. May be NULL, in which case it is ignored.

ovr_GetEyePosesback to summary
public static void ovr_GetEyePoses(long session, long frameIndex, boolean latencyMarker, OVRPosef.Buffer HmdToEyePose, OVRPosef.Buffer outEyePoses, double[] outSensorSampleTime)

Array version of: _GetEyePoses

ovr_ReadWavFromBufferback to summary
public static int ovr_ReadWavFromBuffer(OVRAudioChannelData outAudioChannel, ByteBuffer inputData, int stereoChannelToUse)

Reads an audio channel from Wav (Waveform Audio File) data.

Input must be a byte buffer representing a valid Wav file. Audio samples from the specified channel are read, converted to float [-1.0f, 1.0f] and returned through OVRAudioChannelData.

Supported formats: PCM 8b, 16b, 32b and IEEE float (little-endian only).

Parameters
outAudioChannel:OVRAudioChannelData

output audio channel data

inputData:ByteBuffer

a binary buffer representing a valid Wav file data

stereoChannelToUse:int

audio channel index to extract (0 for mono)

Annotations
@NativeType:ovrResult
ovr_ReleaseAudioChannelDataback to summary
public static void ovr_ReleaseAudioChannelData(OVRAudioChannelData audioChannel)

Releases memory allocated for ovrAudioChannelData. Must be called to avoid memory leak.

Parameters
audioChannel:OVRAudioChannelData

pointer to an audio channel

ovr_ReleaseHapticsClipback to summary
public static void ovr_ReleaseHapticsClip(OVRHapticsClip hapticsClip)

Releases memory allocated for ovrHapticsClip. Must be called to avoid memory leak.

Parameters
hapticsClip:OVRHapticsClip

pointer to a haptics clip

ovrMatrix4f_OrthoSubProjectionback to summary
public static OVRMatrix4f ovrMatrix4f_OrthoSubProjection(OVRMatrix4f projection, OVRVector2f orthoScale, float orthoDistance, float HmdToEyeOffsetX, OVRMatrix4f __result)

Generates an orthographic sub-projection.

Used for 2D rendering, Y is down.

Parameters
projection:OVRMatrix4f

the perspective matrix that the orthographic matrix is derived from

orthoScale:OVRVector2f

equal to 1.0f / pixelsPerTanAngleAtCenter

orthoDistance:float

equal to the distance from the camera in meters, such as 0.8m

HmdToEyeOffsetX:float

the offset of the eye from the center

__result:OVRMatrix4f

the calculated projection matrix

Annotations
@NativeType:ovrMatrix4f
ovrMatrix4f_Projectionback to summary
public static OVRMatrix4f ovrMatrix4f_Projection(OVRFovPort fov, float znear, float zfar, int projectionModFlags, OVRMatrix4f __result)

Used to generate projection from ovrEyeDesc::Fov.

Parameters
fov:OVRFovPort

the OVRFovPort to use

znear:float

distance to near Z limit

zfar:float

distance to far Z limit

projectionModFlags:int

a combination of the ovrProjectionModifier flags. One or more of:

Projection_NoneProjection_FarLessThanNearProjection_FarClipAtInfinity
Projection_ClipRangeOpenGL
__result:OVRMatrix4f

the calculated projection matrix

Annotations
@NativeType:ovrMatrix4f
ovrPosef_FlipHandednessback to summary
public static void ovrPosef_FlipHandedness(OVRPosef inPose, OVRPosef outPose)

Tracking poses provided by the SDK come in a right-handed coordinate system. If an application is passing in Projection_LeftHanded into Matrix4f_Projection, then it should also use this function to flip the HMD tracking poses to be left-handed.

While this utility function is intended to convert a left-handed OVRPosef into a right-handed coordinate system, it will also work for converting right-handed to left-handed since the flip operation is the same for both cases.

Parameters
inPose:OVRPosef

a pose that is right-handed

outPose:OVRPosef

the pose that is requested to be left-handed (can be the same pointer to inPose)

ovrTimewarpProjectionDesc_FromProjectionback to summary
public static OVRTimewarpProjectionDesc ovrTimewarpProjectionDesc_FromProjection(OVRMatrix4f projection, int projectionModFlags, OVRTimewarpProjectionDesc __result)

Extracts the required data from the result of Matrix4f_Projection.

Parameters
projection:OVRMatrix4f

the project matrix from which to extract OVRTimewarpProjectionDesc

projectionModFlags:int

a combination of the ovrProjectionModifier flags. One or more of:

Projection_NoneProjection_LeftHandedProjection_FarLessThanNear
Projection_FarClipAtInfinityProjection_ClipRangeOpenGL
__result:OVRTimewarpProjectionDesc

the extracted ovrTimewarpProjectionDesc

Annotations
@NativeType:ovrTimewarpProjectionDesc