From: Steinar H. Gunderson Date: Sat, 8 Mar 2014 16:18:35 +0000 (+0100) Subject: Check GLSL program link status, for better error reporting. X-Git-Tag: 1.0~42 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=28f1e12c8aeddc47bfced50e33a94c75b501a0df Check GLSL program link status, for better error reporting. --- 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;