Recompile both fragment shaders when resetting

This commit is contained in:
Dimitri Lozeve 2021-02-24 21:50:45 +01:00
parent 60d94b06f2
commit f434b661eb
2 changed files with 12 additions and 5 deletions

View file

@ -156,13 +156,18 @@ void capture_screenshot() {
* @param shader_program Pointer to the shader program to update if needed. * @param shader_program Pointer to the shader program to update if needed.
* @param fragment_shader_file The shader file to reload if needed. * @param fragment_shader_file The shader file to reload if needed.
*/ */
void process_input(GLFWwindow *window, unsigned int *shader_program, void process_input(GLFWwindow *window, unsigned int *screen_shader,
const char *const fragment_shader_file) { const char *const screen_shader_file,
unsigned int *buffer_shader,
const char *const buffer_shader_file) {
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
log_debug("Quitting"); log_debug("Quitting");
glfwSetWindowShouldClose(window, true); glfwSetWindowShouldClose(window, true);
} else if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS) { } 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) { } else if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) {
capture_screenshot(); capture_screenshot();
} }

View file

@ -7,7 +7,9 @@ GLFWwindow *initialize_window(int width, int height);
unsigned int initialize_vertices(); unsigned int initialize_vertices();
void framebuffer_size_callback(GLFWwindow *window, int width, int height); void framebuffer_size_callback(GLFWwindow *window, int width, int height);
void capture_screenshot(); void capture_screenshot();
void process_input(GLFWwindow *window, unsigned int *shader_program, void process_input(GLFWwindow *window, unsigned int *screen_shader,
const char *const fragment_shader_file); const char *const screen_shader_file,
unsigned int *buffer_shader,
const char *const buffer_shader_file);
#endif /* RENDERER_H */ #endif /* RENDERER_H */