TA159

Notas, resueltos y trabajos practicos de la materia Sistemas Gráficos
Index Commits Files Refs Submodules README LICENSE
commit f34aa4f53c46083e0bf3a8e553a0081044adbabc
parent 4ce51c90d6006521b2dcf0b4649a67ce1cda9613
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Sat, 24 Aug 2024 00:19:38 -0300

add default return value to non-void function

Diffstat:
Mopengl-example/main.c | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/opengl-example/main.c b/opengl-example/main.c
@@ -23,8 +23,6 @@ float min(float a, float b) {
 }
 
 void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
-    char s[100];
-
     float min_side = min((float)width, (float)height);
 
     float x = ((float)width - min_side) / 2;
@@ -101,14 +99,17 @@ bool new_program_from_shaders(GLuint *shader_program,
 
     glAttachShader(*shader_program, *vertex_shader);
     glAttachShader(*shader_program, *fragment_shader);
-    LOG_INFO("Linking `vertex_shader` and `fragment_shader`");
+    LOG_INFO("Linking shaders");
     glLinkProgram(*shader_program);
     glGetProgramiv(*shader_program, GL_LINK_STATUS, &return_value);
     if(return_value == GL_FALSE) {
         glGetProgramInfoLog(*shader_program, 512, NULL, link_log);
-        LOG_ERROR("Linking `vertex_shader` and `fragment_shader` failed");
+        LOG_ERROR("Linking shaders failed");
         LOG_ERROR(link_log + 7); // remove the `error: ` prefix of message
+        return false;
     }
+
+    return true;
 }
 
 bool new_program_from_shaders_source(GLuint *shader_program,
@@ -139,7 +140,7 @@ bool new_program_from_shaders_source(GLuint *shader_program,
 GLuint current_program;
 
 bool reload_shaders(const char *vert_shader_file_path, const char *frag_shader_file_path) {
-    LOG_INFO("Reloading shaders");
+    LOG_INFO("Recompiling shaders");
 
     GLuint new_program;
     if(!new_program_from_shaders_source(&new_program,