#opengl #gl #gtk #epoxy #libepoxy

epoxy

Rust bindings for libepoxy, an OpenGL function pointer manager

5 releases

Uses old Rust 2015

0.1.0 Oct 11, 2018
0.0.4 Apr 2, 2018
0.0.3 Sep 30, 2017
0.0.2 Nov 5, 2015
0.0.1 Nov 3, 2015

#176 in Graphics APIs

Download history 48/week @ 2022-03-04 58/week @ 2022-03-11 89/week @ 2022-03-18 44/week @ 2022-03-25 30/week @ 2022-04-01 37/week @ 2022-04-08 33/week @ 2022-04-15 62/week @ 2022-04-22 89/week @ 2022-04-29 80/week @ 2022-05-06 133/week @ 2022-05-13 73/week @ 2022-05-20 78/week @ 2022-05-27 70/week @ 2022-06-03 54/week @ 2022-06-10 80/week @ 2022-06-17

285 downloads per month
Used in gfx-gtk

Apache-2.0

18KB
346 lines

epoxy-rs

Rust bindings for libepoxy, an OpenGL function pointer manager.

Bindings generated using a custom generator for the gl_generator crate.

Why would I use this over the gl crate?

You probably shouldn't, gl does the same type of function pointer management but requires a get_proc_address or similar kind of function to locate the needed function pointers. This isn't a problem when using a library such as glutin for window management, but is a problem when interacting with a Gdk GdkGLContext. Using gl together with epoxy with the default generators causes issues, as both libraries attempt to lazily resolve symbols and cache function pointer values.

This crate is mainly useful for using OpenGL functions to draw to a GtkGLArea together with the gtk crate. Gdk uses epoxy in the background to set up an OpenGL context for you, but doesn't provide an easy way to locate the proper OpenGL functions after initialization. This crate attempts to address this issue.

Using the bindings

epoxy currently requires a loader function similar to the gl crate, except instead of locating the raw OpenGL functions it locates the equivalent libepoxy symbols, preventing the conflicts described above. Code using the shared_library crate like the following should work in most cases:

epoxy::load_with(|s| {
    unsafe {
        match DynamicLibrary::open(None).unwrap().symbol(s) {
            Ok(v) => v,
            Err(_) => ptr::null(),
        }
    }
});
gl::load_with(epoxy::get_proc_addr);

A future version of the library may default to using this implementation.

Can I draw to a GtkGLArea using glium?

Hopefully soon.

Dependencies

~175KB