OVRSharp 1.0.1
See the version list below for details.
dotnet add package OVRSharp --version 1.0.1
NuGet\Install-Package OVRSharp -Version 1.0.1
<PackageReference Include="OVRSharp" Version="1.0.1" />
paket add OVRSharp --version 1.0.1
#r "nuget: OVRSharp, 1.0.1"
// Install OVRSharp as a Cake Addin #addin nuget:?package=OVRSharp&version=1.0.1 // Install OVRSharp as a Cake Tool #tool nuget:?package=OVRSharp&version=1.0.1
OVRSharp
OVRSharp is a high-level idiomatic C# interface for working with the OpenVR API.
Installation
Note: OVRSharp comes with its own version of
openvr_api.dll
and will automatically copy it to your project's output directory.
OVRSharp is available on NuGet, so you can install it just like any other NuGet package:
# .NET CLI
dotnet add package OVRSharp
# VS PowerShell
Install-Package OVRSharp
Usage
Right now, our main goal with this is to make working with the overlay API easier and more C#-like, as well as being entirely platform-agnostic. So you could use this all on its own in your own .NET Core project, or throw it into Unity and work with it there.
Later on, we plan on supporting basically the entirety of the OpenVR API, so you don't need to deal with pointers and stuff. Just write C# as you would expect.
So you can do this:
Application app;
try {
app = new Application(Application.ApplicationType.Overlay);
} catch(OpenVRSystemException e) {
// Errors are exceptions!
}
var overlay = new Overlay("cool_overlay", "Cool Overlay", true) {
WidthInMeters = 3.8f
};
overlay.SetTextureFromFile(@"C:\path\to\file.png");
overlay.SetThumbnailTextureFromFile(@"C:\path\to\thumb.png");
Instead of this:
var err = EVRInitError.None;
var vrSystem = OpenVR.Init(ref err, EVRApplicationType.VRApplication_Overlay);
if (err != EVRInitError.None)
{
// whatever error handling
}
// Create a dashboard overlay
var overlayErr = EVROverlayError.None;
ulong overlayHandle;
ulong thumbnailHandle;
overlayErr = OpenVR.Overlay.CreateDashboardOverlay("cool_overlay", "Cool Overlay", ref overlayHandle, ref thumbnailHandle);
if (overlayErr != EVROverlayError.None)
{
// whatever error handling
}
overlayErr = OpenVR.Overlay.SetOverlayWidthInMeters(overlayHandle, 3.8f);
if (overlayErr != EVROverlayError.None)
{
// whatever error handling
}
// Set the dashboard overlay up. First, the main overlay's texture
overlayErr = OpenVR.Overlay.SetOverlayFromFile(overlayHandle, @"C:\path\to\file.png");
if (overlayErr != EVROverlayError.None)
{
// whatever error handling
}
// Then the thumbnail.
overlayErr = OpenVR.Overlay.SetOverlayFromFile(thumbnailHandle, @"C:\path\to\thumb.png");
if (overlayErr != EVROverlayError.None)
{
// whatever error handling
}
If you encounter anything that is not natively supported by OVRSharp, you can always use the internal Valve.VR
APIs. An instance of CVRSystem
is accessible through Application
, as OVRSystem
.
If you run into something you would really like to see supported, feel free to open an issue describing your use case! That will help us prioritize what functionality to add next.
Examples
OVRSharp is currently being used in WhereIsForward, and in some unreleased projects.
License
MIT
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on OVRSharp:
Package | Downloads |
---|---|
OVRSharp.Graphics.DirectX
DirectX implementation of OVRSharp graphics APIs |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on OVRSharp:
Repository | Stars |
---|---|
galister/WlxOverlay
A simple OpenVR overlay for Wayland and X11 desktops
|
Version | Downloads | Last updated |
---|---|---|
1.2.0 | 3,000 | 7/11/2021 |
1.2.0-git-fa51a38ef1d433e3e... | 272 | 7/11/2021 |
1.2.0-git-f75f35656111f57fc... | 365 | 7/11/2021 |
1.2.0-git-1026f9168a033c7a8... | 336 | 7/12/2021 |
1.1.0 | 397 | 6/1/2021 |
1.1.0-git-f8e05c0917c3f6ca0... | 249 | 6/13/2021 |
1.1.0-git-ecf7e2d2662e7cac0... | 276 | 7/11/2021 |
1.1.0-git-de88ed1d204de7f31... | 282 | 6/1/2021 |
1.1.0-git-5b9fb562b00df707f... | 278 | 7/11/2021 |
1.1.0-git-5198c2efee1fded93... | 243 | 6/13/2021 |
1.1.0-git-21b8eb27ed98de264... | 295 | 7/11/2021 |
1.0.3-git-dc4e0c1fe5909d921... | 274 | 6/1/2021 |
1.0.3-git-6ad64326bbead5747... | 346 | 5/28/2021 |
1.0.3-f1d57c14ba7f5cf446651... | 340 | 5/28/2021 |
1.0.2 | 357 | 5/28/2021 |
1.0.1 | 399 | 5/16/2021 |
1.0.0 | 403 | 5/16/2021 |