extern crate gl;
extern crate glutin;
fn main() {
use glutin::GlContext;
let mut events_loop = glutin::EventsLoop::new();
let window = glutin::WindowBuilder::new();
let context = glutin::ContextBuilder::new();
let gl_window = glutin::GlWindow::new(window, context, &events_loop).unwrap();
unsafe { gl_window.make_current().unwrap() };
gl::load_with(|symbol| gl_window.get_proc_address(symbol) as *const _);
events_loop.run_forever(|event| {
use glutin::{ControlFlow, Event, WindowEvent};
if let Event::WindowEvent { event, .. } = event {
if let WindowEvent::Closed = event {
return ControlFlow::Break;
}
}
unsafe {
gl::ClearColor(0.3, 0.3, 0.3, 1.0);
gl::Clear(gl::COLOR_BUFFER_BIT);
}
gl_window.swap_buffers().unwrap();
ControlFlow::Continue
});
}