Added render
This commit is contained in:
parent
ac010c0530
commit
180ac6b7cb
|
@ -5,4 +5,9 @@ authors = ["Thomas Forgione <thomas@tforgione.fr>"]
|
|||
|
||||
[dependencies]
|
||||
num = "*"
|
||||
glium = "*"
|
||||
verbose-log = { git = "https://gitea.tforgione.fr/dash-3d/verbose-log" }
|
||||
|
||||
[[bin]]
|
||||
name = "3d-viewer"
|
||||
path = "src/programs/viewer.rs"
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
extern crate glium;
|
||||
|
||||
use glium::Display;
|
||||
use glium::glutin;
|
||||
use glium::glutin::{
|
||||
EventsLoop,
|
||||
WindowBuilder,
|
||||
ContextBuilder,
|
||||
};
|
||||
|
||||
use glium::glutin::Event;
|
||||
use glium::glutin::WindowEvent;
|
||||
use glium::glutin::VirtualKeyCode;
|
||||
|
||||
fn main() {
|
||||
|
||||
let mut events_loop = EventsLoop::new();
|
||||
let window = WindowBuilder::new();
|
||||
let context = ContextBuilder::new();
|
||||
let display = Display::new(window, context, &events_loop).unwrap();
|
||||
|
||||
let mut closed = false;
|
||||
|
||||
while !closed {
|
||||
let mut target = display.draw();
|
||||
|
||||
use glium::Surface;
|
||||
target.clear_color(0.0, 0.0, 1.0, 1.0);
|
||||
|
||||
target.finish().unwrap();
|
||||
|
||||
events_loop.poll_events(|ev| {
|
||||
match ev {
|
||||
// Close window
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::Closed, ..
|
||||
} => closed = true,
|
||||
|
||||
// Escape key
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::KeyboardInput {
|
||||
input: glutin::KeyboardInput {
|
||||
virtual_keycode: Some(VirtualKeyCode::Escape), ..
|
||||
}, ..
|
||||
}, ..
|
||||
} => closed = true,
|
||||
|
||||
_ => (),
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue