libmx2 2.2.1
C++20 multimedia and game-engine library (SDL2 / OpenGL / Vulkan)
Loading...
Searching...
No Matches
mxvk_cv OpenCV/Vulkan Bridge

OpenCV capture integration for the Vulkan backend (vk_cv.hpp). More...

Collaboration diagram for mxvk_cv OpenCV/Vulkan Bridge:

Classes

class  mx::MXCapture
 OpenCV video capture source that renders via an OpenGL sprite. More...

Detailed Description

OpenCV capture integration for the Vulkan backend (vk_cv.hpp).

Provides the Vulkan-flavoured mx::MXCapture implementation that uploads OpenCV frames to mx::VKSprite for rendering in mx::VKWindow.


Features

  • SDL2 integration — simplified setup and management of SDL2 subsystems.
  • Modern C++20 design — concepts, ranges, and structured bindings throughout.
  • Optional OpenGL / GLAD / GLM — compile-in with -DOPENGL=ON.
  • Optional Vulkan / MoltenVK — compile-in with -DVULKAN=ON.
  • Cross-platform — Linux, macOS (MoltenVK), and Emscripten (WebAssembly).
  • Command-line argument parser — header-only Argz<> template (argz.hpp).
  • In-app GL console — scrollable, thread-safe, shader-rendered console overlay.
  • 3D model loading — OBJ mesh loader with CPU-side deform, bend, twist, wave, and morph operations.
  • Vulkan sprite/text rendering — instanced sprite batching and SDL_ttf text via Vulkan pipelines.

Prerequisites

  • C++20 compiler (GCC 10+, Clang 10+, MSVC 2019+)
  • SDL2, SDL2_ttf, SDL2_mixer, libpng, zlib
  • Optional: OpenGL / GLM (includes GLAD headers)
  • Optional: Vulkan SDK / MoltenVK

Building

Quick build (using the provided Perl scripts):

./compile.pl
./run.pl program_name

CMake build:

git clone https://github.com/lostjared/libmx2.git
cd libmx2
mkdir build && cd build
cmake -B . -S ../libmx
make -j$(nproc)

Enable Vulkan support:

cmake -B . -S ../libmx -DVULKAN=ON

Key Classes

Class Header Description
mx::mxWindow mx.hpp Main SDL2 application window — subclass and override draw() / event().
gl::GLWindow gl.hpp SDL2 + OpenGL window; adds shader program and sprite support.
gl::ShaderProgram gl.hpp GLSL shader compilation, linking, and uniform upload.
gl::GLSprite gl.hpp Textured quad rendered with a custom shader.
mx::Model model.hpp OpenGL 3D mesh with extensive CPU deformation API.
console::GLConsole console.hpp Shader-rendered in-app console with command history.
mx::VKWindow vk.hpp Vulkan window with swap-chain, pipeline, and render-pass management.
mx::VKSprite vk_sprite.hpp Vulkan 2D sprite renderer with instancing support.
mx::VKText vk_text.hpp Vulkan text renderer using SDL_ttf glyph atlases.
mx::MXModel vk_model.hpp Vulkan 3D mesh loader (OBJ / MXMOD) with GPU buffer management.
mx::VKAbstractModel vk_abstract_model.hpp High-level Vulkan model wrapper with per-model shaders, textures, UBOs, and descriptors.
mx::ConfigFile cfg.hpp INI-style configuration file reader/writer.
Argz<String> argz.hpp Lightweight template command-line argument parser.
mx::TeeStream tee_stream.hpp Dual-output stream that writes to both stdout/stderr and a log file.
mx::mxJoystick joystick.hpp SDL2 joystick and game controller input wrapper.
mx::Exception exception.hpp Library-wide exception type with descriptive text.
mx::mxUtil util.hpp Asset path resolution and general utility helpers.
mx::MXCapture (GL) gl_cv.hpp OpenCV capture bridge for the OpenGL backend.
mx::MXCapture (VK) vk_cv.hpp OpenCV capture bridge for the Vulkan backend.