A simple portability and ease-of-use driven graphics library based on OpenGL.
Started from forking pedroth's linux-framebuffer into 7ways.
Check out these instructions. And use "libqgl" as the package name.
Required build tools: make, gcc (or clang), pkg-config. On Debian/Ubuntu, a minimal install:
sudo apt-get install build-essential pkg-config libglfw3-dev libpng-dev libxxhash-devBuild the library:
makeBuild examples and tests:
make examples
make testIf you have an editor that uses a language server, then you'll get help about the functions in it.
Quick start:
#include <ttypt/qgl.h>
int main(void)
{
uint32_t w, h;
qgl_size(&w, &h);
qgl_fill(0, 0, w, h, 0xFF202020);
qgl_flush();
return 0;
}Backend selection:
- Windows/macOS use the GLFW backend (requires GLFW development libraries).
- Linux uses GLFW when the
DISPLAYenvironment variable is set (running under X11/Wayland); otherwise it falls back to the framebuffer backend when a compatible framebuffer device is available (this may require device permissions or running as root).
Modules:
- Core rendering + textures:
include/ttypt/qgl.h - UI layout + styling:
include/ttypt/qgl-ui.h - Bitmap fonts:
include/ttypt/qgl-font.h - Tilemaps:
include/ttypt/qgl-tm.h
Docs / manpages:
Manpages are provided when this project is packaged; if they are not installed on your system, consult the header files in include/ttypt/ for API documentation or read the source comments.
QGL includes a comprehensive test suite covering all public APIs:
# Build and run all tests
make test
# Build tests without running
make test-buildThe test suite includes 64 test functions across 8 test files:
- Core rendering and initialization
- Texture loading and drawing
- Font rendering and measurement
- Tilemap creation and rendering
- UI layout engine (flexbox-style)
- UI styling and caching
- Integration scenarios
See individual test files in tests/ for detailed API usage examples.
Six example programs demonstrate QGL features:
# Build all examples
make examples
# Run an example (requires test fixtures)
cd tests && python3 generate_fixtures.py && cd ..
LD_LIBRARY_PATH=./lib ./examples/01_basic_renderingAvailable examples:
01_basic_rendering.c- Basic QGL initialization and rendering02_textures.c- Texture loading and drawing03_fonts.c- Bitmap font rendering and text wrapping04_tilemaps.c- Tilemap creation and rendering05_ui_layout.c- Flexbox-style UI layout06_ui_advanced.c- Advanced UI with styling and caching
See examples/README.md for detailed descriptions and build instructions.
Note: To generate the test fixtures required by some examples, run:
cd tests && python3 generate_fixtures.py && cd ..