JVM OpenVR Binding (synchronized with 1.0.10)

OpenVR SDK

This is the jvm port 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:

  • using jna in direct mapping (~ jni performances)
  • original comments preserved and properly formatted
  • every struct method is offered also much more user friendly offering also full interoperability with glm, getProjectionMatrix returns, for example, directly a glm Mat4
    IVRSystem.GetProjectionMatrix(eEye: Int, fNearZ: Float, fFarZ: Float): HmdMatrix44_t.ByValue
    

    because of the jna binding requirements, shall be called as:

    IVRSystem.GetProjectionMatrix.invoke(eEye: Int, fNearZ: Float, fFarZ: Float): HmdMatrix44_t.ByValue
    

    but there is also the possibility to simply call:

    IVRSystem.getProjectionMatrix(eEye: EVREye, fNearZ: Float, fFarZ: Float): Mat4
    

    that expects an EVREye enumerator type for eEye and returns directly a glm Mat4. 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 accomodate 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_t
  • concise enumerators, e.g. EVRComponentProperty.VRComponentProperty_IsStatic is EVRComponentProperty.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)

Sample:

You can find the OpenGL sample (using jogl) 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 elect86@gmail.com.

Related Libraries

uno-sdk

UNofficial Opengl SDK

Last updated 3 mins ago

ovr

Last updated 3 mins ago

openvr

OpenVR SDK

Last updated 3 mins ago

glm

jvm glm

Last updated 3 mins ago

gli

jvm gli

Last updated 3 mins ago