$ show leadedge/Spout2
Spout2 is a mature, production-grade C++ SDK and library for real-time GPU texture sharing between Windows applications. It supports sharing OpenGL, DirectX 9, DirectX 11, and DirectX 12 textures across processes, primarily used in creative coding, VJing, projection mapping, and live video workflows. The architecture centers on a sender/receiver pattern backed by named shared memory for metadata and NVIDIA WGL_NV_DX_interop or DirectX staging textures for GPU-to-GPU transfer. Multiple API layers exist: a full OpenGL interop class (SpoutGL), DirectX-only wrappers (SpoutDX, SpoutDX9, SpoutDX12), and a C-compatible DLL (SpoutLibrary). The SDK includes extensive example projects for Win32, openFrameworks, Cinder, and DirectX tutorials. Core utilitiesβSpoutSharedMemory, SpoutFrameCount, SpoutCopy, SpoutUtilsβare well-encapsulated and demonstrate strong systems programming skill. However, the codebase shows signs of age: heavy reliance on Windows registry, conditional compatibility layers for legacy 2.006 mode, duplicate header copies across tutorial folders, and manual resource management. Technical drift is medium due to dependence on NVIDIA-specific GPU interop and DirectX 9/11, though the library remains functional on modern Windows with active maintenance and a responsive issue tracker.
The LLM identified 4 files worth highlighting for reuse:
A standalone utility library providing logging (console/file, log levels), a replacement MessageBox with timeout and custom controls (SpoutMessageBox via TaskDialogIndirect), registry read/write helpers, and a high-resolution timer. All functions are self-contained with only Windows dependencies. Can be extracted and reused in any Windows C++ project needing simple yet robust logging or dialog utilities.
Provides a set of pixel format conversion functions (RGBA, BGRA, RGB, BGR, etc.) with support for vertical flip, mirror, resampling, and padding removal. Implements SSE2/SSE3/SSSE3 accelerated paths detected via CPUID, with ARM NEON fallback. The functions are overloaded for source/destination pitch and are independent of the rest of the Spout SDK. Ideal for any real-time video pipeline requiring fast pixel manipulation on Windows.
A clean C++ wrapper around Windows named memory-mapped files and named mutexes. Exposes Create/Open/Close/Map/Unmap operations with automatic cleanup. Used by Spout to share sender names and texture metadata between processes. The class is self-contained and demonstrates a robust pattern for interprocess shared memory with mutex-based synchronization, reusable for any Windows IPC scenario.
Manages frame counting, sender/receiver synchronization, and frame-rate hold via Windows semaphores and mutexes. Provides IsFrameNew(), SetNewFrame(), WaitFrameSync(), SetFrameSync() and HoldFps(). The implementation is encapsulated and uses only Windows API primitives, making it extractable for any real-time data sharing system that needs to synchronize producer and consumer across processes with minimal CPU overhead.