spout-rs
Rust bindings for Spout2 — GPU texture sharing on Windows via DirectX 11 and OpenGL.
Requirements
- Windows only (Spout2 is a Windows-exclusive library)
- Spout2 SDK headers — set
SPOUT2_SDK_DIRto the directory containingSpoutSender.h(e.g.vendor/Spout2/SPOUTSDK/SpoutGL). Defaults to the vendored submodule when building from a spout-rs clone, so this only needs to be set by downstream consumers. - A compiled
Spout.libimport library — setSPOUT2_LIB_DIRto its containing directory Spout.dllonPATHat runtime (found incmake-build/bin/Releaseafter building)
Building
After cloning, run the bootstrap task to install git hooks, initialise submodules, and compile Spout2:
Then set SPOUT2_LIB_DIR before building or running tests:
Consuming from another workspace
The published crate excludes vendor/, so downstream consumers must point the build
script at their own copy of the Spout2 SDK headers and import library:
Both can be wired up in a workspace's .cargo/config.toml [env] block with
relative = true so developers don't need to set them per-shell.
Usage
Sender
use SpoutSender;
let mut sender = new;
// Each frame, after rendering to a texture:
sender.send_texture;
sender.hold_fps;
Receiver
use SpoutReceiver;
let mut receiver = new;
// Each frame:
if receiver.is_connected