This repository contains example applications for the LEDCube matrixserver framework, demonstrating various 3D volumetric graphics, 2D matrix effects, and interactive games.
This is a fork of the original squarewavedot/exampleApplications repository with the following enhancements:
- Claude-generated documentation: Comprehensive documentation generated with Claude AI assistance
- macOS compatibility: CMake build system tweaks to compile on macOS
- Enhanced project structure: Improved organization and build configuration, matrixserver as a git submodule
The full project documentation is hosted on GitHub Pages and includes API references, tutorials, and examples.
This collection showcases the capabilities of the LEDCube matrixserver framework through various application types:
- CubeTestApp - Basic 3D functionality demonstration and testing
- Snake - Multi-player 3D Snake game with joystick input and AI opponents
- Genetic - Genetic algorithm color evolution visualization in 3D space
- Blackout3D - Minimal interactive 3D application template
- Breakout3D - Full-featured 3D Breakout game with physics and multiplayer support
- Rainbow - Particle system with IMU integration (Raspberry Pi only)
- Picture - Image display with animation support and file watching
- Genetic - Genetic algorithm visualization on 2D matrix displays
- PixelFlow/PixelFlow2/PixelFlow3 - Fluid dynamics particle simulations
All applications inherit from either:
CubeApplicationfor 3D volumetric renderingMatrixApplicationfor 2D matrix effects
The framework provides:
- 3D Volumetric Rendering: Set voxels, draw 3D lines, render text on cube faces
- Multi-Screen Support: Six screens (front, right, back, left, top, bottom)
- Input Integration: Joystick, IMU (MPU6050), and ADC (ADS1000) sensor support
- Multiple Connection Types: TCP, IPC, and Unix socket communication with matrixserver
The matrixserver framework must be compiled and installed before building these example applications. The linker requires access to the libmatrixapplication library and related components.
Installation Steps:
-
Clone the matrixserver framework:
git clone https://github.com/squarewavedot/matrixserver.git cd matrixserver -
Build and install the framework locally (recommended):
mkdir -p build && cd build cmake .. -DCMAKE_INSTALL_PREFIX=../install make make install
This installs the framework into
matrixserver/install/, which the example applications pick up automatically without any extra configuration.Alternative - System-wide installation:
mkdir -p build && cd build cmake .. make sudo make install # Installs libraries to /usr/local/lib and headers to /usr/local/include sudo ldconfig
-
Verify installation:
# Local install (recommended) ls matrixserver/install/ # System-wide install ls /usr/local/lib/libmatrixapplication*
Required matrixserver components:
libmatrixapplication- Core application framework (version >= 0.3)- Header files for
CubeApplicationandMatrixApplicationbase classes - Server executable:
matrix_server(one binary; backend selected at runtime via--backend=<simulator|fpga-ftdi|fpga-rpispi|rgb-matrix>)
Troubleshooting:
- The build system checks
./matrixserver/install/first, then falls back to system paths - If using a custom install location, pass
-DCMAKE_PREFIX_PATH=/your/pathto CMake - Ensure all matrixserver dependencies are installed (Boost, OpenGL, etc.)
LC_RPATH gotcha when iterating on matrixserver alongside the example apps:
The example apps' CMake bakes only LC_RPATH = /usr/local/lib into each binary. So
when you make install matrixserver into a local matrixserver/install/ prefix, the
example app build picks up the new library at link time (the API is verified), but at
runtime the dynamic loader still falls back to /usr/local/lib/libmatrixapplication.*
— the previously installed system copy. The binary will silently run against the old
library.
To actually run an app against the freshly built matrixserver, point the loader at the install tree:
# macOS
export DYLD_LIBRARY_PATH=/path/to/matrixserver/install/lib
# Linux
export LD_LIBRARY_PATH=/path/to/matrixserver/install/lib
./build/bin/SnakeOr alternatively: sudo make install matrixserver to /usr/local so the existing rpath
matches (replaces the system copy), or on macOS patch the binary in place with
install_name_tool -add_rpath /path/to/matrixserver/install/lib build/bin/<App>.
- CMake
- Boost libraries (thread, log, system)
- Imlib2 (image processing)
- Google's Abseil library
# Clone the repository
git clone https://github.com/your-username/exampleApplications.git
cd exampleApplications
# Build all applications
mkdir -p build && cd build
cmake ..
make
# Or build specific applications
make cubetestapp # Basic 3D test
make snake # 3D Snake game
make breakout3d # 3D Breakout game
make picture # Image display-
Start a matrixserver instance:
# From matrixserver directory ./build/server/matrix_server # default: --backend=simulator ./build/server/matrix_server --backend=fpga-ftdi # for FPGA hardware (must be compiled in)
-
Run an example application:
./cubetestapp # Basic 3D demo ./snake # 3D Snake game ./picture image.png # Display image
Applications using the MPU6050 IMU sensor (like Rainbow) support configurable orientation corrections via matrixServerConfig.json:
{
"imuOrientation": {
"xyRotationDeg": 0.0,
"xzRotationDeg": 45.0,
"yzRotationDeg": 0.0
}
}The three rotation angles allow you to correct for how the sensor is physically mounted:
xyRotationDeg: Rotation around the Z axisxzRotationDeg: Rotation around the Y axisyzRotationDeg: Rotation around the X axis
All values default to 0° when absent, maintaining backwards compatibility.
- All Platforms: CubeTestApp, PixelFlow3, basic applications
- Raspberry Pi: Additional IMU-based applications (Rainbow, PixelFlow, PixelFlow2)
- macOS: Enhanced compatibility with updated CMake configuration
Applications work with the unified matrix_server binary, which selects a
renderer backend at runtime via --backend=<name>:
simulator— Software development and testing (always available)fpga-ftdi— FTDI USB interface for FPGA boardsfpga-rpispi— Raspberry Pi SPI interfacergb-matrix— Raspberry Pi GPIO matrix panels
Hardware backends are only selectable if they were compiled into the binary
via -DHARDWARE_BACKEND=… at build time. matrix_server --help lists which
backends the current binary supports.
Generate Debian packages for easy deployment:
make packageCreates .deb files with automatic matrixserver dependency resolution.
This project welcomes contributions! Please see the upstream repository squarewavedot/exampleApplications for the original codebase and contribution guidelines.
This project follows the same license as the upstream repository. License of upstream matrixserver
- Upstream Repository: squarewavedot/exampleApplications
- Documentation: GitHub Pages Documentation
- matrixserver Framework: Core framework for LED cube applications