Fix benchmarks for latest glium/glutin API
[mandelwow.git] / benches / bounding_box.rs
index 597f215ef4598b2135f5a14ea781cb2e63fc8afa..7187354c800d9c22537c0f234c26f633b099b4c5 100644 (file)
@@ -1,21 +1,21 @@
 #![feature(test)]
-
-extern crate mandelwow_lib;
-extern crate glutin;
-#[macro_use(uniform)]
-extern crate glium;
 extern crate test;
 
-use glium::DisplayBuild;
+use glium::uniform;
 use mandelwow_lib::Cube;
 use mandelwow_lib::bounding_box::*;
+use std::rc::Rc;
 
 #[bench]
 fn bench_bounding_box(b: &mut test::Bencher) {
-    let display = glutin::WindowBuilder::new().build_glium().unwrap();
-    let program = solid_fill_program(&display);
+    let event_loop = glutin::event_loop::EventLoop::new();
+    let window = glutin::window::WindowBuilder::new();
+    let context = glutin::ContextBuilder::new();
+    let display = glium::Display::new(window, context, &event_loop).unwrap();
+
+    let program = Rc::new(solid_fill_program(&display));
     let bounds = Cube { xmin: -2., xmax: 0.7, ymin: -1., ymax:  1., zmin: -1.1, zmax:  1.1 };
-    let bbox = BoundingBox::new(&display, &bounds, &program);
+    let bbox = BoundingBox::new(&display, &bounds, program);
     let mut frame = display.draw();
     b.iter(|| {
         let mat = [[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.0f32]];