Skip to content
JordanCppPublic

About

A lightweight, unified 2D development library with hardware acceleration and ultimate backward compatibility from modern systems to Windows 95.

Topics

Resources

Stars

140 stars

Watchers

9 watching

Forks

Repository files navigation

🌉 LDL - Little Directmedia Layer

Bridge Between Eras: Compatible Multimedia Layer

License: LGPL v3 License: CC0 (Examples) C Standard Windows Linux FreeBSD macOS Web

LDL is not just a cross-platform library, but a bridge between different development eras. We provide compatible APIs for popular multimedia libraries, allowing modern code to run on legacy platforms and vice versa.


Documentation

The full project documentation is located in the docs folder.


The Philosophy of the LDL Library (Click to expand) 🕰️ The Human Story Behind the Code "I am passionate about studying the history of IT. For me, it's not merely about computers and programs, but about the remarkable human endeavor behind them."

🌟 The Deeper Narrative of Computing

💡 A Chronicle of Human Ingenuity

Exploring information technology history transcends mere timelines of processors and operating systems. It's a profound immersion into the saga of human thought, perseverance, and incredible inventiveness. Each breakthrough represents triumphs achieved within often severely constrained resources.

👥 The Architects of Our Digital World

Behind every byte, algorithm, and system architecture stand extraordinary individuals. Visionary engineers, pioneering programmers, and brilliant minds whose monumental labor. Their often-invisible work laid the foundation for our entire digital reality.

🎨 The Art of Computational Problem-Solving

Analyzing legacy systems reveals embodied intellectual battles with computing machines. Every line of code was meticulously crafted and earned through intense effort. Each command represented a small victory in making limited hardware perform miracles.

🔮 From Abstract Theory to Tangible Reality

Witness how abstract logical constructs and mathematical theories transformed into world-changing devices. This alchemy of human determination turning concepts into functional technology. Stands as one of humanity's most remarkable demonstrations of creative genius.

👥 The Birth of Digital Communities

Beyond technical specifications lies the rich tapestry of creative contexts and enthusiast communities. Early programmers forming the first collaborative cultures around primitive machines. Sharing ingenious hacks and establishing development traditions that shaped modern IT.

🏛️ Preserving Intellectual Heritage

Projects like LDL serve as guardians of technological legacy. We maintain not just functional code, but fragments of intellectual inheritance. Each preserved system honors someone's contribution to our collective progress.

📖 The Living History of Innovation

Every deprecated library represents a chapter in humanity's quest for knowledge. My fascination stems from understanding not what was built, but how and by whom. Seeking to comprehend the very spirit of each era and the people who shaped it.

"We stand on the shoulders of giants whose names we often forget, but whose work continues to shape our world every day."


Features

Feature Support
Windowing ✅ Create, resize, move, close
Events ✅ Keyboard, mouse, resize, quit, focus
Keyboard ✅ Full key mapping (including F1–F15, numpad, modifiers)
Mouse ✅ Move, click (LMB/RMB/MMB), scroll wheel
2D Render ✅ Draw: Line, Fill, Texture, Texture alpha
3D Render ✅ OpenGL: 1.2, 2.0, 3.0
Image support ✅ Load: JPEG, PNG, TGA, BMP, PSD, GIF, HDR, PIC, PNM
TTF support ✅ ttf: load, color, draw
OpenGL 1.0 ✅ Immediate mode, fixed pipeline
OpenGL 1.1–1.5 ✅ Extensions, texture objects, VBO
OpenGL 2.0–2.1 ✅ GLSL 1.20, shaders, FBO
OpenGL 3.0–3.3 ✅ GLSL 3.30, VAO, geometry shaders
OpenGL 4.0–4.6 ✅ GLSL 4.60, compute shaders, tessellation
WebGL 1.0 ✅ GLSL ES 1.00, shaders, VBO (via Emscripten)
WebGL 2.0 ✅ GLSL ES 3.00, VAO, instancing (via Emscripten)

Supported Platforms

Operating System Versions Status
Windows 95, 98, ME, 2000, XP, Vista, 7, 8, 10, 11 ✅ Full support
Linux Kernel 2.0+ (1996–present) ✅ Full support
FreeBSD 3.0+ (1998–present) ✅ Full support
macOS 10.12-10.15, 11-26 (2016-present) ✅ Full support*
OS X 10.8–10.11 (2012–2015) ✅ Full support
Mac OS X 10.6, 10.7 (2009-2011) ✅ Full support
Web (Browser) Chrome 56+, Firefox 51+, Safari 15+, Edge 79+ ✅ Full support**

*Note: due to Apple's policy, macOS does not support OpenGL 4.1+

**Note: OpenGL 4.x features (compute shaders, tessellation, GLSL 4.x) are unavailable in the browser by design.


Retro & Modern

  • Classic systems: Windows 95/98/ME, old Linux kernels, legacy FreeBSD, OSX
  • Modern systems: Windows 10/11, modern Linux distributions, latest FreeBSD, macOS
  • Web: Any modern browser via Emscripten, same source code, zero browser-specific changes

Tested Compilers

Platform Compilers
Windows MSVC 6.0–2022, MinGW, Borland C++ 5.5, OpenWatcom
Linux GCC 2.95–14, Clang 3.0–18
FreeBSD GCC (system default), Clang
macOS Apple clang version 14.0.0
Web Emscripten (emcc)

✨ Key Principles

  • 🌉 Bridge, Not Replacement - we complement the ecosystem, don't compete with it
  • 🆓 Free for Everyone - completely free for any use
  • 💡 Open to Ideas - we consider and welcome all community ideas
  • 🔄 Old & New Platform Support - from Windows 95 to modern systems and browsers
  • 🏛️ Legacy Preservation - let old code live in the new world
  • 🔧 Developer Freedom - we don't restrict the developer
  • 🌍 Cross-Platform - work across multiple operating systems and the web
  • 📚 Static & Dynamic Linking - developer chooses the build method

🛠️ Build & Install

Installation Guide for LDL

This guide explains how to build and install the LDL library using CMake.

Prerequisites

Ensure you have the following installed:

  • CMake 3.12 or higher
  • A C++ compiler (GCC, Clang, or MSVC)
  • Development libraries for X11 and OpenGL (on Linux)

Build Options

You can customize the build using the following CMake options:

Option Description Default
LDL_BUILD_LIBRARY_STATIC Build LDL as a static library (.a / .lib) ON
LDL_BUILD_LIBRARY_SHARED Build LDL as a shared library (.so / .dll) OFF
LDL_BUILD_EXAMPLES Enable building example projects OFF
LDL_ENABLE_INSTALL Enable the install target OFF

Quick Start (Terminal)

  1. Clone the repository:

    git clone https://github.com/JordanCpp/LDL.git
    cd LDL
  2. Configure the project: Use the -B flag to create a build directory and -D to set options. For example, to build a static library with examples:

    cmake -B build -DLDL_BUILD_LIBRARY_STATIC=ON -DLDL_BUILD_EXAMPLES=ON
  3. Build the project:

    cmake --build build
  4. Install (Optional): If you enabled LDL_ENABLE_INSTALL, run:

    sudo cmake --install build

Building for Web (WebAssembly)

LDL supports compilation to WebAssembly via Emscripten, producing .html + .js + .wasm output that runs directly in any modern browser.
The same C source code compiles for both native and web targets without modification.

Prerequisites

Install and activate the Emscripten SDK:

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh

Build

mkdir build-wasm && cd build-wasm
emcmake cmake .. \
    -DCMAKE_BUILD_TYPE=Release \
    -DLDL_BUILD_EXAMPLES=ON
cmake --build . -j$(nproc)

Run

cd bin
python3 -m http.server 8080
# open http://localhost:8080/Emscripten_Triangle.html

Web platform notes

Native Web (Emscripten)
Main loop while (LDL_WindowIsRunning(...)) emscripten_set_main_loop(frame, 0, 1)
File I/O Real filesystem MEMFS via --preload-file (FILES param)
OpenGL 1.0–4.6 WebGL 1 (ES 2.0) / WebGL 2 (ES 3.0)
Fixed pipeline ✅ glBegin/glEnd ❌ Not available in WebGL

Example: Building with Specific OpenGL Versions

If you want to build specific examples, you can toggle them:

cmake -B build -DLDL_BUILD_EXAMPLES=ON -DLDL_BUILD_EXAMPLES_OPENGL3=ON
cmake --build build

🤝 Contributing

We welcome contributions! Whether it's:

  • Bug reports and fixes
  • New feature implementations
  • Documentation improvements
  • Platform porting
  • API compatibility enhancements

Please feel free to open issues and pull requests.

License

Component License
LDL library LGPLv3
Examples CC0 1.0 Universal (Public Domain)
  • The LDL library is licensed under the GNU Lesser General Public License v3.0. You can use it in both open-source and proprietary projects (with dynamic linking).

  • The example code is dedicated to the public domain under CC0 1.0. You can copy, modify, and use the examples in any project without restrictions.


Screenshots

Fonts examples

fireworksshow font1 font2
fireworksshow font1 font2
fontsizegallery fontstylemixer fontstylemixer2
fontsizegallery fontstylemixer fontstylemixer2
fontstylemixer3 fontstylemixer4 fontstylemixer5
fontstylemixer3 fontstylemixer4 fontstylemixer5
fontstylemixer6 fontstylemixer7 fontstylemixer8
fontstylemixer6 fontstylemixer7 fontstylemixer8

2D Render Examples

Boids Simulation Conway's Game of Life Firework Demo
Boids Simulation Conway's Game of Life Firework Demo
Fog of War Demo Fractal Tree Fractal Tree 2
Fog of War Demo Fractal Tree Fractal Tree 2
Kaleidoscope Demo Particle System Rain Effect
Kaleidoscope Demo Particle System Rain Effect
Spirograph Tile map
Spirograph Tile map

OpenGL 1.2 Examples

3D Atom Model Animated 3D Terrain Falling Particles
3D Atom Model Animated 3D Terrain Falling Particles
Fireworks Show First Person Maze Interactive 3D Cube
Fireworks Show First Person Maze Interactive 3D Cube
Move Rotate Rotating 3D Cube
Move Rotate Rotating 3D Cube
Rotating Colorful Torus Snowfall Particles Solar System
Rotating Colorful Torus Snowfall Particles Solar System
Terrain Flight Water Wave Simulation
Terrain Flight Water Wave Simulation

OpenGL 2.1 Examples

Shader Cube Solar System Textured Terrain
Shader Cube Solar System Textured Terrain

OpenGL 3.3 Examples

Animated Water Surface Planet With Moon Rotating Cube
Animated Water Surface Planet With Moon Rotating Cube
Textured Sphere
Textured Sphere

Emscripten / WebAssembly Examples

Textured Triangle
Textured Triangle (WebGL 1, GLSL ES 1.00)

Legend

Icon Meaning
🟢 OpenGL 1.2 Immediate mode, fixed pipeline, retro style
🔵 OpenGL 2.1 VBO, shaders, modern pipeline foundations
🔴 OpenGL 3.3 Core profile, VAO, advanced shaders
🟡 WebGL 1.0 GLSL ES 1.00, runs in any modern browser

LDL - One Foundation, Many Interfaces. Built to Last. 🚀

About

A lightweight, unified 2D development library with hardware acceleration and ultimate backward compatibility from modern systems to Windows 95.

Topics

Resources

Stars

140 stars

Watchers

9 watching

Forks

Releases

Used by

Contributors

Languages