Open Kingdread opened 8 years ago
I am trying to compile an example and I am getting "An unknown error occurred."
#[macro_use]
extern crate glium;
extern crate glium_text;
fn main() {
use glium::{DisplayBuild, Surface};
let display = glium::glutin::WindowBuilder::new().build_glium().unwrap();
// The `TextSystem` contains the shaders and elements used for text display.
let system = glium_text::TextSystem::new(&display);
// Creating a `FontTexture`, which a regular `Texture` which contains the font.
// Note that loading the systems fonts is not covered by this library.
let font = glium_text::FontTexture::new(&display, std::fs::File::open(&std::path::Path::new("Droid_Sans_Mono.ttf")).unwrap(), 24).unwrap();
// Creating a `TextDisplay` which contains the elements required to draw a specific sentence.
let text = glium_text::TextDisplay::new(&system, &font, "Hello world!");
// Finally, drawing the text is done like this:
let matrix = [[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0]];
glium_text::draw(&text, &system, &mut display.draw(), matrix, (1.0, 1.0, 0.0, 1.0));
loop {
let mut target = display.draw();
target.clear_color(0.0, 0.0, 1.0, 1.0);
target.finish().unwrap();
for ev in display.poll_events() {
match ev {
glium::glutin::Event::Closed => return,
_ => ()
}
}
}
}
Compiling the unchanged git clone gives errors about different types in glutin 0.3.7:
Bumping the versions to the latest crates seems to fix the problem: