glium_sdl2 0.5.0

An SDL2 backend for Glium - a high-level OpenGL wrapper for the Rust language.
docs.rs failed to build glium_sdl2-0.5.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: glium_sdl2-0.15.0

glium_sdl2

Build Status Latest Version

An SDL2 backend for Glium - a high-level OpenGL wrapper for the Rust language.

This library, along with glium and rust-sdl2, are in heavy development and are subject to change.

[dependencies]
glium_sdl2 = "0.5"
sdl2 = "0.7"

[dependencies.glium]
version = "0.8"
# Remove any Glium features that you don't use
features = ["image", "nalgebra", "cgmath"]
default-features = false

glium_sdl2 doesn't reexport the glium or sdl2 crates, so you must declare them with the versions listed above in your Cargo.toml file.

glium_sdl2 will be bumped to 0.6, 0.7, etc. once this library, glium or sdl2 make breaking changes.

Documentation

Example usage

Using glium with SDL2 is very similar to using glium with glutin. Generally speaking, Glium documentation and tutorials should be fairly trivial to adapt to SDL2.

#[macro_use]
extern crate glium;

extern crate glium_sdl2;
extern crate sdl2;

fn main() {
    use glium_sdl2::DisplayBuild;

    let sdl_context = sdl2::init().unwrap();
    let video_subsystem = sdl_context.video().unwrap();

    let display = video_subsystem.window("My window", 800, 600)
        .resizable()
        .build_glium()
        .unwrap();

    let mut running = true;
    let mut event_pump = sdl_context.event_pump().unwrap();

    while running {
        let mut target = display.draw();
        // do drawing here...
        target.finish().unwrap();

        // Event loop: includes all windows

        for event in event_pump.poll_iter() {
            use sdl2::event::Event;

            match event {
                Event::Quit { .. } => {
                    running = false;
                },
                _ => ()
            }
        }
    }
}