From f434b661ebd4407aea07f77f78f2fcf333473652 Mon Sep 17 00:00:00 2001 From: Dimitri Lozeve Date: Wed, 24 Feb 2021 21:50:45 +0100 Subject: [PATCH] Recompile both fragment shaders when resetting --- src/renderer.c | 11 ++++++++--- src/renderer.h | 6 ++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/renderer.c b/src/renderer.c index 5380a5f..d21391a 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -156,13 +156,18 @@ void capture_screenshot() { * @param shader_program Pointer to the shader program to update if needed. * @param fragment_shader_file The shader file to reload if needed. */ -void process_input(GLFWwindow *window, unsigned int *shader_program, - const char *const fragment_shader_file) { +void process_input(GLFWwindow *window, unsigned int *screen_shader, + const char *const screen_shader_file, + unsigned int *buffer_shader, + const char *const buffer_shader_file) { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) { log_debug("Quitting"); glfwSetWindowShouldClose(window, true); } else if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) { - compile_shaders(shader_program, fragment_shader_file); + compile_shaders(screen_shader, screen_shader_file); + if (buffer_shader_file) { + compile_shaders(buffer_shader, buffer_shader_file); + } } else if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) { capture_screenshot(); } diff --git a/src/renderer.h b/src/renderer.h index dad7047..ecfefcf 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -7,7 +7,9 @@ GLFWwindow *initialize_window(int width, int height); unsigned int initialize_vertices(); void framebuffer_size_callback(GLFWwindow *window, int width, int height); void capture_screenshot(); -void process_input(GLFWwindow *window, unsigned int *shader_program, - const char *const fragment_shader_file); +void process_input(GLFWwindow *window, unsigned int *screen_shader, + const char *const screen_shader_file, + unsigned int *buffer_shader, + const char *const buffer_shader_file); #endif /* RENDERER_H */