From 0d63c22681f9077bcbb7d83dfd861115d2a33c26 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Wed, 7 Jun 2017 15:35:50 -0400 Subject: [PATCH] gamnit: fix color buffer clearing issues on some computers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/gamnit/dynamic_resolution.nit | 4 +++- lib/gamnit/flat.nit | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/gamnit/dynamic_resolution.nit b/lib/gamnit/dynamic_resolution.nit index 40ea221..e7c2def 100644 --- a/lib/gamnit/dynamic_resolution.nit +++ b/lib/gamnit/dynamic_resolution.nit @@ -73,6 +73,7 @@ redef class App # Draw directly to the screen framebuffer glBindFramebuffer(gl_FRAMEBUFFER, dynamic_context.screen_framebuffer) glViewport(0, 0, display.width, display.height) + glClear gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT var gl_error = glGetError assert gl_error == gl_NO_ERROR else print_error gl_error @@ -81,13 +82,14 @@ redef class App # Draw to our dynamic framebuffer glBindFramebuffer(gl_FRAMEBUFFER, dynamic_context.dynamic_framebuffer) - glClear gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT var ratio = dynamic_resolution_ratio ratio = ratio.clamp(min_dynamic_resolution_ratio, max_dynamic_resolution_ratio) glViewport(0, 0, (display.width.to_f*ratio).to_i, (display.height.to_f*ratio).to_i) + glClear gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT + var gl_error = glGetError assert gl_error == gl_NO_ERROR else print_error gl_error end diff --git a/lib/gamnit/flat.nit b/lib/gamnit/flat.nit index cbcc2e7..70d8c53 100644 --- a/lib/gamnit/flat.nit +++ b/lib/gamnit/flat.nit @@ -375,9 +375,6 @@ redef class App redef fun frame_core(display) do - # Prepare to draw, clear buffers - glClear(gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT) - # Check errors var gl_error = glGetError assert gl_error == gl_NO_ERROR else print_error gl_error -- 1.7.9.5