Cross platform rendering in Rust

Overview

Miniquad

Github Actions Docs Crates.io version Discord chat Matrix

Miniquad is a manifestation of a dream in a world where we do not need a deep dependencies tree and thousands lines of code to draw things with a computer.

Miniquad aims to provide a graphics abstraction that works the same way on any platform with a GPU, being as light weight as possible while covering as many machines as possible.

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

Building examples

linux

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 lang="en">

<head>
    <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>
</head>

<body>
    <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 -->
</body>

</html>

One of the ways to server static .wasm and .html:

cargo install basic-http-server
basic-http-server .

android

Recommended way to build for android is using Docker.
miniquad use slightly modifed version of cargo-apk

docker run --rm -v $(pwd)":/root/src" -w /root/src notfl3/cargo-apk cargo quad-apk build --example quad

APK file will be in target/android-artifacts/(debug|release)/apk

With "log-impl" enabled all log calls will be forwarded to adb console. No code modifications for Android required, everything should just works.

iOS

See miniquad iOS sample project.

cross compilation

# windows target from linux host:
# this is how windows builds are tested from linux machine:
rustup target add x86_64-pc-windows-gnu
cargo run --example quad --target x86_64-pc-windows-gnu

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.

  • Forkability. Each platform implementation is, usually, just one pure rust file. And this file is very copy-paste friendly - it doesnt use any miniquad specific abstractions. It is very easy to just copy some part of miniquad's platform implementation and use it standalone.

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 then!

  • High end API, like Vulkan/DirectX 12. Take a look on gfx-rs or vulkano instead!

Platinum sponsors

Miniquad is supported by:

Comments
  • Support different upload format than texture format

    Support different upload format than texture format

    Can now upload alpha pixel format (1 byte per pixel) to RGBA8 texture. Breaking changes to Texture class.

    Very useful to upload effectively Alpha texture data to platforms that only support RGBA8 (like WebGL1) without having to make 4x larger array (4 bytes per pixel vs 1 byte per pixel) on the CPU side

    opened by nokola 21
  • Support more GL functions (enough to implement 2d vector library like with NanoVG)

    Support more GL functions (enough to implement 2d vector library like with NanoVG)

    Summary

    I ported significant part of NanoVG (nvg-rs) over to miniquad. NanoVG is high-quality antialiased drawing and text library. I think it's the first time I see it run on WASM, Desktop, and Android from rust!

    I created new library and named it nvg-miniquad (not yet published). I plan to publish the nvg-miniquad library, but first I want to make sure you approve of the changes to miniquad.

    I made these changes in miniquad to enable support for libraries like nvg-miniquad:

    1. Found some existing GL functions were crashing on WASM and missing on Windwows, added those
    2. Changed type of GL_FALSE and GL_TRUE to u8, otherwise I got lots of errors trying to pass the u32 to some gl* functions that need u8. Now they can be passed to gl functions using u32 or u8.
    3. Exported Sokol's gl* functions for cross-platform full access to GL! (Thanks for making the xplat support in miniquad, it's very good.)

    Example

    Windows

    image

    WebGL

    image

    Sample code

    Here is partial example code to render the above from the nvg-miniquad ported library:

            self.nvg_context.begin_path();
            self.nvg_context.rect((100.0, 100.0, 300.0, 300.0));
            self.nvg_context.fill_paint(nvg::Gradient::Linear {
                start: (100, 100).into(),
                end: (400, 400).into(),
                start_color: nvg::Color::rgb_i(0xAA, 0x6C, 0x39),
                end_color: nvg::Color::rgb_i(0x88, 0x2D, 0x60),
            });
            self.nvg_context.fill().unwrap();
    
            let origin = (150.0, 140.0);
            self.nvg_context.begin_path();
            self.nvg_context.circle(origin, 64.0);
            self.nvg_context.move_to(origin);
            self.nvg_context.line_to((origin.0 + 300.0, origin.1 - 50.0));
            self.nvg_context.stroke_paint(nvg::Color::rgba(1.0, 1.0, 0.0, 1.0));
            self.nvg_context.stroke_width(3.0);
            self.nvg_context.stroke().unwrap();
    
            self.nvg_context.end_frame().unwrap(); // comment to show stuff
    

    Note: I haven't tested text and there are very likely issues still with blend modes, however shapes and fill look OK right now! :)

    Any feedback welcome! Thanks for making miniquad very easy to be cross-platform and run on mobile as well as WASM/Desktop again!

    opened by nokola 19
  • sRGBA gamma aware texture sampler

    sRGBA gamma aware texture sampler

    It would be great if miniquad could support the GL_SRGB8_ALPHA8 texture format. This enables sRGBA gamma-aware texture sampler, which is the only way to get colors rights with bilinear filtering (and mipmaps).

    WebGL1 only supports it with the EXT_sRGB extension. WebGL2 supports GL_SRGB8_ALPHA8 by default.

    opened by emilk 13
  • Can't run example

    Can't run example

    = note: offscreen.53ypclmuyuk0jfd.rcgu.o : error LNK2019: unresolved external symbol glUniform1iv referenced in function _ZN8miniquad8graphics7Context14apply_uniforms17h826f507f04b51288E offscreen.53ypclmuyuk0jfd.rcgu.o : error LNK2019: unresolved external symbol glUniform2iv referenced in function _ZN8miniquad8graphics7Context14apply_uniforms17h826f507f04b51288E offscreen.53ypclmuyuk0jfd.rcgu.o : error LNK2019: unresolved external symbol glUniform3iv referenced in function _ZN8miniquad8graphics7Context14apply_uniforms17h826f507f04b51288E offscreen.53ypclmuyuk0jfd.rcgu.o : error LNK2019: unresolved external symbol glUniform4iv referenced in function _ZN8miniquad8graphics7Context14apply_uniforms17h826f507f04b51288E E:\Projects\Rust\miniquad\target\debug\examples\offscreen.exe : fatal error LNK1120: 4 unresolved externals

    error: aborting due to previous error

    error: could not compile miniquad.

    Caused by: process didn't exit successfully: rustc --crate-name offscreen --edition=2018 'examples\offscreen.rs' --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' -C metadata=43a6cd1433160286 --out-dir 'E:\Projects\Rust\miniquad\target\debug\examples' -C 'incremental=E:\Projects\Rust\miniquad\target\debug\incremental' -L 'dependency=E:\Projects\Rust\miniquad\target\debug\deps' --extern 'glam=E:\Projects\Rust\miniquad\target\debug\deps\libglam-1b36325fb75c82d6.rlib' --extern 'miniquad=E:\Projects\Rust\miniquad\target\debug\deps\libminiquad-ef5f0da1371f9c36.rlib' --extern 'sapp_windows=E:\Projects\Rust\miniquad\target\debug\deps\libsapp_windows-36ac608f4451b9d6.rlib' -L 'native=E:\Projects\Rust\miniquad\target\debug\build\sapp-windows-249a45c963a76aba\out' (exit code: 1)

    opened by AKholetsky 10
  • File drag & drop support for Windows, Linux and WASM

    File drag & drop support for Windows, Linux and WASM

    Miniquad can now handle dropped files on Windows, Linux and WASM.

    A file path on Windows may be at most 260 characters long (16 bits each). On Mac it is 1024 bytes and on Linux it is 4096 bytes. Is it okay to have a 4096 bytes long array in sapp_event? If PathBuf is used, the event can no longer be Copy.

    In browsers you cannot read a file from the filesystem with a path, so the file bytes are read immediately in the file drop event. In native applications the file reading can be left to the client.

    opened by urholaukkarinen 6
  • Community chatgroup

    Community chatgroup

    I like the format of chat for some real-time questions and discussions.

    Just set up discord server: https://discord.gg/WfEp6ut

    Any opinions on that? Do we need a bridge to the matrix? Any other preferred protocols?

    I like discords because of the nice rooms inside the server, but I do believe in the importance of open protocols and servers for communication so am interested in bridges to any other protocol.

    opened by not-fl3 6
  • Flawless multi-touch support on Android

    Flawless multi-touch support on Android

    Multi-touch on Android currently doesn't work correctly. Once we start pressing multiple fingers, the states get confused and sometimes Stationary ghost touches can appear. I noticed that when trying the touch example of macroquad: https://user-images.githubusercontent.com/13885008/187576490-878fa4ac-1575-4f46-a127-b59c09aaf6f9.mp4

    I traced the problem all the day down to the Android MainActivity class of miniquad, which I discovered didn't handle some touch events that are essential for multi-touch: ACTION_POINTER_UP and ACTION_POINTER_DOWN. So after researching about all of this (since I don't know anything about Android development), I eventually managed to fix the bug entirely!

    How to compile the touch_blobs example (it logs touches):

    docker run --rm -v $(pwd)":/root/src" -w /root/src notfl3/cargo-apk cargo quad-apk build --example touch_blobs --features log-impl
    

    Touch input is now flawless. Here's a demo. https://youtu.be/mM3vQthcBc4

    Things to note about this demo

    • at 0:25 you can see that it perfectly handles 2 fingers touching the screen at the same time, and releasing at the same time.
    • following that, it has no problems with secondary pointers leaving early while others are still holding.
    • following that again, it has no problems with fast finger spamming. Essential for rhythm games. ;)
    • at 0:40 you can see that it perfectly handles 3 fingers.
    • at 0:59 you can see that it sometimes perfectly handles 4 fingers, but for some reason produces Cancelled touch phases if you press 4 at the same time. This only happens when you have touch gestures enabled, which is why I switch into Game Focus Mode at 1:11.
    • the rest of the video is just testing more crazy stuff with fingers like 8 at the same time, which is yet again flawless.

    I have done some other minor modifications as well: put the shaders into a separate file and include_str! on them in both blob examples (though I don't know if it's desirable for this codebase), format the MainActivity class... if you want me to change any of that let me know.

    Also, I couldn't compile for Android because there was fn show_keyboard(&mut self, _show: bool) {} in the NativeDisplay impl of AndroidDisplay in android.rs line 111... It wasn't used so I have commented it locally but not in this PR. Is this function a WIP, a misplacement...?

    opened by Speykious 5
  • [bug][mac] high_dpi: true leads to extreme flickering

    [bug][mac] high_dpi: true leads to extreme flickering

    macOS Mojave 10.14.6 running on an Intel MacBook Pro.

    Turning on high_dpi: true in examples/quad.rs I get extreme 60Hz flicker until I resize the screen, and it all works again:

    miniquad-flicker

    Seems like maybe there is a call to glViewport missing somewhere

    opened by emilk 5
  • GamesShell support

    GamesShell support

    I thought it might be worthwhile to open an issue tracking this, let me know if this isn't a good place for this.

    The gameshellis basically a raspberry pi gameboy. It'd be cool to get miniquad working on it so I first got it up on Raspberry pi, and am now working on getting it to the gameshell.

    Currently facing this issue

    /lib/arm-linux/gnueabihf/libm.so.6: version `GLIBC_2.27' not found (required by ./gameshell-project)
    /lib/arm-linux/gnueabihf/libc.so.6: version `GLIBC_2.28' not found (required by ./gameshell-project)
    
    opened by Bombfuse 5
  • Readme instructions for building on Windows fail

    Readme instructions for building on Windows fail

    TLDR: x86_64-pc-windows-gnu target is broken on Windows, however x86_64-pc-windows-msvc runs just fine. Side note: awesome library! Love the one-step build for Android, Windows, WASM. Just what I was looking for my experiments :)

    I propose update the readme for building on windows to this working line:

    cargo run --example quad --target x86_64-pc-windows-msvc
    

    For information: There are several issues related to general linking with MinGW and C code, see related: https://github.com/rust-lang/rust/issues/47048

    This is the error message x86_64-pc-windows-gnu

    D:\Repos\GitHub\miniquad>cargo run --example quad --target x86_64-pc-windows-gnu
       Compiling miniquad v0.2.50 (D:\Repos\GitHub\miniquad)
    error: linking with `gcc` failed: exit code: 1
      |
      = note: "gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.1fh8zj8qzb1714it.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.1n1m4m3wrttllgrt.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.1swjfh8s7gn545mz.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.1xb7pqy0ln9ohyq2.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.1zufwc1tdnoonxzi.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.21532v8wbbeb1xkc.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.28y2q88fkvsg9kt1.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.2h175il6s90rg4v.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.2hx3i6tthqq0i472.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.2qyi8iv9cl8osyf.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.2rc138uja2z3ujnt.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.2wqy0kjo2k65ifni.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.2y11uvjvnesyo8i3.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.38kl7oetbr298l08.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3asusp104vlv5w6g.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3e90j05v1yncsco6.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3k2zhrpoyrt1a867.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3rpo1g9sw87hn2x0.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3tgyvcaoxpjxoefn.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3u4s4whndh130fhm.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3wwg8izbf7vi7pt7.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3ylp8n3wg90gq1xk.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.3yq71mnv6zpt2fjj.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.413e3ttk6koxhzb7.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.42oh3otdki7ico6x.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.43vz4a4yaqeyb8u1.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.46x0875xbpkbf8p0.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.4dvzv69ils53qnj8.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.4jmxir2xccjuoz3w.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.4wvze19b17j7zwxe.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.5agofs60bac20z3m.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.5fldr32p5ghq2kbr.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.9lw7qim3ydrl3r2.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.avz2fhlqw3ebesa.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.h96cuxpvwrumsp6.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.itlozx8yg7216ci.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.m9b9iawaaqsvbw5.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.rjut68nbxrgo46f.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.v5azipzshl7x394.rcgu.o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.yz0koqind0o4vkd.rcgu.o" "-o" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.exe" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\examples\\quad-32114cc659a6a1dd.m40rqsv3dy8d79v.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\deps" "-L" "D:\\Repos\\GitHub\\miniquad\\target\\debug\\deps" "-L" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\build\\sapp-windows-78721a68f23e691c\\out" "-L" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\deps\\libminiquad-ab3e7ab2a97f47db.rlib" "D:\\Repos\\GitHub\\miniquad\\target\\x86_64-pc-windows-gnu\\debug\\deps\\libsapp_windows-416e8de07a6c65dc.rlib" "-Wl,--start-group" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-2709d4b440f1e31a.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-a9004ff0947ef669.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-51ba26adca1c882c.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-845f51604911fcc4.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libbacktrace-de041ab5ae3894b3.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libbacktrace_sys-583b927240902ae3.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-dc3974e5e5ee3f1e.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-93e1dea24f969698.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-59c69470ac86444e.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-5fe3f715aad021c1.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-289552190fa6ddd0.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-663fc4811d41d373.rlib" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-985f2d98a138c88e.rlib" "-Wl,--end-group" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-8d584b80572e52da.rlib" "-Wl,-Bdynamic" "-lgdi32" "-lole32" "-lshell32" "-ladvapi32" "-lws2_32" "-luserenv" "-Wl,-Bstatic" "-lgcc_eh" "-lpthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\nikol\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
      = note: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nikol\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o:crtexe.c:(.text+0x7d): undefined reference to `_encode_pointer'
              C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nikol\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o:crtexe.c:(.rdata$.refptr.__onexitbegin[.refptr.__onexitbegin]+0x0): undefined reference to `__onexitbegin'
              C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nikol\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o:crtexe.c:(.rdata$.refptr.__onexitend[.refptr.__onexitend]+0x0): undefined reference 
    to `__onexitend'
              collect2.exe: error: ld returned 1 exit status
    
    
    error: aborting due to previous error
    
    error: could not compile `miniquad`.
    
    To learn more, run the command again with --verbose.
    
    opened by nokola 5
  • Access to console.log

    Access to console.log

    I see there is a console_log function in sapp-wasm. Is this something that could be re-exported for users of good-web-game? I suppose it would need to be stubbed for other sapp-* targets as well, or maybe even implemented as a logging function standard to each target.

    Alternatively, is there another way to add this functionality? I'm quite new to wasm & rust, so would it just be a matter of building my own bindings, like you did for gl.js?

    opened by canadaduane 5
  • gl.js: use performance timer

    gl.js: use performance timer

    Use performance.now instead of Date.now, which may provide a higher-resolution time (depending on the browser's Spectre mitigation settings). The time returned will no longer be relative to the Unix epoch and system clock.

    opened by troyc 2
  • Cannot run quad example in android

    Cannot run quad example in android

    Hi. Thanks for such a cool project!

    I'm building a game that uses macroquad and want to run it in android. But I have an issue when run it: android cannot find MainActivity.

    It is reproduced when I try to build quad example from this repo.

    Steps to reproduce: 1:

    # from cargo-quad-apk
    $ docker build . --tag builder
    # from miniquad
    $ docker run --rm -v $(pwd):/root/src -w /root/src -it builder cargo quad-apk build --release --example quad
    

    2: Install target/android-artifacts/release/apk/examples/quad.apk to android device and run

    opened by Mifom 2
  • Stream buffer recreating segfaults

    Stream buffer recreating segfaults

    This called in the draw method causes a segfault on Windows and MacOS. ( (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION))

    let indices = [0u16, 1, 2, 0, 2, 3];
    self.bindings.index_buffer.delete(); // without delete it "works"
    self.bindings.index_buffer = Buffer::stream(ctx, BufferType::IndexBuffer, indices.len() * std::mem::size_of::<u16>());
    self.bindings.index_buffer.update(ctx, &indices);
    

    Full example: https://gist.github.com/pum-purum-pum-pum/c399452086016fbb3f5ff69aa4f8a4e6

    Windows machine I've tried it on:

    GPU: NVIDIA quadro p5000
    Driver provider: NVIDIA
    

    Also reproduced on M1 laptop and M1 mac mini.

    Original issue https://github.com/not-fl3/egui-miniquad/issues/42

    opened by pum-purum-pum-pum 1
  • General fixes with Clippy lints

    General fixes with Clippy lints

    This is the start of some of the clippy lints I acted on. Every lint I fixed is per-commit with a link attached (I think the best thing to do with this PR is a squash-merge).

    The 2 first commits are clippy lints denoted as errors, all the other ones are warnings.

    I didn't fix every single clippy lint, first because there are a lot of them, and second because I don't know your preferences regarding some of them (unnecessary return keywords for instance, maybe you prefer that in every situation).

    image

    Let me know if there should be a clippy.toml file for that.

    opened by Speykious 0
  • strange rate of draw calls on low-end hardware

    strange rate of draw calls on low-end hardware

    I wrote a simple program using miniquad, and sent it to my friend with a low-end computer running Windows 10. It was lagging some, which I wasn't too surprised by, so I started dummying things out. With everything in draw and update dummied out except for a basic function to print the FPS to console every second, it was only hitting ~35 fps. I tried simply putting the same counter code in a loop {...} and it got ~2 million iterations per second, so it seems to be some overhead within miniquad. I know there will be some overhead no matter what, but for not making any calls on Context this seems surprisingly high.

    opened by TwilightFlower 2
Owner
Fedor Logachev
Fedor Logachev
grr and rust-gpu pbr rendering

grr-gltf Barebone gltf viewer using grr and rust-gpu. Currently only supports a single gltf model! Assets These files need to be downloaded and placed

Markus Siglreithmaier 28 Dec 2, 2022
Text Renderer written in Rust using HarfBuzz for shaping, FreeType for rasterization and OpenGL for rendering.

Provok Text Renderer written in Rust using HarfBuzz for shaping, FreeType for rasterization and OpenGL for rendering. Input Provok is fed with a JSON

Ossama Hjaji 67 Dec 10, 2022
Collection of rust crates providing rendering abstractions.

render-rs License Licensed under either of Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) MIT license (LIC

Graham Wihlidal 31 Aug 25, 2022
Vulkan and Rust rendering~game engine which creation is covered with YouTube videos

Vulkan and Rust rendering~game engine which creation is covered with YouTube videos

小鳥 11 Dec 4, 2022
Cross-platform game engine in Rust.

Cross-platform game engine in Rust.

Fedor Logachev 1.9k Jan 3, 2023
Neutral cross-platform Rust game template

Rust Game Template Neutral cross-platform Rust game template. Build tool This project uses cargo-make task runner. It's required to build the project.

null 0 Feb 5, 2022
Cross-platform (including wasm) persistent key value store plugin for rust games/apps

bevy_pkv bevy_pkv is a cross-platform persistent key value store for rust apps. Use it for storing things like settings, save games etc. Currently, it

Johan Klokkhammer Helsing 25 Jan 9, 2023
A cross platform classic RPG game creator written in Rust.

Eldiron - Classic RPG Creation Create RPGs for every platform with Eldiron. Eldiron v1 will be able to create games similar to the classic Ultima seri

Markus Moenig 164 Jan 2, 2023
A safe, fast and cross-platform 2D component-based game framework written in rust

shura shura is a safe, fast and cross-platform 2D component-based game framework written in rust. shura helps you to manage big games with a component

Andri 28 Jan 17, 2023
Vulkan rendering sandbox for raytracing

sol-rs ☀ sol-rs is a small rendering toolkit for Vulkan, with a focus on real-time raytracing (which is not currently available via other APIs such as

Éric Renaud-Houde 65 Dec 7, 2022
A tilemap rendering crate for bevy which is more ECS friendly.

bevy_ecs_tilemap A tilemap rendering plugin for bevy which is more ECS friendly by having an entity per tile. Features A tile per entity Fast renderin

John 414 Dec 30, 2022
Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions

Introduction Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions. (hand interaction with boxes missing

Mika 52 Nov 14, 2022
Self Study on developing a game engine using wgpu as the rendering API. Learning as I go.

Fabled Engine Any issues, enhancement, features, or bugs report are always welcome in Issues. The obj branch is where frequent development and up to d

Khalid 20 Jan 5, 2023
🤹‍ 2D sprite rendering extension for the specs ECS system

specs-blit 2D sprite rendering extension for the Specs ECS system. All sprites are loaded onto a big array on the heap. Example // Setup the specs wor

Thomas Versteeg 8 Aug 14, 2022
A 3D modeling and rendering programming language utilizing SDFs.

ForgedThoughts is a modeling and rendering programming language utilizing SDFs and is in early development. For documentation and examples see the Web

Markus Moenig 4 Feb 27, 2023
A light-weight Anchor-Offset based 2D sprite rendering system for the bevy engine.

Bevy AoUI A light-weight anchor-offset based 2D sprite layout system for the bevy engine. Bevy AoUI provides a light-weight rectangular anchor-offset

Mincong Lu 4 Nov 22, 2023
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

webview 10.8k Jan 9, 2023
IDE for cross-platform software development

Diversity Space IDE for cross-platform software development | 日本語 | English | Русский | READMEの英語版とロシア語版はDeepl翻訳を使用して翻訳されています Английская и русская вер

latteS 0 Feb 23, 2022
A cross platform (wasm included) networking library!

bootleg_networking A cross platform (wasm included) networking library! A networking plugin for the Bevy game engine that wraps around bevy_networking

William Batista 51 Jan 1, 2023