From 28f1e12c8aeddc47bfced50e33a94c75b501a0df Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 8 Mar 2014 17:18:35 +0100 Subject: [PATCH] Check GLSL program link status, for better error reporting. --- resource_pool.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resource_pool.cpp b/resource_pool.cpp index 4f2cc2b..04b1aa9 100644 --- a/resource_pool.cpp +++ b/resource_pool.cpp @@ -105,6 +105,15 @@ GLuint ResourcePool::compile_glsl_program(const string& vertex_shader, const str glLinkProgram(glsl_program_num); check_error(); + GLint success; + glGetProgramiv(glsl_program_num, GL_LINK_STATUS, &success); + if (success == GL_FALSE) { + GLchar error_log[1024] = {0}; + glGetProgramInfoLog(glsl_program_num, 1024, NULL, error_log); + fprintf(stderr, "Error linking program: %s\n", error_log); + exit(1); + } + if (movit_debug_level == MOVIT_DEBUG_ON) { // Output shader to a temporary file, for easier debugging. static int compiled_shader_num = 0; -- 2.39.2