3 releases

0.1.3 May 8, 2023
0.1.1 Apr 24, 2023
0.1.0 Apr 23, 2023

#593 in Graphics APIs

Download history 12/week @ 2024-02-21 20/week @ 2024-02-28 3/week @ 2024-03-13 20/week @ 2024-03-27 44/week @ 2024-04-03

64 downloads per month
Used in appy

MIT license

33KB
656 lines

glapp

OpenGL meta window and context creation.

The window and graphics context creation pipeline in the Rust ecosystem is experiencing a kind of cambrian explosion at the moment, which is why it is good to be flexible possible when it comes to working with different underlying libraries and toolchains.

I created Glapp as a kind of "meta library", wrapping different underlying libraries, each with their respective strength depending on platform and situation.

The goal is that the code you write should be 100% transferrable from one platform to another. No need to mangle or name your main function differently depending on platform, glapp takes care of that. It should also be as easy as possible to get up and running. A simple example looks like:

use glapp::*;

#[glapp_main]
fn main(mut app:App) {
    app.title("Testing Glapp");
    app.run(|window,event|{
        match event {
            AppEvent::Open=>{
                // The OpenGL context is created and made current.
            },
            AppEvent::Render=>{
                // This is where we render our scene.
            },
            // ... see docs for more events, e.g. input and such ...
        }
    });
}

It should be understood that Glapp provides a kind on "least common denominator" when it comes to the functionality of these libraries. If you want more fine grained control, use respective library directly.

Libraries

Glapp can work with the following underlying libraries. Enable them as features:

  • sdl - Simple DirectMedia Layer is a cross-platform development library written in C. SDL officially supports Windows, macOS, Linux, iOS, and Android. SDL has been around since 1998 and is thoroughly battle tested.
  • glutin - Glutin is a pure Rust library with strong momentum and deep roots in the community.

Dependencies

~1–18MB
~210K SLoC