Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: glGetProgramInfoLog keeps returning garbage

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2017

    glGetProgramInfoLog keeps returning garbage

    Dear Sir/Madam,

    When checking for errors on the linking and compiling of my shaderProgram it seemed like it does not compile. I have no clue why not so I implemented an errorlog method:

    Code cpp:
        bool Material::CheckCompileErrors(GLuint id, CompiledObjectType type) const
            GLchar infoLog[1024];
            GLint success = 0;
            case shader:
                glGetShaderiv(id, GL_COMPILE_STATUS, &success);
                if (success) return true;
                glGetShaderInfoLog(id, 1024, nullptr, infoLog);
                std:: printf("%s", infoLog);
            case program:
                glGetProgramiv(id, GL_LINK_STATUS, &success);
                if (success) return true;
                glGetProgramInfoLog(id, 1024, nullptr, infoLog);
                std:: printf("%s", infoLog);
                assert("That is not a valid type to check for.");
            return false;

    The purpose of it is to return true when compiling/linking went right and when something goes wrong it should log the error, but instead of logging (in this case the linking error) in logs a lot of garbage. I have no clue why it does this, it makes it almost impossible to debug.

    If you do know why the glGetPrograminfoLog doesn't want to fill my infolog array (which is a technically a pointer which it requires) please inform me of what I'm doing wrong.

    One last thing, the reason I posted this in the GLSL thread and not in the general is because there was no "post new thread" button.


    Last edited by Dark Photon; 12-23-2018 at 05:43 PM.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Check for errors with glGetError(). If glGetShaderInfoLog or glGetProgramInfoLog fail with an error, they won't populate the buffer.

    Other than that, use a debugger to check what's actually being passed to those functions and what they return.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2018
    This (or similar) happend to me too a few days ago. Then replaced my compile function with a function from a tutorial and the checkErrorLog() function stopped spitting garbage.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts