Magnum::OvrIntegration namespace

Integration with the Oculus SDK (LibOVR)

Conversion of math classes, wrappers for most OVR CAPI structures and functions.

This library depends on the Oculus SDK and is built if MAGNUM_WITH_OVR is enabled when building Magnum Integration. To use this library with CMake, put FindMagnumIntegration.cmake and FindOVR.cmake into your modules/ directory, request the Ovr component of the MagnumIntegration package and link to the MagnumIntegration::Ovr target:

find_package(MagnumIntegration REQUIRED Ovr)

# ...
target_link_libraries(your-app PRIVATE MagnumIntegration::Ovr)

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-integration repository and do the following before calling find_package(). Using LibOVR itself as a CMake subproject isn't possible, so you need to provide it as a system dependency and point CMAKE_PREFIX_PATH to its installation dir if necessary.

set(MAGNUM_WITH_OVR ON CACHE BOOL "" FORCE)
add_subdirectory(magnum-integration EXCLUDE_FROM_ALL)

See the Oculus VR example, Downloading and building integration libraries and Integration library usage with CMake for more information.

Classes

struct Buttons
Buttons.
class Compositor
Compositor.
class Context
Context singleton.
struct Error
Error.
class HeadLockableLayer
Superclass for layers which can be locked relative to the HMD.
class InputState
Input state.
class Layer
Wrapper around ovrLayerHeader
class LayerEyeFov
Wrapper around ovrLayerEveFov
class LayerQuad
Wrapper around ovrLayerQuad
class PoseState
A full rigid body pose with first and second derivatives.
class Session
Session.
class TextureSwapChain
Texture swap chain.
struct Touches
Touches.

Enums

enum class LayerType: Int { EyeFov = ovrLayerType_EyeFov, Quad = ovrLayerType_Quad, EyeMatrix = ovrLayerType_EyeMatrix }
Layer type.
enum class DetectResult: UnsignedByte { ServiceRunning = 1, HmdConnected = 2 }
Detection result.
enum class HmdType: Int { None = ovrHmd_None, DK1 = ovrHmd_DK1, DKHD = ovrHmd_DKHD, DK2 = ovrHmd_DK2, CB = ovrHmd_CB, Other = ovrHmd_Other, E3_2015 = ovrHmd_E3_2015, ES06 = ovrHmd_ES06, ES09 = ovrHmd_ES09, ES11 = ovrHmd_ES11, CV1 = ovrHmd_CV1 }
HMD type.
enum class TrackingOrigin: Int { EyeLevel = ovrTrackingOrigin_EyeLevel, FloorLevel = ovrTrackingOrigin_FloorLevel }
Tracking origin.
enum class TrackerFlag: Int { Connected = ovrTracker_Connected, PoseTracked = ovrTracker_PoseTracked }
Tracker flag.
enum class Button: UnsignedInt { A = ovrButton_A, B = ovrButton_B, X = ovrButton_X, Y = ovrButton_Y, RThumb = ovrButton_RThumb, RShoulder = ovrButton_RShoulder, LThumb = ovrButton_LThumb, LShoulder = ovrButton_LShoulder, Up = ovrButton_Up, Down = ovrButton_Down, Left = ovrButton_Left, Right = ovrButton_Right, Enter = ovrButton_Enter, Back = ovrButton_Back, VolUp = ovrButton_VolUp, VolDown = ovrButton_VolDown, Home = ovrButton_Home }
Button.
enum class Touch: UnsignedInt { A = ovrTouch_A, B = ovrTouch_B, X = ovrTouch_X, Y = ovrTouch_Y, RThumb = ovrTouch_RThumb, LThumb = ovrTouch_LThumb, RIndexTrigger = ovrTouch_RIndexTrigger, LIndexTrigger = ovrTouch_LIndexTrigger, RIndexPointing = ovrTouch_RIndexPointing, RThumbUp = ovrTouch_RThumbUp, LIndexPointing = ovrTouch_LIndexPointing, LThumbUp = ovrTouch_LThumbUp }
Touch.
enum class ControllerType: Int { None = ovrControllerType_None, LTouch = ovrControllerType_LTouch, RTouch = ovrControllerType_RTouch, Touch = ovrControllerType_Touch, Remote = ovrControllerType_Remote, XBox = ovrControllerType_XBox, Active = ovrControllerType_Active }
Controller type.
enum class StatusFlag: Int { OrientationTracked = ovrStatus_OrientationTracked, PositionTracked = ovrStatus_PositionTracked }
Status flag.
enum class SessionStatusFlag: UnsignedByte { IsVisible = 0, HmdPresent = 1, HmdMounted = 2, DisplayLost = 3, ShouldQuit = 4, ShouldRecenter = 5 }
Session status flag.
enum class MirrorOption: UnsignedInt { Default = ovrMirrorOption_Default, PostDistortion = ovrMirrorOption_PostDistortion, LeftEyeOnly = ovrMirrorOption_LeftEyeOnly, RightEyeOnly = ovrMirrorOption_RightEyeOnly, IncludeGuardian = ovrMirrorOption_IncludeGuardian, IncludeNotifications = ovrMirrorOption_IncludeNotifications, IncludeSystemGui = ovrMirrorOption_IncludeSystemGui }
Mirror option.
enum class PerformanceHudMode: Int { Off = ovrPerfHud_Off, PerfSummary = ovrPerfHud_PerfSummary, LatencyTiming = ovrPerfHud_LatencyTiming, AppRenderTiming = ovrPerfHud_AppRenderTiming, CompRenderTiming = ovrPerfHud_CompRenderTiming, VersionInfo = ovrPerfHud_VersionInfo }
Performance HUD mode.
enum class DebugHudStereoMode: Int { Off = ovrDebugHudStereo_Off, Quad = ovrDebugHudStereo_Quad, QuadWithCrosshair = ovrDebugHudStereo_QuadWithCrosshair, CrosshairAtInfinity = ovrDebugHudStereo_CrosshairAtInfinity }
Debug HUD mode.
enum class LayerHudMode: Int { Off = ovrLayerHud_Off, Info = ovrLayerHud_Info }
Layer HUD mode.
enum class ErrorType: Int { MemoryAllocationFailure = ovrError_MemoryAllocationFailure, InvalidSession = ovrError_InvalidSession, Timeout = ovrError_Timeout, NotInitialized = ovrError_NotInitialized, InvalidParameter = ovrError_InvalidParameter, ServiceError = ovrError_ServiceError, NoHmd = ovrError_NoHmd, Unsupported = ovrError_Unsupported, DeviceUnavailable = ovrError_DeviceUnavailable, InvalidHeadsetOrientation = ovrError_InvalidHeadsetOrientation, ClientSkippedDestroy = ovrError_ClientSkippedDestroy, ClientSkippedShutdown = ovrError_ClientSkippedShutdown, AudioDeviceNotFound = ovrError_AudioDeviceNotFound, AudioComError = ovrError_AudioComError, Initialize = ovrError_Initialize, LibLoad = ovrError_LibLoad, LibVersion = ovrError_LibVersion, ServiceConnection = ovrError_ServiceConnection, ServiceVersion = ovrError_ServiceVersion, IncompatibleOs = ovrError_IncompatibleOS, DisplayInit = ovrError_DisplayInit, ServerStart = ovrError_ServerStart, Reinitialization = ovrError_Reinitialization, MismatchedAdapters = ovrError_MismatchedAdapters, LeakingResources = ovrError_LeakingResources, ClientVersion = ovrError_ClientVersion, OutOfDateOs = ovrError_OutOfDateOS, OutOfDateGfxDriver = ovrError_OutOfDateGfxDriver, IncompatibleGpu = ovrError_IncompatibleGPU, NoValidVrDisplaySystem = ovrError_NoValidVRDisplaySystem, Obsolete = ovrError_Obsolete, DisabledOrDefaultAdapter = ovrError_DisabledOrDefaultAdapter, HybridGraphicsNotSupported = ovrError_HybridGraphicsNotSupported, DisplayManagerInit = ovrError_DisplayManagerInit, TrackerDriverInit = ovrError_TrackerDriverInit, DisplayLost = ovrError_DisplayLost, TextureSwapChainFull = ovrError_TextureSwapChainFull, TextureSwapChainInvalid = ovrError_TextureSwapChainInvalid, RuntimeException = ovrError_RuntimeException }
Error type.

Typedefs

using DetectResults = Containers::EnumSet<DetectResult>
Detection results.
using TrackerFlags = Containers::EnumSet<TrackerFlag>
Tracker flags.
using StatusFlags = Containers::EnumSet<StatusFlag>
Status flags.
using SessionStatusFlags = Containers::EnumSet<SessionStatusFlag>
Session status flags.
using MirrorOptions = Containers::EnumSet<MirrorOption>
Tracker flags.

Functions

auto operator<<(Debug& debug, DetectResult value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, HmdType value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, TrackingOrigin value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, TrackerFlag value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, Button value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, Touch value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ControllerType value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, StatusFlag value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, SessionStatusFlag value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, MirrorOption value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, PerformanceHudMode value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, DebugHudStereoMode value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, LayerHudMode value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, ErrorType value) -> Debug&
Debug output operator.

Enum documentation

enum class Magnum::OvrIntegration::LayerType: Int

Layer type.

Enumerators
EyeFov

Described by ovrLayerEyeFov.

Quad

Described by ovrLayerQuad.

EyeMatrix

Described by ovrLayerEyeMatrix. Currently not supported.

enum class Magnum::OvrIntegration::DetectResult: UnsignedByte

Detection result.

Enumerators
ServiceRunning

Service is running

HmdConnected

HMD is connected

enum class Magnum::OvrIntegration::HmdType: Int

HMD type.

Enumerators
None

Absence of a HMD type

DK1

Developer Kit 1

DKHD

HD prototype, aka Crystal Cove. Used by Oculus internally.

DK2

Developer Kit 2

CB

Crescent Bay prototype. Used by Oculus internally.

Other

Unknown type

E3_2015

HMD demoed at E3 2015. Used by Oculus internally.

ES06

Used by Oculus internally

ES09

Used by Oculus internally

ES11

Used by Oculus internally

CV1

Consumer Version 1

enum class Magnum::OvrIntegration::TrackingOrigin: Int

Tracking origin.

Enumerators
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 the height of the floor. Cockpit-based, or 3rd-person experiences are ideal candidates.

When used, all poses are reported as an offset transform from the profile calibrated or recentered HMD pose. It is recommended that apps using this origin type call Session::recenterTrackingOrigin() prior to starting the VR experience, but notify the user before doing so to make sure the user is in a comfortable pose, facing a comfortable direction.

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 are reported as an offset transform from the profile calibrated floor pose. Calling Session::recenterTrackingOrigin() will recenter the X & Z axes as well as yaw, but the Y-axis (i.e. height) will continue to be reported using the floor height as the origin for all poses.

enum class Magnum::OvrIntegration::TrackerFlag: Int

Tracker flag.

Enumerators
Connected

The sensor is present, else the sensor is absent or offline

PoseTracked

The sensor has a valid pose, else the pose is unavailable. This will only be set if TrackerFlag::Connected is set.

enum class Magnum::OvrIntegration::Button: UnsignedInt

Button.

The Oculus SDK provides an abstraction of input for the XBox controller, the Oculus Remote and Oculus Touch. This enum describes all possible buttons pressable on one of these controllers.

Enumerators
A

A

B

B

X

X

Y

Y

RThumb

Right thumbstick

RShoulder

Right shoulder

LThumb

Left thumbstick

LShoulder

Left shoulder

Up

D pad up

Down

D pad down

Left

D pad left

Right

D pad right

Enter

Start on XBox controller

Back

Back on Xbox controller

VolUp

Volume up. Only supported by Remote.

VolDown

Volume down. Only supported by Remote

Home

Home

enum class Magnum::OvrIntegration::Touch: UnsignedInt

Touch.

The Oculus SDK provides an abstraction of input for the XBox controller, the Oculus Remote and Oculus Touch. This enum describes all possible buttons or poses which can be "touched", therefore, the player is touching the button, but not pressing it.

Enumerators
A

A button touch

B

B button touch

X

X button touch

Y

Y button touch

RThumb

Right thumbstick touch

LThumb

Left thumbstick touch

RIndexTrigger

Right index finger touch

LIndexTrigger

Left index finger touch

RIndexPointing

Right index finger pose state, derived internally based on distance, proximity to sensors and filtering.

RThumbUp

Right thumb pose state, derived internally based on distance, proximity to sensors and filtering.

LIndexPointing

Left index finger pose state

LThumbUp

Left thumb pose state

enum class Magnum::OvrIntegration::ControllerType: Int

Controller type.

Enumerators
None

No controllers

LTouch

Left Touch controller

RTouch

Right Touch controller

Touch

Left and right Touch controllers

Remote

Oculus Remote

XBox

XBox controller

Active

Operate on or query whichever controller is active

enum class Magnum::OvrIntegration::StatusFlag: Int

Status flag.

Flags describing the current status of sensor tracking.

Enumerators
OrientationTracked

Orientation is currently tracked (connected and in use)

PositionTracked

Position is currently tracked (false if out of range)

enum class Magnum::OvrIntegration::SessionStatusFlag: UnsignedByte

Session status flag.

Enumerators
IsVisible

Set when the process has VR focus and thus is visible in the HMD

HmdPresent

Set when an HMD is present

HmdMounted

Set when the HMD is on the user's head

DisplayLost

Set when the session is in a display-lost state. See ovr_SubmitFrame.

ShouldQuit

Set when the application should initiate shutdown.

ShouldRecenter

Set when UX has requested re-centering. Must call ovr_ClearShouldRecenterFlag or ovr_RecenterTrackingOrigin.

enum class Magnum::OvrIntegration::MirrorOption: UnsignedInt

Mirror option.

Enumerators
Default

Default

PostDistortion

Post distortion

LeftEyeOnly

Left eye only

RightEyeOnly

Right eye only

IncludeGuardian

Include Guardian

IncludeNotifications

Include Notifications

IncludeSystemGui

Include system GUI

enum class Magnum::OvrIntegration::PerformanceHudMode: Int

Performance HUD mode.

Enumerators
Off

Turns off the performance HUD

PerfSummary

Shows performance summary and headroom

LatencyTiming

Shows latency related timing info

AppRenderTiming

Shows render timing info for application

CompRenderTiming

Shows render timing info for OVR compositor

VersionInfo

Shows SDK & HMD version Info

enum class Magnum::OvrIntegration::DebugHudStereoMode: Int

Debug HUD mode.

Enumerators
Off

Turns off the Stereo Debug HUD

Quad

Renders Quad in world for Stereo Debugging

QuadWithCrosshair

Renders Quad+crosshair in world for Stereo Debugging

CrosshairAtInfinity

Renders screen-space crosshair at infinity for Stereo Debugging

enum class Magnum::OvrIntegration::LayerHudMode: Int

Layer HUD mode.

Enumerators
Off

Turns off the layer HUD

Info

Shows info about a specific layer

enum class Magnum::OvrIntegration::ErrorType: Int

Error type.

Enumerators
MemoryAllocationFailure

Failure to allocate memory

InvalidSession

Invalid ovrSession parameter provided

Timeout

The operation timed out

NotInitialized

The system or component has not been initialized

InvalidParameter

Invalid parameter provided. See error info or log for details

ServiceError

Generic service error. See error info or log for details

NoHmd

The given HMD doesn't exist

Unsupported

Function call is not supported on this hardware/software

DeviceUnavailable

Specified device type isn't available

InvalidHeadsetOrientation

The headset was in an invalid orientation for the requested operation (e.g. vertically oriented during Session::recenterTrackingOrigin())

ClientSkippedDestroy

The client failed to destroy Session on an active session before destroying Context. Or the client crashed.

ClientSkippedShutdown

The client failed to destroy Context or the client crashed

AudioDeviceNotFound

Failure to find the specified audio device

AudioComError

Generic COM error

Initialize

Generic initialization error

LibLoad

Couldn't load LibOVRRT

LibVersion

LibOVRRT version incompatibility

ServiceConnection

Couldn't connect to the OVR Service

ServiceVersion

OVR Service version incompatibility

IncompatibleOs

The operating system version is incompatible

DisplayInit

Unable to initialize the HMD display

ServerStart

Unable to start the server. Is it already running?

Reinitialization

Attempting to re-initialize with a different version

MismatchedAdapters

Chosen rendering adapters between client and service do not match

LeakingResources

Calling application has leaked resources

ClientVersion

Client version too old to connect to service

OutOfDateOs

The operating system is out of date

OutOfDateGfxDriver

The graphics driver is out of date

IncompatibleGpu

The graphics hardware is not supported

NoValidVrDisplaySystem

No valid VR display system found

Obsolete

Feature or API is obsolete and no longer supported

DisabledOrDefaultAdapter

No supported VR display system found, but disabled or driverless adapter found

HybridGraphicsNotSupported

The system is using hybrid graphics (Optimus, etc...), which is not supported

DisplayManagerInit

Initialization of the display manager failed.

TrackerDriverInit

Failed to get the interface for an attached tracker

DisplayLost

In the event of a system-wide graphics reset or cable unplug this is returned to the app.

TextureSwapChainFull

TextureSwapChain::commit() was called too many times on a texture swapchain without calling submit to use the chain

TextureSwapChainInvalid

The TextureSwapChain is in an incomplete or inconsistent state. Ensure TextureSwapChain::commit() was called at least once first.

RuntimeException

A runtime exception occurred. The application is required to shutdown LibOVR and re-initialize it before this error state will be cleared.

Typedef documentation

typedef Containers::EnumSet<DetectResult> Magnum::OvrIntegration::DetectResults

Detection results.

typedef Containers::EnumSet<TrackerFlag> Magnum::OvrIntegration::TrackerFlags

Tracker flags.

typedef Containers::EnumSet<StatusFlag> Magnum::OvrIntegration::StatusFlags

Status flags.

typedef Containers::EnumSet<SessionStatusFlag> Magnum::OvrIntegration::SessionStatusFlags

Session status flags.

typedef Containers::EnumSet<MirrorOption> Magnum::OvrIntegration::MirrorOptions

Tracker flags.

Function documentation

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, DetectResult value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, HmdType value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, TrackingOrigin value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, TrackerFlag value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, Button value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, Touch value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, ControllerType value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, StatusFlag value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, SessionStatusFlag value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, MirrorOption value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, PerformanceHudMode value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, DebugHudStereoMode value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, LayerHudMode value)

Debug output operator.

Debug& Magnum::OvrIntegration::operator<<(Debug& debug, ErrorType value)

Debug output operator.