#opengl #graphics #gleam #no-std

no-std gl-context-loader

Minimal OpenGL function loader for no_std OpenGL contexts

11 releases

Uses old Rust 2015

0.1.10 Nov 12, 2025
0.1.9 Oct 21, 2025
0.1.8 Mar 10, 2022
0.1.7 Aug 14, 2021
0.1.0 Jun 29, 2021

#310 in GUI

Download history 1332/week @ 2026-01-22 1421/week @ 2026-01-29 1358/week @ 2026-02-05 1830/week @ 2026-02-12 1713/week @ 2026-02-19 2167/week @ 2026-02-26 3179/week @ 2026-03-05 3166/week @ 2026-03-12 3277/week @ 2026-03-19 3980/week @ 2026-03-26 4431/week @ 2026-04-02 5070/week @ 2026-04-09 5839/week @ 2026-04-16 6186/week @ 2026-04-23 7530/week @ 2026-04-30 4888/week @ 2026-05-07

25,168 downloads per month
Used in 6 crates (4 directly)

Apache-2.0/MIT

270KB
6K SLoC

opengl-function-loader

Defines a struct holding OpenGL function pointers as well as the corresponding functions. Designed for no_std use (with default-features = false).

You are responsible for loading the functions yourself:

fn main() {
    /// ...

    wglMakeContextCurrent(hDC, hRC);

    let context = GenericGlContext {
        glAccum: wglGetProcAddress("glAccum"),
        glActiveTexture: wglGetProcAddress("glActiveTexture"),
        glAlphaFunc: wglGetProcAddress("glAlphaFunc"),
        glAreTexturesResident: wglGetProcAddress("glAreTexturesResident"),
        ...
    };

    // function provided by this library - also available on no_std!
    context.clear_color(0.0, 0.0, 0.0, 0.0);
    context.flush();

    wglMakeContextCurrent(NULL, NULL);
}

If a function pointer is set to 0x00000 (i.e. the function is not loaded), this library will return a "default" value without panicking (i.e. Vec::new(), String::new() or 0). With stdlib support it will print a "missing function: X" to stdout before returning.

If stdlib support is enabled, GenericGlContext implements gleam::Gl!. The point of this is to make it possible to integrate crates that use gleam::Gl with custom OpenGL function pointer loaders while using custom loaders on no_std.

License

The code is somewhat copied from servo/gleam, so it retains the original Apache/MIT license.

Dependencies