I am a beginner at game development in Rust and the Piston game engine, specifically. I have compiled and run the spinning square program but the red-square program won't run despite my efforts to resolve the errors.
This is on Debian 8.3 and Rust stable (1.8) using rustup. My OpenGL version is 2.1, and so I had to change one line in spinning square to reflect that version.
This is the error I get from "cargo run" on the unmodified code of red-square:
thread panicked at 'Failed to get root window: XError { description: "GLXBadFBConfig", error_code: 178, request_code: 155, minor_code: 34 }', ../src/libcore/result.rs:746
If I modify the code as follows (with the added lines indicated) to downgrade the OpenGL version, then I get the different error message below.
extern crate piston_window;
use piston_window::*;
fn main() {
let opengl = OpenGL::V2_1; //added line
let window: PistonWindow =
WindowSettings::new("Hello Piston!", [640, 480])
.opengl(opengl) // added line
.exit_on_esc(true).build().unwrap();
for e in window {
e.draw_2d(|c, g| {
clear([1.0; 4], g);
rectangle([1.0, 0.0, 0.0, 1.0], // red
[0.0, 0.0, 100.0, 100.0],
c.transform, g);
});
}
}
thread panicked at 'Error after executing command BindProgram(0): InvalidEnum', /home/user/.cargo/registry/src/github.com-88ac128001ac3a9a/gfx_device_gl-0.9.0/src/lib.rs:283