JVM OpenVR Wrapper

Overview

JVM OpenVR Wrapper (synchronized with 1.2.10)

Build Status license Release Size Github All Releases

OpenVR SDK

This is a kotlin wrapper of OpenVR, which is an API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting. This repository is an SDK that contains the API and samples. The runtime is under SteamVR in Tools on Steam.

Documentation

Documentation for the API is available on the Github Wiki

More information on OpenVR and SteamVR can be found on http://steamvr.com

Binding Features:

  • original comments preserved and properly formatted
  • direct fields, e.g: var TrackedDevicePose.poseIsValid: Boolean
  • enumerators for type safety, e.g: var Texture.type: TextureType
  • every struct method is offered also much more user friendly offering also full interoperability with glm, getProjectionMatrix returns, for example, directly a glm Mat4
vrSystem.getProjectionMatrix(eye: VREye, nearZ: Float, farZ: Float, res: Mat4 = Mat4()): Mat4

that expects an EVREye enumerator type for eEye and returns directly a glm Mat4. instead of:

VRSystem.VRSystem_GetProjectionMatrix(eEye: Int, fNearZ: Float, fNear: Float, __result: HmdMatrix44): HmdMatrix44

Or for example:

GetStringTrackedDeviceProperty.invoke(..): Int

where you are supposed to call it one first time to get the right size for the buffer to accommodate the char array for the string and then a second time to actually retrieve the string. You have the possibility to call directly

getStringTrackedDeviceProperty(..): String

that returns directly the resulting string, bringing down a lot of boilerplate code

  • array classes [] operator, included RenderModel_Vertex
  • concise enumerators, e.g. EVRComponentProperty.VRComponentProperty_IsStatic is VRComponentProperty.IsStatic - SteamVRListener for event listener. Instantiate a class extending it, call .poll() on it at the begin of each frame and override the corresponding methods you are looking for, such as buttonPress(left: Boolean, button: EVRButtonId) TO CHECK

Sample:

You can find the OpenGL sample here

Contributions:

Don't hesitate to contribute to the project by submitting issues or pull requests for bugs and features. Any feedback is welcome at [email protected].

You might also like...
⏰ A powerful and simple-to-use guilded wrapper made in Kotlin.
⏰ A powerful and simple-to-use guilded wrapper made in Kotlin.

⏰ guilded-kt [WIP] A powerful yet simple-to-use guilded wrapper made entirely in Kotlin with supporting multiplatform. Take a look at an example of th

SavedStateFlow - A Kotlin StateFlow wrapper around SavedStateHandle
SavedStateFlow - A Kotlin StateFlow wrapper around SavedStateHandle

SavedStateFlow SavedStateFlow is a Kotlin StateFlow wrapper around SavedStateHan

🎲 A powerful and simple-to-use guilded wrapper made in Kotlin.

🎲 deck [WIP] Deck is a powerful yet simple-to-use guilded wrapper made entirely in Kotlin with support to multiplatform. Implementating In case you'r

🧸 A multiplatform coroutine-based wrapper for popular platform-specific Redis client libraries

🧸 rekt ⚠️ WARNING! This project is experimental and may be missing essential features. Please let us know if you found any issues or have any suggest

🧸 A multiplatform coroutine-based wrapper for popular platform-specific Redis client libraries

🧸 rekt ⚠️ WARNING! This project is experimental and may be missing essential features. Please let us know if you found any issues or have any suggest

🔴 A non-deterministic finite-state machine for Android & JVM that won't let you down
🔴 A non-deterministic finite-state machine for Android & JVM that won't let you down

HAL is a non-deterministic finite-state machine for Android & JVM built with Coroutines StateFlow and LiveData. Why non-deterministic? Because in a no

:blowfish: An Android & JVM key-value storage powered by Protobuf and Coroutines

PufferDB PufferDB is a ⚡ key-value storage powered by Protocol Buffers (aka Protobuf) and Coroutines. The purpose of this library is to provide an eff

🚟 Lightweight, and simple scheduling library made for Kotlin (JVM)
🚟 Lightweight, and simple scheduling library made for Kotlin (JVM)

Haru 🚟 Lightweight, and simple scheduling library made for Kotlin (JVM) Why did you build this? I built this library as a personal usage library to h

A injection minecraft cheat using jvm attach api

Luminous A injection minecraft cheat using jvm attach api Website: https://lumi.getfdp.today Build We used a thing called Wrapper to make development

Comments
  • Consider adding OpenVR libs as a git submodule?

    Consider adding OpenVR libs as a git submodule?

    Very minor but might take the hassle out of pushing the new binaries each time they're updated by Valve/OpenVR.

    https://git-scm.com/book/en/v2/Git-Tools-Submodules

    opened by stephenohair 6
  • CreateOverlay causes EXCEPTION_ACCESS_VIOLATION

    CreateOverlay causes EXCEPTION_ACCESS_VIOLATION

    Hello, Giuseppe

    Quite a long time I have been struggling with mentioned error. I'm running Windows 10 x64, HTC Vive, nvidia 1070 and amd fx-8320.

    Following code:

    import openvr.lib.*
    import java.nio.LongBuffer
    
    fun main() {
        println("java ${System.getProperty("java.version")} ${System.getProperty("sun.arch.data.model")}bit")
        println(vr.isHmdPresent)
        println(vr.isRuntimeInstalled)
        println(vr.runtimePath)
    
        val ivr = vr.init(VRApplication.Overlay)
        println("ivr error code: $ivr")
    
        println("vrOverlay.isInterfaceVersionValid = ${vrOverlay.isInterfaceVersionValid}")
    
        val testOverlayHandle = VROverlayHandleBuffer.allocate(1).also {
            println(it.limit())
            vrOverlay.createOverlay("test:overlay", "test overlay", it) // <- access violation
    //        vrOverlay.createDashboardOverlay("test:overlay", "test dashboard overlay", it, LongBuffer.allocate(1)) // <- no exception produced here
        }.get(0)
    
        vrOverlay.setOverlayFromFile(testOverlayHandle, "duck.png")
        vrOverlay showOverlay testOverlayHandle
    
        Thread.sleep(2000)
    
        vrOverlay hideOverlay testOverlayHandle
        vrOverlay destroyOverlay testOverlayHandle
    
        vr.shutdown()
    }
    

    Produces output:

    java 1.8.0_221 32bit
    true
    true
    C:\Program Files (x86)\Steam\steamapps\common\SteamVR
    ivr error code: None
    vrOverlay.isInterfaceVersionValid = true
    1
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x15d6efe6, pid=15344, tid=0x0000429c
    #
    # JRE version: Java(TM) SE Runtime Environment (8.0_221-b11) (build 1.8.0_221-b11)
    # Java VM: Java HotSpot(TM) Client VM (25.221-b11 mixed mode windows-x86 )
    # Problematic frame:
    # C  [vrclient.dll+0x8efe6]
    #
    # Core dump written. Default location: C:\Workspace\cyber-timer\hs_err_pid15344.mdmp
    #
    # An error report file with more information is saved as:
    # C:\Workspace\cyber-timer\hs_err_pid15344.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://bugreport.java.com/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #
    
    Process finished with exit code 1
    

    Have tried also under Java 11 x64 both 1.2.10 release and cbc252e with about the same result (but pc like 0x7ffc########). Seems magical to me that createDashboardOverlay doesn't cause any errors.

    Attaching Visual Studio to native code shown access violation with pc=0x00000000, can it be a null pointer? PDB file for vrclient.dll isn't available hence I don't see any further options for native debug. hs_err_pid15344.mdmp and hs_err_pid15344.log

    SteamVR is 1.6.10, though I expect it to be backward-compatible, declarations of CreateOverlay are similar in openvr.h of 1.2.10 and of 1.6.10. I'd like to try older versions of SteamVR, but I don't see an obvious way of safe downgrade.

    P.S. helloVr_OpenGL works as a charm with my setup and SteamVR 1.6.10.

    -- Regards, Fedor

    opened by listvin 1
  • Failing tests - Unable to read VR Path Registry from ~/.config/openvr/openvrpaths.vrpath

    Failing tests - Unable to read VR Path Registry from ~/.config/openvr/openvrpaths.vrpath

    Hi Giuseppe,

    I'm having an issue building your code on Ubuntu using gradle. Both unit tests are failing when trying to initialise the vr api. Please note I don't have steam or any openvr api runtime currently installed on my system.

    Based on TesteEventLogger output it seems that a pre-requisite to executing the tests on this project is to install openvr api runtime. Would it be better if the tests were configured to use either a generic or platform-specific openvrpaths.vrpath file?

    [ERROR] [system.err] Unable to read VR Path Registry from /home/steve/.config/openvr/openvrpaths.vrpath 11:30:16.284

    [ERROR] [system.err] Unable to read VR Path Registry from /home/steve/.config/openvr/openvrpaths.vrpath

    How did you get around this issue in your Travis build? I checked your travis build and can't see any line suggesting a step requiring openvr be installed prior to running the build.

    Cheers,

    Steve

    opened by stephenohair 3
Releases(v1.2.10-beta-00)
Owner
Friendly community providing JVM counterpart of open source tools for real time 3d graphic. "Take care of your tools and they will take care of you." (cit)
null
🔓 Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.

EasyPermissions-ktx Kotlin version of the popular googlesample/easypermissions wrapper library to simplify basic system permissions logic on Android M

Madalin Valceleanu 326 Dec 23, 2022
Permissionmanager is a small wrapper for handling permission requests.

Permissionmanager Permissionmanager is a small wrapper for handling permission requests. Installation Add jitpack to your repositories in Project buil

Thomas Cirksena 11 Nov 17, 2020
A simple Kotlin wrapper around Anvil.

AnvilKotlin A simple Kotlin wrapper around Anvil. The only purpose of this library is to provide type safety to Anvil through Kotlin. Nothing more, no

Andre Artus 15 Oct 3, 2022
Android AsyncTask wrapper library, written in Kotlin

KillerTask This is a Kotlin Android library to create async background tasks. Inspired by TinyTask, but more beautiful and easy to use for Kotlin Andr

Inaka 26 Oct 3, 2022
A lightweight Kotlin friendly wrapper around Couchbase lite for Android.

CouchBaseKtx ?? Work In-Progress ?? A lightweight Kotlin friendly wrapper around Couchbase-lite for Android Read up a little bit of documentation abou

Jaya Surya Thotapalli 5 Feb 15, 2022
Netflix inspired OTT Home Screen, Contains implementation in Reactjs, Kotlin React Wrapper, Jetpack Compose Web

Netflix-Clone-React Practising React by building Netflix Clone Requirements TMDB api key : Add TMDB API key to AppApi.kt Learning Resourcce Build Netf

Chetan Gupta 61 Nov 13, 2022
Dependency Injection library for Compose Multiplatform, Koin wrapper.

?? Cokoin Injection library for Compose (Multiplatform and Jetpack), Koin wrapper. It uses @Composable functions to configure KoinContext and Scopes.

Bruno Wieczorek 57 Dec 29, 2022
This library is a set of simple wrapper classes that are aimed to help you easily access android device information.

SysInfo Simple, single class wrapper to get device information from an android device. This library provides an easy way to access all the device info

Klejvi Kapaj 7 Dec 27, 2022
Wrapper of FusedLocationProviderClient for Android to support modern usage like LiveData and Flow

FancyLocationProvider Wrapper of FusedLocationProviderClient for Android to support modern usage like LiveData or Flow. Install Add Jitpack repository

Jintin 66 Aug 15, 2022
A Kotlin coroutines wrapper for IndexedDB.

Kotlin IndexedDB A wrapper around IndexedDB which allows for access from Kotlin/JS code using suspend blocks and linear, non-callback based control fl

JUUL Labs 10 Dec 11, 2022