Reputation: 167
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
Upvotes: 1
Views: 206
Reputation: 167
I can't reproduce this error, having returned to it today after an interval of ten days.
It is most likely due to some dependency that has changed in the last ten days. It is less likely to be an error on my part somewhere else because I carefully checked and rechecked my work, and it is a very simple program with a single dependency. The version of Rust (1.8) is the same.
The program has one dependency (piston_window) which had one commit nine days ago, so I retested by decrementing the minor version of piston_window in the toml file, followed by cargo clean and cargo run. But the program still ran OK. That dependency, in turn, has a cascade of over 90 other dependencies, many of which have undergone revision in the last ten days, so tracking down the exact change that fixed this would not be practical, considering that it is now working and I am using it correctly.
Upvotes: 1