我是Rust和遊戲引擎中游戲開發的初學者,具體來說。我編譯並運行了spinning square程序,但red-square程序無法運行,儘管我努力解決錯誤。活塞中的InvalidEnum錯誤
這是在Debian 8.3和Rust stable(1.8)上使用rustup。我的OpenGL版本是2.1,所以我必須改變旋轉方塊中的一條線以反映該版本。
這是我從紅方未經修改的代碼「貨運行」出現錯誤:
線程驚慌失措「無法獲取根窗口:XError十描述:‘GLXBadFBConfig’,ERROR_CODE: 178,request_code:155,minor_code:34}」,../src/libcore/result.rs:746
如果我修改代碼,如下所示(與加入的線表示)降級的OpenGL版本,那麼我會在下面看到不同的錯誤信息。
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);
});
}
}
螺紋恐慌在 '錯誤執行命令BindProgram(0)之後:InvalidEnum',/home/user/.cargo/registry/src/github.com-88ac128001ac3a9a/gfx_device_gl-0.9.0/src /lib.rs:283