Miniquad
Miniquad is safe and cross-platform rendering library focused on portability and low-end platforms support
API is highly inspired by sokol-gfx (sokol overview, 2019 update). Implementation influenced by crayon.
For context management and input on Windows/Linux(and potentially mobiles) "sokol-app" was used. And no external dependencies for WASM.
For higher level API take a look on:
good-web-game: implementation of some ggez subset on top of miniquad, made as compatibility layer to run ggez games on wasm
macroquad: raylib-like library on top of miniquad. 100loc arkanoid with macroquad
Supported platforms
- Windows, OpenGl 3
- Linux, OpenGl 3
- WASM, WebGl1 - tested on ios safari, ff, chrome
Not supported, but desirable platforms
- Android, OpenGl version should be portable enough to run on android, sokol-app code is here and ready, but I just dont have Android phone.
- Metal. For both MacOs and IOS metal rendering backend next to opengl one is highly desirable. But I just dont have any MacOs capable hardware to start working on it :/
Examples
examples/quad.rs: web
examples/offscreen.rs: web
Worth to mention zemeroth port and astroblasto, built with miniquad-powered good-web-game
Building examples
desktop
wasm
And then use the following .html to load .wasm:
<!-- Minified and statically hosted version of https://github.com/not-fl3/miniquad/blob/master/native/sapp-wasm/js/gl.js -->
<!-- Your compiled wasm file -->
TITLE
Goals
-
Fast compilation time. Right now it is ~5s from "cargo clean" for both desktop and web.
-
Cross platform. Amount of platform specific user code required should be kept as little as possible.
-
Low-end devices support.
-
Hackability. Working on your own game, highly probable some hardware incompability will be found. Working around that kind of bugs should be easy, implementation details should not be hidden under layers of abstraction.
Non goals
-
Ultimate type safety. Library should be entirely safe in Rust's definition of safe - no UB or memory unsafety. But correct GPU state is not type guaranteed. Feel free to provide safety abstraction in the user code than!
-
High end API, like Vulkan/DirectX 12. Take a look on gfx-rs or vulkano instead!
-
sokol-gfx api compatibility. While sokol is absolutely great as an API design foundation, just reimplementing sokol in rust is not a goal. The idea is to learn from sokol, but make a library in a rust way when its possible.