C: Vulkan Interop#
Demonstrates how to integrate ovrtx with Vulkan by sharing renders on the GPU.
The example maps ovrtx outputs to CUDA arrays every frame, then copies them to CUDA-exported VkImage memory. A fullscreen quad samples the resulting textures to display the render in real time in a GLFW window. Memory access between CUDA and Vulkan is synchronized using timeline semaphores.
The example also demonstrates viewport picking, marquee selection, and styled selection rendering. Left-click picks the prim under the cursor, left-drag performs marquee selection with a Vulkan overlay rectangle, selected prim paths are printed to stderr, and selected prims are highlighted with a custom outline color and translucent fill.
Any scene used with picking must restrict the picked RenderProduct to CUDA-visible GPU 0 with uint[] deviceIds = [0].
“Create a C++ interactive viewer that renders ovrtx camera output directly into a Vulkan presentation path through CUDA interop, with GPU selection, GPU image mapping, exported-image copies, explicit synchronization, double buffering, orbit camera controls, finite-frame capture, and click or marquee picking with selection outlines.”
Build and Run#
Prerequisites
sudo apt install build-essential cmake
If ovrtx or glfw3 are already installed and available via CMAKE_PREFIX_PATH, the local installations are used. Otherwise they are downloaded automatically at configure time. Other dependencies (GLM, volk, unordered_dense) are always downloaded via FetchContent.
Building
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
Running
./build/ovrtx-interop
Prerequisites
If ovrtx or glfw3 are already installed and available via CMAKE_PREFIX_PATH, the local installations are used. Otherwise they are downloaded automatically at configure time. Other dependencies (GLM, volk, unordered_dense) are always downloaded via FetchContent.
Building
cmake -B build
cmake --build build --config Release
Running
.\build\Release\ovrtx-interop.exe
Scene Configuration#
The example is configured to load the robot scene from Omniverse:
Setting |
Value |
|---|---|
USD Scene |
|
Render Product |
|
Up Axis |
Z |
Units |
Meters |
Controls#
Right-click and drag — Rotate camera around the target point
Left-click — Pick the prim under the cursor and print its path
Left-click and drag — Marquee-select prims and print their paths
Mouse wheel — Dolly camera in/out
Licensing#
This example contains stb_image_write.h, © Sean Barrett, released under Public Domain.