From f8944767d8f3349d136b0453ebcdb711dfc93520 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Wed, 30 Nov 2016 21:21:35 +0100 Subject: [PATCH] Clear draw buffer after creation and resize. --- src/gl_context.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gl_context.rs b/src/gl_context.rs index 0bce1eb..4e56b06 100644 --- a/src/gl_context.rs +++ b/src/gl_context.rs @@ -158,7 +158,7 @@ impl GLContext if self.draw_buffer.is_some() { let color_attachment_type = self.borrow_draw_buffer().unwrap().color_attachment_type(); - self.create_draw_buffer(size, color_attachment_type) + self.init_offscreen(size, color_attachment_type) } else { Err("No DrawBuffer found") } @@ -184,6 +184,8 @@ impl GLContextPrivateMethods for GLContext { debug_assert!(self.is_current()); unsafe { + gl::ClearColor(0.0, 0.0, 0.0, 0.0); + gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT | gl::STENCIL_BUFFER_BIT); gl::Scissor(0, 0, size.width, size.height); gl::Viewport(0, 0, size.width, size.height); }