Don't show window if not ready to render
This commit is contained in:
parent
211f7fc5c5
commit
53137b9d89
|
@ -58,13 +58,13 @@ fn main() {
|
|||
}
|
||||
|
||||
let mut events_loop = EventsLoop::new();
|
||||
let window = WindowBuilder::new();
|
||||
let window = WindowBuilder::new().with_visibility(false);
|
||||
let context = glutin::ContextBuilder::new().with_depth_buffer(24);
|
||||
let display = Display::new(window, context, &events_loop).unwrap();
|
||||
let mut renderer = Renderer::new(display);
|
||||
|
||||
let mut closed = false;
|
||||
|
||||
let mut renderer = Renderer::new(display);
|
||||
renderer.add_model(&model);
|
||||
|
||||
let mut camera = Camera::new(
|
||||
|
@ -75,6 +75,8 @@ fn main() {
|
|||
|
||||
let mut controls = OrbitControls::around(&model, &mut camera);
|
||||
|
||||
renderer.show();
|
||||
|
||||
while !closed {
|
||||
|
||||
events_loop.poll_events(|ev| {
|
||||
|
|
|
@ -113,7 +113,6 @@ impl<'a, D: Drawer + Facade + Sized> Renderer<'a, D> {
|
|||
panic!()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// Adds a model to the renderer, and compute the corresponding buffers for rendering.
|
||||
|
@ -203,3 +202,16 @@ impl<'a, D: Drawer + Facade + Sized> Renderer<'a, D> {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Renderer<'a, Display> {
|
||||
/// Shows the window if it was hidden.
|
||||
pub fn show(&mut self) {
|
||||
self.drawer.gl_window().show();
|
||||
}
|
||||
|
||||
/// Hides the window if it was visible.
|
||||
pub fn hide(&mut self) {
|
||||
self.drawer.gl_window().hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue