Giter Club home page Giter Club logo

rust-openvr's Introduction

rust-openvr

Build Status Join the chat at https://gitter.im/rust-openvr/rust-openvr

High-level bindings for OpenVR.

API documentation

C/C++ API documentation for reference purposes.

Requirements

openvr-sys requires CMake and C++ to compile and statically link the OpenVR library.

Imporant: OpenVR does not support MinGW on Windows, i.e., you have to use the MSVC Rust toolchain and C++ compiler.

Initializing

extern crate openvr;

fn main() {
    // Initialize OpenVR.
    let context = unsafe { openvr::init(openvr::ApplicationType::Scene) }.unwrap();

    // Access subsystem.
    let system = context.system().unwrap();

    // See examples/test.rs for a more detailed example.
}

rust-openvr's People

Contributors

bemacized avatar csherratt avatar erickt avatar gitter-badger avatar kevinw avatar ralith avatar reneeichhorn avatar schulzch avatar tmfink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-openvr's Issues

a render example

How close is this project to rendering something simple? I'm looking for a simple VR testbed.

Internal unwrap crash in vulkan_device_extensions_required

When calling vulkan_device_extensions_required, an internal crash happens on an unwrap. This does not happen on vulkan_instance_extensions_required.

stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized
             at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.40\src\backtrace\mod.rs:66
   1: std::sys_common::backtrace::_print_fmt
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:77
   2: std::sys_common::backtrace::_print::{{impl}}::fmt
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:59
   3: core::fmt::write
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libcore\fmt\mod.rs:1052
   4: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\io\mod.rs:1426
   5: std::sys_common::backtrace::_print
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:62
   6: std::sys_common::backtrace::print
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:49
   7: std::panicking::default_hook::{{closure}}
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:204
   8: std::panicking::default_hook
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:224
   9: std::panicking::rust_panic_with_hook
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:472
  10: std::panicking::begin_panic_handler
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:380
  11: core::panicking::panic_fmt
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libcore\panicking.rs:85
  12: core::panicking::panic
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libcore\panicking.rs:52
  13: core::option::Option<std::ffi::c_str::CString>::unwrap<std::ffi::c_str::CString>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\libcore\macros\mod.rs:10
  14: openvr::Compositor::vulkan_device_extensions_required
             at C:\Users\Layl Bongers\.cargo\registry\src\github.com-1ecc6299db9ec823\openvr-0.6.0\src\compositor\mod.rs:39
  15: gfx_backend_vulkan::{{impl}}::open
             at C:\Users\Layl Bongers\Desktop\gfx-vr\gfx\src\backend\vulkan\src\lib.rs:711
  16: gfx_vr_test::Renderer<gfx_backend_vulkan::Backend>::new<gfx_backend_vulkan::Backend>
             at .\src\main.rs:202
  17: gfx_vr_test::main
             at .\src\main.rs:108
  18: std::rt::lang_start::{{closure}}<()>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\libstd\rt.rs:67
  19: std::rt::lang_start_internal::{{closure}}
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\rt.rs:52
  20: std::panicking::try::do_call<closure-0,i32>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:305
  21: panic_unwind::__rust_maybe_catch_panic
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libpanic_unwind\lib.rs:86
  22: std::panicking::try
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:281
  23: std::panic::catch_unwind
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panic.rs:394
  24: std::rt::lang_start_internal
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\rt.rs:51
  25: std::rt::lang_start<()>
             at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\src\libstd\rt.rs:67
  26: main
  27: invoke_main
             at d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  28: __scrt_common_main_seh
             at d:\agent\_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  29: BaseThreadInitThunk
  30: RtlUserThreadStart

Not idiomatic enough (list of things to refactor)

Browsing the documentation, I noticed some issues related to conformance with idiomatic Rust, i.e. examples of poor bindings crate design. Fixing some of these would require breaking changes. Here's a list of what I've found so far:

  • Vk*_T types in the root module. These are obviously used during interop with the Vulkan API.

    The reason why this is not idiomatic at all is because the structures are related to Vulkan, not OpenVR. The best solution would be to use feature flags to select dependencies on different API crates (the two possibilities are d3d12 and vulkano). Having none of these features would disable the functionality related to interop with these APIs, while enabling them will enable optional dependencies on the aforementioned binding crates. This entire section has been rethought into putting the interop types into a separate module rather than using ones from a specialized crate since there are multiple crates for Vulkan, meaning that using them is likely to bring unwanted dependencies for those who use a different crate.

  • Usage of indices instead of newtypes.

    One example is the TrackedDeviceIndex type. By refactoring it into TrackingDevice, we'd abstract away the fact that OpenVR uses u32 for that. (Done, TrackedDeviceIndex has been replaced by TrackedDevice, which borrows the System to make sure that devices don't outlive the OpenVR instance.) The 3 points of the newtype pattern are error case reduction via validation, language types with semantics and API consistency. Index type definitions have to be refactored into that.

  • Use of the dedicated property and button_id modules instead of enumerations.

    Done (See the edit history for a detailed description).

  • Documentation issues.

    Some parts remain undocumented, others are unclear or incorrectly formatted.

I'd easily implement all of these changes myself: I set this up as a tracking issue for unidiomatic design rather than call for help.

Use of mem::uninitialized() in poll_next_event_with_pose causes panic

I run into the issue that calling poll_next_event_with_pose will results in a panic:

thread 'main' panicked at 'attempted to leave type `tracking::TrackedDevicePose` uninitialized, which is invalid', C:\Users\info\.cargo\registry\src\github.com-1ecc6299db9ec823\openvr-0.6.0\src\system\mod.rs:127:33
Stack backtrace:
stack backtrace:
 0: std::panicking::begin_panic_handler
           at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\std\src\panicking.rs:584
 1: core::panicking::panic_fmt
           at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\core\src\panicking.rs:142
 2: core::panicking::panic
           at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\core\src\panicking.rs:48
 3: core::mem::uninitialized
           at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f\library\core\src\mem\mod.rs:685
 4: openvr::System::poll_next_event_with_pose
           at C:\Users\info\.cargo\registry\src\github.com-1ecc6299db9ec823\openvr-0.6.0\src\system\mod.rs:127
 5: rust_test::main
           at .\src\main.rs:5
 6: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
           at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f\library\core\src\ops\function.rs:248
Sample code to reproduce:
fn main() {
  let context = unsafe { openvr::init(openvr::ApplicationType::Overlay) }.unwrap();
  let system = context.system().unwrap();
  while let Some((event_info, pose)) = system.poll_next_event_with_pose(openvr::TrackingUniverseOrigin::Standing) {
    println!("[D:{}] {:?} {:?}", event_info.tracked_device_index, event_info.event, pose);
  }
}

I have submitted a PR with a potential fix for this in #52.

Needs update for 1.0.15

There's significant changes in OpenVR since 1.0.10, especially in the input system.

Is this still being maintained?

[WIP] Camera subsystem in OpenVR 1.0.1

We should definetly implemenrnt the new camera features!
Valve also added the error function that i asked them for ๐Ÿ˜€

I will definitely work on that. Any other feature is not really important for now.

Render model indices

While I'm not exactly sure what's the expected behavior here, I do think there is something odd going on. Attempting to call indices for each tracker model that is found with the following debug messages:

pub fn indices(&self) -> &[u16] {
    unsafe {
        let model = &*self.ptr;
        println!("tri count {}", model.unTriangleCount);
        println!("model.rIndexData = {:?}", model.rIndexData);
        eprintln!("model.unVertexCount = {:?}", model.unVertexCount);
        eprintln!("slice = {:?}", slice::from_raw_parts(model.rIndexData, 3 * model.unTriangleCount as usize));
        slice::from_raw_parts(model.rIndexData, 3 * model.unTriangleCount as usize)
    }
}

yields this output:

tri count 0
model.rIndexData = 0x16ba00007f2a
model.unVertexCount = 17454
slice = []
tri count 1
model.rIndexData = 0x9ae00007f2a
model.unVertexCount = 2638
slice = [
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

I find it hard to believe that the models don't have any indices first of all and that segfault isn't what I would call expected behavior. This is all on Fedora 28 by the way. If somebody could assist me in debugging this or maybe just tell me that it's a known bug / quirk, that would be very appreciated. ๐Ÿ˜„

Update for SDK 1.0.12

The recently released v1.0.12 has numerous improvements that'd be really nice to have access to from Rust.

can't build library

I am currently running a fresh install of Arch Linux, and I installed cmake like the first error told me, but now it's giving me a different error:

   Compiling openvr v0.6.0
error[E0793]: reference to packed field is unaligned
  --> /home/itzscythe/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openvr-0.6.0/src/system/event.rs:19:79
   |
19 |             event: Event::from_sys(x.eventType as sys::EVREventType, unsafe { &x.data }),
   |                                                                               ^^^^^^^
   |
   = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
   = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)

For more information about this error, try `rustc --explain E0793`.
error: could not compile `openvr` (lib) due to previous error

this is not specific to any file, running cargo build causes this error to happen.

Can't build example/test.rs on windows

Hey! I am unable to build the test example on windows:

$ cargo build --example test --verbose
       Fresh cc v1.0.31
       Fresh lazy_static v0.2.11
       Fresh cmake v0.1.35
       Fresh openvr_sys v2.0.2
   Compiling openvr v0.5.2 (C:\Users\Jasper\Projects\rust\rust-openvr)
     Running `rustc --crate-name test 'examples\test.rs' --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=76ae35b6ee8a0fe7 -C extra-filename=-76ae35b6ee8a0fe7 --out-dir 'C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\examples' -C 'incremental=C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\incremental' -L 'dependency=C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\deps' --extern 'lazy_static=C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\deps\liblazy_static-1309704301958f6f.rlib' --extern 'openvr=C:\Users\Jasper\Projects\rust\rcargo build --example testust-openvr\target\debug\deps\libopenvr-788fe8c0faa9851b.rlib' --extern 'openvr_sys=C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\deps\libopenvr_sys-1dc62b2cacb72b53.rlib' -L 'native=C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\build\openvr_sys-3d39fe55b39ce57f\out/lib'`
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.14f2vorxzkn0vidt.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.15npsivgflvkzks.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.18dxkai26s8kec9t.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.18gwephxh5sm8aza.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.1a6dndmil15b9553.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.1govy6jstfee94ae.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.1mril3ldbyc2b1pl.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.1r3kp10g4xggbnou.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.1zxfk6eo74nd1fz1.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.23oi1xialdfw3fnx.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.2522u21jmpyu3ymj.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.26jz9cyoj4pyjssh.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.2fo7o2cdi8kok3pk.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.2i0lpumziqbln92z.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.306eh2y5afyyiihf.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.308316j1u5ple9h8.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.32ioub3cl1eip0q3.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.338nlw4mnveswzt4.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.34bv57mi9yinw19b.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.36yamz4vmuax6iv5.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.379iuumx70c1booo.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.37p5hceek847np3q.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.3bc0c3jeozfog02w.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.3l1aekeh5dzojnoe.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.3svd6phnasunumj7.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.3yo8fo4sn39bd166.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.44y1g24e5yxr5ssd.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.4a99tc317djbt5k0.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.4r60qjkjy6oj7vx5.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.4xm9oq664f5wbzbr.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.58yfclgxncoyxppf.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.5bp6vl5icte980nh.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.bv1yu906qf15mse.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.c8vaizxyvgy2tex.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.e55bfebcm26w6ps.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.f3lm9ypoikg7aru.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.giigik4kcl63jzs.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.io3remeo8iuyoj4.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.ty17yvygtdcb6ot.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.x39ffh86elb5lyd.rcgu.o" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.zgei2hn7095sx96.rcgu.o" "/OUT:C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.exe" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\examples\\test-76ae35b6ee8a0fe7.2ionubl70vv3qnoj.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\deps" "/LIBPATH:C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\build\\openvr_sys-3d39fe55b39ce57f\\out/lib" "/LIBPATH:C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\deps\\libopenvr-788fe8c0faa9851b.rlib" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\deps\\liblazy_static-1309704301958f6f.rlib" "C:\\Users\\Jasper\\Projects\\rust\\rust-openvr\\target\\debug\\deps\\libopenvr_sys-1dc62b2cacb72b53.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-3be6ac1114b14fa9.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-2acbe9f11ad99028.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libbacktrace_sys-02d26172a291c7c1.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-8e24e48754158417.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-670c55144854e053.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-ecb1697ce7fb6936.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-22198aca0b14133e.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-4ab90f1f02345891.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-b98f41fa2dac386b.rlib" "C:\\Users\\Jasper\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-5fcb08748623a7c4.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "msvcrt.lib"
  = note:    Creating library C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\examples\test-76ae35b6ee8a0fe7.lib and object C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\examples\test-76ae35b6ee8a0fe7.exp
          libopenvr_sys-1dc62b2cacb72b53.rlib(pathtools_public.obj) : error LNK2019: unresolved external symbol __imp_SHGetFolderPathW referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl GetUserDocumentsPath(void)" (?GetUserDocumentsPath@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
          libopenvr_sys-1dc62b2cacb72b53.rlib(vrpathregistry_public.obj) : error LNK2001: unresolved external symbol __imp_SHGetFolderPathW
          C:\Users\Jasper\Projects\rust\rust-openvr\target\debug\examples\test-76ae35b6ee8a0fe7.exe : fatal error LNK1120: 1 unresolved externals


error: aborting due to previous error

libovr or openvr?

Hi there, I randomly stumbled on this repo and I noticed it's binding against Valve's OpenVR (actually what I was looking for) while the description says it's binding against LibOVR which is the name for Oculus's SDK.

Am I mistaken, or should the description be updated accordingly?

(The names of openvr vs libovr are totally confusing.)

Seems to be broken since upgrading to SteamVR 1.7.15

For example, calling System::recommended_render_target_size fails with the following error:

error: process didn't exit successfully: `target\debug\rust-vr-demo-02.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

Process finished with exit code -1073741819 (0xC0000005)

If I make up some target size just to get past that call, then it fails calling System::projection_matrix next, so it seems like it might be a problem with the System instance itself.

This is code that worked before the SteamVR as-is.

State of maintainership?

Hello ๐Ÿ‘‹

I've been reading the discussions surrounding this rust library, and, as far as I understand, there are no plans from the org to do any significant work to these OpenVR bindings. (c.f.: #47 (comment))

Currently, this crate is helpful but technically needs to be updated with Valve's current version of the OpenVR SDK. It also needs to be completed (lacking support for a number of still useful graphics API. e.g., Direct3D 11, see #56). There is also a large number of forks with potentially useful patches that are not contributing upstream (the joys of free and open source software in the era of GitHub, I guess ๐Ÿ˜‰)

I understand that OpenXR is available, but some people want to concentrate their efforts there. But OpenVR is still the main API to access several functionalities of SteamVR that are not provided by the OpenXR 1.0 standard notably:

  • SteamVR Drivers : The ability to write a plugin that extends the functionalities of SteamVR, for example: targeting different hardware for rendering and inputs.
  • SteamVR Overlay applications Currently, there is no real solution to do native OpenXR overlays. This is a whole class of VR applications that cannot use OpenXR and probably will not for a long time. The XR_EXTX_overlay extension is only provisional (meaning: experimental) and is not actually implemented by any OpenXR runtime currently. The only implementation is an extremely hacky API Layer by LunarG that isn't maintained actively.
  • SteamVR Background application There is no good way to create an OpenXR application that only receives inputs and does no do rendering. This is partially doable if you have support for the (non multi-vendor) XR_MDN_headless extension for example. This does not map 1:1 with OpenVR-provided functionalities...

Thus, IMHO the idea that OpenVR is not useful anymore is incorrect. I understand that the maintainer's interest might have switched from using OpenVR to instead using OpenXR, and that's perfectly fine! ๐Ÿ™‚

I'd like to have some clarity on the state of the future of this crate and eventually offer some help in keeping it up-to-date / implementing missing functionalities... ๐Ÿค”

(Context: we're looking at Rust at my day job for a number of things. I work for a company in the XR space that still heavily uses SteamVR and OpenVR in its products for a number of the reasons listed above...)

Linux build failing

Test status is currently red (failing)

Travis (Linux) seems to have a problem with finding the library for some reason

DLL placement

Where exactly do I need to be placing the DLL?

I've placed it in the project root (where Cargo.toml is), where the .exe is, and everywhere else I can think of and I'm still getting a "test.exe has stopped working" from Windows when calling openvr::init() =/

Remove the need of constants, enums etc.. directly from openvr_sys

As a programmer I don't want to use constants from openvr_sys directly.
They've the name of the original openvr sdk headers, and are long and do not apply to general rust coding guidelines. The only available wrapper is the Eye enum.

  • Error enums
    -- A nice wrapper should be made here, also openvr provides a function to stringify these enum errors
  • Device Property and Device Class
    -- Simple wrapper with nice naming

I think this blocks the crates.io release

[Discussion] Unit tests

Right now we don't have any tests.

The only way I can currently think of, is by creating (or using) a small dummy openvr driver. Travis probably won't really work with this approach but I can provide a jenkins ci on my ec2 instance.

Feel free to discuss here about tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.