Update render target after a resize

This commit is contained in:
Joonas Javanainen 2017-06-17 13:17:30 +03:00
parent 719a1a3317
commit 16d19c1855
No known key found for this signature in database
GPG Key ID: D39CCA5CB19B9179
2 changed files with 5 additions and 1 deletions

View File

@ -39,6 +39,7 @@ pub fn main() {
glutin::Event::Closed => break 'main,
glutin::Event::Resized(_width, _height) => {
gfx_window_glutin::update_views(&window, &mut main_color, &mut main_depth);
renderer.update_render_target(main_color.clone());
}
_ => (),
}

View File

@ -76,7 +76,7 @@ impl<R: Resources> Renderer<R> {
[0.0, 0.0, -1.0, 0.0],
[-1.0, 1.0, 0.0, 1.0]],
tex: (texture, sampler),
out: out.clone(),
out,
scissor: Rect {
x: 0,
y: 0,
@ -96,6 +96,9 @@ impl<R: Resources> Renderer<R> {
index_buffer: index_buffer,
})
}
pub fn update_render_target(&mut self, out: RenderTargetView<R, gfx::format::Rgba8>) {
self.bundle.data.out = out;
}
pub fn render<'a, F: Factory<R>, C: CommandBuffer<R>>(&mut self,
ui: Ui<'a>,
factory: &mut F,