class
#include <Magnum/OvrIntegration/Context.h>
Context Context singleton.
Handles connection to devices, creation of debug HMDs and provides access to the Oculus SDK Compositor.
Usage
There should always only be one instance of Context. As soon as this one instance is created, you can access it via Context::
Example:
Context context; // ... if(Context::get().detect()) { // ... }
Or without initializing the service you can do:
const OvrDetectResults result = Context::detect(); if(result & OvrDetectResult::HmdConnected) { // ... }
Public static functions
- static auto detect(Int timeout) -> DetectResults
- Detect if a device is currently connected.
- static auto get() -> Context&
- Global context instance.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const Context&) -> Context& deleted
- Copying is not allowed.
- auto operator=(Context&&) -> Context& deleted
- Moving is not allowed.
- auto detect() const -> bool
- Detect if a device is currently connected.
-
auto createSession() -> std::
unique_ptr<Session> - Create a handle to a Oculus Session.
- auto compositor() -> Compositor&
- auto error() const -> Error
- Last error.
Function documentation
static DetectResults Magnum:: OvrIntegration:: Context:: detect(Int timeout)
Detect if a device is currently connected.
Parameters | |
---|---|
timeout | Timeout (in milliseconds) or 0 to poll |
Checks for Oculus Runtime and Oculus HMD device status without loading the LibOVRRT shared library. This may be called before Context() to help decide whether or not to initialize LibOVR.
bool Magnum:: OvrIntegration:: Context:: detect() const
Detect if a device is currently connected.
See detect(Int) to detect runtime and HMD before initializing context.
std:: unique_ptr<Session> Magnum:: OvrIntegration:: Context:: createSession()
Create a handle to a Oculus Session.
Returns instance of Session, or nullptr
, if there is none.
Compositor& Magnum:: OvrIntegration:: Context:: compositor()
Returns | Reference to the compositor |
---|