For completeness: I had to reduce the length by 1 because OpenGL returns the length including the 0 character, making the string contain two 0 characters at the end.
>From ><https://registry.khronos.org/OpenGL-Refpages/gl4/html/glGetProgram.xhtml>: > GL_INFO_LOG_LENGTH > > params returns the number of characters in the information log for program > including the null termination character (i.e., the size of the character > buffer required to store the information log). If program has no information > log, a value of 0 is returned. This is not really a big deal when simply printing the string, but if I want to for example query all shader uniform variables and put them in a table and then address them by their name, this becomes necessary because I need to add the 0 to find them if I don't decrease the length: var numUniforms: GLint maxNameLen: GLint glGetProgramiv(result.id, GL_ACTIVE_UNIFORMS, numUniforms.addr) glGetProgramiv(result.id, GL_ACTIVE_UNIFORM_MAX_LENGTH, maxNameLen.addr) var nameBuf = newString(maxNameLen - 1) for i in 0.GLuint .. numUniforms.GLuint - 1: var usize: GLint utype: GLenum uloc: GLint glGetActiveUniform(result.id, i, maxNameLen, nil, usize.addr, utype.addr, nameBuf.cstring) uloc = glGetUniformLocation(result.id, nameBuf.cstring) result.uniformLocation[nameBuf] = uloc Run To clarify, without the -1, I had to: let uColor = progTest.uniformLocation["uColor\0"] Run