2 releases

Uses new Rust 2024

new 0.1.2 Apr 27, 2025
0.1.1 Apr 27, 2025

#445 in Graphics APIs

23 downloads per month

MIT/Apache

240KB
2K SLoC

glfw-rs

a rust wrapper for the glfw library.

use glfw::Context;

fn main() {
    let ctx = Context::init();
    ctx.gl_version(3, 3);
    let window = ctx
        .window("Hello world", (640, 480))
        .expect("Cannot create the window!");
    window.make_global();

    gl::load_with(window.get_safe_load_proc());
    unsafe { gl::ClearColor(0.1, 0.5, 1.0, 1.0) };

    while !window.should_close() {
        unsafe { gl::Clear(gl::COLOR_BUFFER_BIT) };
        window.update();
        ctx.poll_events();
    }
}

Dependencies

~0–2MB
~38K SLoC