Re-enable fullscreen toggling
[mandelwow.git] / bounding_box.rs
index a08246e6dfe179416710c80c38174391625a499b..6625eb546182a45b6e265d899300943fb00d0e2c 100644 (file)
@@ -1,7 +1,8 @@
-use cube::Cube;
+use crate::cube::Cube;
 use glium;
-use glium::{Display, Program, Surface};
+use glium::{Display, Program, Surface, implement_vertex};
 use glium::index::{IndexBuffer, PrimitiveType};
+use std::rc::Rc;
 
 pub fn solid_fill_program(display: &Display) -> Program {
     let vertex_shader_src = include_str!("shaders/solid.vert");
@@ -13,14 +14,14 @@ pub fn solid_fill_program(display: &Display) -> Program {
 struct Vertex { position: [f32; 3] }
 implement_vertex!(Vertex, position);
 
-pub struct BoundingBox<'a> {
+pub struct BoundingBox {
     vertexes: glium::VertexBuffer<Vertex>,
-    program: &'a Program,
+    program: Rc<Program>,
     indices: IndexBuffer<u16>,
 }
 
-impl<'a> BoundingBox<'a> {
-    pub fn new(display: &Display, c: &Cube, program: &'a Program) -> BoundingBox<'a> {
+impl BoundingBox {
+    pub fn new(display: &Display, c: &Cube, program: Rc<Program>) -> BoundingBox {
         let vertex_data = [
             Vertex { position: [c.xmin, c.ymin, c.zmin] },
             Vertex { position: [c.xmax, c.ymin, c.zmin] },
@@ -54,6 +55,6 @@ impl<'a> BoundingBox<'a> {
             blend: glium::Blend::alpha_blending(),
             ..Default::default()
         };
-        frame.draw(&self.vertexes, &self.indices, self.program, uniforms, &params).unwrap();
+        frame.draw(&self.vertexes, &self.indices, &self.program, uniforms, &params).unwrap();
     }
 }