Zig build package and bindings for https://github.com/ValveSoftware/openvr
  • Zig 54.2%
  • C 45.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-24 13:50:00 +01:00
.github/workflows Basic compile check for CI 2026-10-24 13:50:00 +01:00
libs/openvr files from monorepo @ 14e6258901c6fb47ae598705682837ef6c298e60 2024-11-04 00:24:37 +00:00
src Basic compile check for CI 2026-10-24 13:50:00 +01:00
.gitattributes git lfs stuff 2025-11-22 19:23:31 +00:00
.gitignore files from monorepo @ 14e6258901c6fb47ae598705682837ef6c298e60 2024-11-04 00:24:37 +00:00
.lfs-content-token git lfs stuff 2025-11-22 19:23:31 +00:00
build.zig Basic compile check for CI 2026-10-24 13:50:00 +01:00
build.zig.zon Merge pull request #4 from perttuvep/zig-0.16.0 2026-05-29 10:35:51 +01:00
LICENSE files from monorepo @ 14e6258901c6fb47ae598705682837ef6c298e60 2024-11-04 00:24:37 +00:00
README.md files from monorepo @ 14e6258901c6fb47ae598705682837ef6c298e60 2024-11-04 00:24:37 +00:00

zopenvr

Zig build package and bindings for OpenVR v2.2.3

Work in progress

Interface Status
Applications ✅
BlockQueue
Chaperone ✅
ChaperoneSetup
Compositor ✅
(d3d12 only)
Debug
DriverManager
ExtendedDisplay
HeadsetView
Input ✅
IOBuffer
Notifications
Overlay
OverlayView
Paths
Properties
RenderModels ✅
Resources
Screenshots
Settings
SpatialAnchors
System ✅
TrackedCamera

Getting started

Example build.zig:

pub fn build(b: *std.Build) !void {
    const exe = b.addExecutable(.{ ... });

    const zopenvr = b.dependency("zopenvr", .{});

    exe.root_module.addImport("zopenvr", zopenvr.module("zopenvr"));

    try @import("zopenvr").addLibraryPathsTo(zopenvr, exe);
    try @import("zopenvr").installOpenVR(zopenvr, &exe.step, target.result, .bin);
    @import("zopenvr").linkOpenVR(exe);
}

Now in your code you may import and use zopenvr:

const std = @import("std");
const OpenVR = @import("zopenvr");

pub fn main() !void {
    ...

    const openvr = try OpenVR.init(.scene);
    defer openvr.deinit();

    const system = try openvr.system();

    const name = try app.system.allocTrackedDevicePropertyString(allocator, OpenVR.hmd, .tracking_system_name);
    defer allocator.free(name);

    ...
}