{"id":13712773,"url":"https://github.com/ikskuh/zero-graphics","last_synced_at":"2025-08-20T20:32:43.015Z","repository":{"id":40354961,"uuid":"368337113","full_name":"ikskuh/zero-graphics","owner":"ikskuh","description":"Application framework based on OpenGL ES 2.0. Runs on desktop machines, Android phones and the web","archived":false,"fork":false,"pushed_at":"2023-02-10T17:16:35.000Z","size":16818,"stargazers_count":165,"open_issues_count":2,"forks_count":19,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-07T20:50:05.261Z","etag":null,"topics":["android","android-sdk","desktop-linux","game-development","graphics","sdl","sdl2","wasm","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ikskuh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-05-17T22:27:59.000Z","updated_at":"2025-03-18T13:56:57.000Z","dependencies_parsed_at":"2023-02-18T01:30:59.137Z","dependency_job_id":null,"html_url":"https://github.com/ikskuh/zero-graphics","commit_stats":null,"previous_names":["ikskuh/zero-graphics"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ikskuh/zero-graphics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzero-graphics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzero-graphics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzero-graphics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzero-graphics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikskuh","download_url":"https://codeload.github.com/ikskuh/zero-graphics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikskuh%2Fzero-graphics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271378680,"owners_count":24749192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-sdk","desktop-linux","game-development","graphics","sdl","sdl2","wasm","zig","zig-package","ziglang"],"created_at":"2024-08-02T23:01:22.464Z","updated_at":"2025-08-20T20:32:40.488Z","avatar_url":"https://github.com/ikskuh.png","language":"Zig","funding_links":[],"categories":["Graphics Library"],"sub_categories":["Zigged Project"],"readme":"# Zero Graphics\n\nA very minimal OpenGL ES 2.0 library for Zig. Opens you a window and let's you draw things.\nComes with a pixel-perfect 2D renderer and maybe some day even with a bit of a 3D api.\n\n![Logo](design/logo.png)\n\n## Features\n\n- Multi-platform support\n  - Desktop (Linux, MacOS, Windows, ...)\n  - WebAssembly\n  - Android\n- Pixel perfect 2D rendering\n  - Primitives (line, rectangle, triangle, ...)\n  - Text / TTF fonts\n  - Textures\n- Basic 3D rendering\n  - Multi-mesh models with flat textures\n- Zig-style immediate-mode user interface\n- Proper DPI scaling support in renderer\n\n## Project status\n\n### CI\n\nThe CI coverage currently looks like this:\n\n| ·              | Windows | macOS | Linux |\n| -------------- | ------- | ----- | ----- |\n| Desktop        | ✅      | ✅    | ✅    |\n| WebAssembly    | ✅      | ✅    | ✅    |\n| Android        | ✅      | ✅    | ✅    |\n| `zero-init`    | ✅      | ✅    | ✅    |\n| `zero-convert` | ✅      | ✅    | ✅    |\n\nStatus: [![Nightly Build](https://github.com/MasterQ32/zero-graphics/actions/workflows/nightly.yml/badge.svg)](https://github.com/MasterQ32/zero-graphics/actions/workflows/nightly.yml)\n\n### Previews\n\nWork-in-progress, but works quite well already. There is one [big project](https://github.com/Dunstwolke/core) depending on it and is used as a _real-world application_ driver behind _Zero Graphics_.\n\n![Preview screenshot for SDL2](documentation/screen01.png)\n\n![Preview screenshot in FireFox](https://mq32.de/public/7207fdc86224d69a7af0e8289c6b7a687c757cf8.png)\n\n## Project Goals\n\n### Basic Framework\n\n- [ ] Support the following platforms\n  - [x] Wasm\n    - [x] Create OpenGL ES 2.0 context\n    - [x] Input Mouse\n    - [x] Input Keyboard\n  - [ ] Linux Desktop\n    - [x] Create OpenGL ES 2.0 context\n    - [x] Input Mouse\n    - [ ] Input Keyboard\n  - [ ] Windows Desktop (not tested, but should work via SDL2)\n  - [ ] Android\n    - [x] Create OpenGL ES 2.0 context\n    - [x] Input Mouse\n    - [ ] Input Keyboard\n- [x] Create an OpenGL ES 2.0 context\n- [x] Provide input events\n  - [x] Single pointer motion (finger or mouse)\n  - [x] Single click event (finger, mouse)\n  - [ ] Text input for keyboard (utf-8 encoded)\n- [x] Provide window events\n  - [x] Resize\n  - [x] Close\n- [x] Provide access to the underlying backend\n- [ ] Allow creation of single-file applications\n  - [ ] Single executable for easy distribution\n  - [ ] Embedded resources\n\n### 2D Rendering library\n\n- [ ] Pixel perfect drawing of\n  - [x] Lines\n  - [x] Rectangles\n  - [ ] Images\n    - [x] Basic \"copy full texture to rectangle\"\n    - [ ] Copy portion of texture (\"atlas rendering\")\n- [x] TTF font rendering via [`stb_ttf`](https://github.com/nothings/stb)\n- [x] Image loading via [`zigimg`](https://github.com/zigimg/zigimg)\n- [ ] Stack based/nested scissoring\n\n### 3D Rendering library\n\n- [ ] Tool based on Assimp to convert models into loadable format\n  - [x] static geometry\n  - [ ] dynamic/animated geometry\n- [ ] Blender export script\n- [x] Draw static geometry\n- [ ] Draw animated geometry\n  - [ ] Skinning based on skeletons\n- [ ] Axis- and camera aligned billboards\n- [ ] Basic particles\n- [ ] Tiny built-in pipeline with\n  - [ ] shadow mapping\n  - [ ] planar reflections\n  - [ ] water reflections\n\n## Dependencies\n\n### Desktop\n\n- [SDL2](https://www.libsdl.org/)\n\n### Web\n\n- [js glue code](www/zero-graphics.js)\n- [root page](www/application.ztt)\n\n### Android\n\n- Android SDK\n- Android NDK\n- Android Build Tools\n- OpenJDK\n- some other tools\n\n## Building / Running\n\nThis project uses [submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules), so to get started, clone the repo with submodules recursively:\n\n```sh-session\n[user@computer work]$ git clone https://github.com/MasterQ32/zero-graphics --recurse-submodules\n```\n\nor, if you already cloned the repository:\n\n```sh-session\n[user@computer work]$ git clone https://github.com/MasterQ32/zero-graphics\n[user@computer work]$ cd zero-graphics/\n[user@computer zero-graphics]$ git submodule update --init --recursive\n```\n\n### Desktop PC\n\nRequires `SDL2` to be installed.\n\n```sh-session\n[user@computer zero-graphics]$ zig build run\n```\n\nA window should open with the application in fullscreen.\n\nThe following environment variables can control how zero-graphics behaves:\n\n- `ZEROG_FULLSCREEN` is `y` for forced fullscreen or `n` for forced window mode.\n- `ZEROG_RESIZEABLE` is `y` for forced resizable window.\n- `ZEROG_DPI` is a number specifying the pixel density.\n\n### Web/Wasm version\n\nIncludes a teeny tiny web server for debugging.\n\n```sh-session\n[user@computer zero-graphics]$ zig build install run-wasm\n```\n\nNow visit http://127.0.0.1:8000/demo_application.htm to see the demo.\n\n### Android\n\nConnect your phone first and install both a JDK as well as the Android SDK with NDK included. The ZeroGraphics build system will tell you if\nit couldn't auto-detect the SDK paths.\n\n```sh-session\n[user@computer zero-graphics]$ zig build -Denable-android run-app\n```\n\nThe app should now be installed and started on your phone.\n\n## Documentation\n\n### Getting started\n\nTo create a new project, build this repository with `zig build` first. Then use the tool `zero-init` from `zig-out/bin` to initialize a new project:\n\n```sh-session\n[felix@denkplatte-v2 ~]$ mkdir game\n[felix@denkplatte-v2 ~]$ cd game\n[felix@denkplatte-v2 game]$ /path/to/zero-graphics/zig-out/bin/zero-init symlink # initialize via symlink, quickest option. use zero-init -h to see all options\n[felix@denkplatte-v2 game]$ ls\nsrc  vendor  build.zig\n[felix@denkplatte-v2 game]$ zig build\n[felix@denkplatte-v2 game]$ zig build run\ninfo(sdl): SDL Video Driver:     x11\ninfo(sdl): Render resolution:  1280×720\ninfo(sdl): Virtual resolution: 1280×720\ninfo(demo): OpenGL Version:       OpenGL ES 3.2 Mesa 21.2.3\ninfo(demo): OpenGL Vendor:        AMD\ninfo(demo): OpenGL Renderer:      AMD Radeon(TM) Vega 10 Graphics (RAVEN, DRM 3.41.0, 5.13.19_1, LLVM 12.0.1)\ninfo(demo): OpenGL GLSL:          OpenGL ES GLSL ES 3.20\ninfo(zero_graphics): [shader compiler] [other] Shader Stats: SGPRS: 16 VGPRS: 8 Code Size: 212 LDS: 0 Scratch: 0 Max Waves: 10 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0\ninfo(zero_graphics): [shader compiler] [other] Shader Stats: SGPRS: 16 VGPRS: 8 Code Size: 40 LDS: 0 Scratch: 0 Max Waves: 10 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0\ninfo(zero_graphics): [shader compiler] [other] Shader Stats: SGPRS: 8 VGPRS: 24 Code Size: 52 LDS: 0 Scratch: 0 Max Waves: 10 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0\ninfo(zero_graphics): [shader compiler] [other] Shader Stats: SGPRS: 8 VGPRS: 24 Code Size: 24 LDS: 0 Scratch: 0 Max Waves: 10 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0\ninfo(zero_graphics): [shader compiler] [other] Shader Stats: SGPRS: 8 VGPRS: 8 Code Size: 60 LDS: 0 Scratch: 0 Max Waves: 10 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0\ninfo(zero_graphics): [shader compiler] [other] Shader Stats: SGPRS: 16 VGPRS: 20 Code Size: 392 LDS: 0 Scratch: 0 Max Waves: 10 Spilled SGPRs: 0 Spilled VGPRs: 0 PrivMem VGPRs: 0\n```\n\nCheck out the file [`src/main.zig`](tools/zero-init/template/src/main.zig) to see your app skeleton. You can also adjust the [`build.zig`](tools/zero-init/template/build.zig) to set your project name.\n\nThe functions are roughly called in this order:\n\n![Application workflow](documentation/app_flow.svg)\n\nThe separation between _application init_ and _graphics init_ is relevant for Android apps which will destroy their window when you send it into the background and will recreate it when it is selected again. This means that all GPU content will be lost then and must be restored.\n\nYour application state will not be destroyed, so the rendering can render the same data as before.\n\n### Architecture\n\n`zero-graphics` follows a somewhat unusual architecture for Zig applications.\nYour applications is a _package_ that will be consumed by a `zero-graphics` host. This host is implementing the \"main loop\" and will invoke both `update` and `render` periodically. It will also initialize and open the window and pump events.\n\nThis design allows `zero-graphics` to run on several different platforms, including most desktop PCs, Android and even web browsers via WebAssembly.\n\nYou can check out the [Sdk.zig](Sdk.zig) file to find out how a application is built.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikskuh%2Fzero-graphics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikskuh%2Fzero-graphics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikskuh%2Fzero-graphics/lists"}