I'm trying to make the Rust game engine Piston work on my Ubuntu 14.04 laptop. I have already got it up and running on my desktop and I've made Snake there. So I know the basics of how to use the package.

However, on my (somewhat older) laptop, piston refuses to do what it's supposed to do. Here is my main.rs:

extern crate piston_window;
use piston_window::*;

fn main() {
    let mut window : PistonWindow = WindowSettings::new(
            "Piston-test", (200, 200))

    while let Some(e) = window.next() {
        match e {
            Event::Loop(Loop::Render(_)) => {
                window.draw_2d(&e, |_context, graphics| {
                    clear([1.0, 0.5, 0.5, 1.0], graphics);
            _ => {}

and in my Cargo.toml, I have

piston_window = "0.83.0"

The program compiles fine, but when it runs, the window it's supposed to create appears for a split second, then disappears again. The error I get is a panic at the unwrap() call, with the message

GL context creation failed

Now, I've googled this, and it's a problem I'm not alone in having. I have tried what I came across. I've tried specifying opengl(OpenGL::V3_2) and V2_1 on the WindowSettings, and I've tried using glutin_window instead of piston_window (glutin itself, and the example they have on their GitHub seems to run just fine, though).

  • Am I missing an external installation of some sort? Like, would it help to install, I dunno, GLEW? Does that even make sense, would Piston be able to use that, or does GLEW and glutin fill the same role? I must admit the different layers of graphics engines confuse me. – Arthur Nov 8 at 18:15

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.