Skip to content

DevOculus-Meta-Quest/LibOVR

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LibOVR Logo

LibOVR: A Wrapper for Oculus PCVR SDK

Simplifying Oculus VR Development for Immersive Experiences

GitHub Issues GitHub Pull Requests License


🌟 Introduction

LibOVR is your gateway to creating cutting-edge VR applications. This wrapper library for the Oculus PCVR SDK streamlines VR development, enabling you to focus on crafting immersive virtual experiences without the complexity of the native SDK.

πŸ“š Table of Contents

πŸ’‘ Features

  • Initialization and Session Management: Initiate and manage VR sessions with ease.
  • Tracking: Capture precise movement and positioning data.
  • Input Handling: Seamlessly process inputs from various VR controllers.
  • Rendering: Efficiently manage VR content rendering.

πŸš€ Getting Started

To utilize LibOVR, ensure your development environment is set up for Oculus VR development. Familiarity with VR concepts is recommended.

πŸ“ Examples

Initializing the OVR Client and Creating a Session

OvrClient ovrClient;
if (OvrClient.TryInitialize(out ovrClient))
{
    OvrSession ovrSession;
    if (ovrClient.TryCreateSession(out ovrSession))
    {
        // Your code here
    }
}

Getting Tracking State

double absTime = ...; // specify the absolute time
OvrTrackingState trackingState = ovrSession.GetTrackingState(absTime, OvrBool.False);

// Accessing head pose
OvrPosef headPose = trackingState.HeadPose;

Handling Input

OvrInputState inputState;
if (ovrSession.GetInputState(OvrControllerType.Touch, out inputState))
{
    // Check if a button is pressed
    if ((inputState.Buttons & OvrButton.A) != 0)
    {
        // Button A is pressed
    }
}

Managing Texture Swap Chains

OvrTextureSwapChainDesc desc = new OvrTextureSwapChainDesc
{
    Type = OvrTextureType._2D,
    Format = OvrTextureFormat.R8G8B8A8_UNORM_SRGB,
    ArraySize = 1,
    Width = 1024,
    Height = 1024,
    MipLevels = 1,
    SampleCount = 1,
    StaticImage = OvrBool.False,
};

OvrTextureSwapChain textureSwapChain;
ovrSession.CreateTextureSwapChainDX(dxDevice, desc, out textureSwapChain);

Example 5: Session Status Checking

This example demonstrates how to check the status of the VR session, which is important for ensuring that the application responds correctly to changes in the VR environment.

OvrSessionStatus sessionStatus;
ovrSession.GetSessionStatus(out sessionStatus);

if (sessionStatus.ShouldQuit)
{
    // Handle session quit request
}
if (sessionStatus.ShouldRecenter)
{
    // Handle recentering request
}
if (sessionStatus.IsVisible)
{
    // Session is visible and can proceed with rendering
}

Example 6: Eye Rendering Information

This snippet shows how to obtain eye rendering information, which is crucial for rendering VR content correctly for each eye.

OvrEyeRenderDesc[] eyeRenderDescs = new OvrEyeRenderDesc[2];
eyeRenderDescs[0] = ovrSession.GetRenderDesc(OvrEyeType.Left, ovrSession.DefaultEyeFov[0]);
eyeRenderDescs[1] = ovrSession.GetRenderDesc(OvrEyeType.Right, ovrSession.DefaultEyeFov[1]);

// Use eyeRenderDescs for rendering setup

Example 7: Frame Submission

Here's an example of how to submit a frame for rendering, a key step in the VR rendering loop.

OvrLayerEyeFov layer = new OvrLayerEyeFov();
layer.Header.Type = OvrLayerType.EyeFov;
layer.Header.Flags = OvrLayerFlags.None;

// Set up layer parameters, textures, and viewports for each eye
// ...

ovrSession.SubmitFrame(0, IntPtr.Zero, ref layer);

Example 8: Handling Controller Input

This example demonstrates how to handle input from Oculus Touch controllers, an essential part of creating interactive VR experiences.

OvrInputState touchState;
if (ovrSession.GetInputState(OvrControllerType.Touch, out touchState))
{
    if ((touchState.Buttons & OvrButton.One) != 0)
    {
        // Handle button one press
    }
    if ((touchState.Touches & OvrTouch.LIndexTrigger) != 0)
    {
        // Handle index trigger touch
    }
}

🌌 Conclusion

LibOVR empowers you to create next-generation VR experiences with ease. Dive into its functionalities, explore its capabilities, and contribute to its evolution!

🀝 Support and Contribution

Your contributions make LibOVR better! Report issues, suggest improvements, or contribute directly by visiting our GitHub repository. We value your input!

About

Managed .net bindings of Oculus LibOVR

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 79.6%
  • C 17.8%
  • C# 1.4%
  • Roff 1.0%
  • CMake 0.1%
  • Batchfile 0.1%