Rust
Need help with miniquad?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.
not-fl3

Description

Cross platform rendering for Rust

281 Stars 24 Forks Other 238 Commits 28 Opened issues

Services available

Need anything else?

Miniquad

Github Actions Crates.io version Discord chat Matrix

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
  • macOS, OpenGL 3
  • iOS, GLES 3
  • WASM, WebGl1 - tested on ios safari, ff, chrome
  • Android, GLES3

Not supported, but desirable platforms

  • Android, GLES2 - work in progress.
  • 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

Imgur

examples/quad.rs: web demo
examples/offscreen.rs: web demo

PonasKovas/miniquad-mandelbrot: web demo

Worth to mention zemeroth port and astroblasto, built with miniquad-powered good-web-game

Building examples

linux

# ubuntu system dependencies
apt install libx11-dev libxi-dev libgl1-mesa-dev

cargo run --example quad

windows

# both MSVC and GNU target is supported:
rustup target add x86_64-pc-windows-msvc
# or
rustup target add x86_64-pc-windows-gnu

cargo run --example quad

wasm

rustup target add wasm32-unknown-unknown
cargo build --example quad --target wasm32-unknown-unknown

And then use the following .html to load .wasm:

index.html

```html

<meta charset="utf-8">
<title>TITLE</title>
<style>
    html,
    body,
    canvas {
        margin: 0px;
        padding: 0px;
        width: 100%;
        height: 100%;
        overflow: hidden;
        position: absolute;
        background: black;
        z-index: 0;
    }
</style>



<canvas id="glcanvas" tabindex="1"></canvas>
<!-- Minified and statically hosted version of https://github.com/not-fl3/miniquad/blob/master/native/sapp-wasm/js/gl.js -->
<script src="https://not-fl3.github.io/miniquad-samples/gl.js"></script>
<script>load("quad.wasm");</script> <!-- Your compiled wasm file -->

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.