#open-vr #vr #api-bindings #steamvr #vive

sys openvr_bindings

Unsafe bindings for the OpenVR API. Forked version of https://github.com/rust-openvr/rust-openvr with updated support for newer OpenVR API.

2 stable releases

2.1.1 Mar 13, 2024
2.1.0 Mar 12, 2024

#1390 in Hardware support

41 downloads per month
Used in openvr-rs

MIT license

1MB
32K SLoC

Rust 15K SLoC // 0.0% comments C# 8K SLoC // 0.0% comments C++ 8K SLoC // 0.1% comments Python 1K SLoC // 0.5% comments

openvr-bindings-rs

Contains function definitions for the OpenVR library. Use the openvr-rs (not yet created) crate, unless you know what you are doing.

Instructions for updating OpenVR

  1. git submodule update --init --recursive (initial checkout only)
  2. git submodule foreach git pull origin master to update the submodule
  3. cargo build --features "buildtime_bindgen" to update the bindings
  4. Apply the workaround for broken OpenVR ABIs, if required

Workaround for broken OpenVR ABIs (Linux/macOS only)

Search for packed structs in headers/openvr.h, i.e., #pragma pack( push, 4 ). Currently, that is:

VRControllerState_t
RenderModel_TextureMap_t
RenderModel_t
VREvent_t

Depending on what bindgen did parse, you have to replace a bunch of #[repr(C)] and #[repr(C, packed(4))] precending those structs in bindings.rs with:

#[repr(C)]
#[cfg_attr(unix, repr(packed(4)))]

No runtime deps