I am trying to debug my OpenGL shaders compilation but i'm having some strange output related to null characters I believe, my debugger console is flooded with a lot of x00 characters and I am trying to understand where does it come from and how to get rid of it. This is my function:
void DebugShader(GLuint shader) { //debug shader
GLint isComp = 0;
GLint maxLength;
std::vector<GLchar> errorLog(maxLength);
std::string log;
glGetShaderiv(shader, GL_COMPILE_STATUS, &isComp);
if(isComp!=GL_TRUE) {
glGetShaderiv(shader,GL_INFO_LOG_LENGTH,&maxLength);
glGetShaderInfoLog(shader, maxLength, &maxLength,&errorLog[0]);
std::cout << "Shader compilation Failed." << std::endl;
}
for (int i = 0; i<maxLength; i++){
log.push_back(errorLog.at(i));
std::cout << log;
}
if (isComp==GL_TRUE){
std::cout << "Shader compilation successful." << std::endl;
glDeleteShader(shader);
}
}
This is the output I am getting:
"x00x00x00x00 ........ x00x00x00x00"
If I mess up the shader codes, just to check if the error output is working, I can find the error messages among those characters
question from:
https://stackoverflow.com/questions/65891041/glsl-shader-compilation-debugger-results-in-a-flood-of-the-character-x00-on-the 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…