src/shader.cpp
// check if there is a compile error
check if there is a compile error
check if there is a compile error
void Shader::checkCompileErrors(GLuint id, std::string type) {
  int success;
  char infoLog[1024];
  if (type != "PROGRAM") {
    glGetShaderiv(id, GL_COMPILE_STATUS, &success);
    if (!success) {
      glGetShaderInfoLog(id, 1024, NULL, infoLog);
      std::cout << "shader compilation error of type: " << type << "\n"
                << infoLog << std::endl;
    }
  }
  else {
    glGetProgramiv(id, GL_COMPILE_STATUS, &success);
    if (!success) {
      glGetShaderInfoLog(id, 1024, NULL, infoLog);
      std::cout << "program linking error of type: " << type << "\n"
                << infoLog << std::endl;
    }
  }
}
void Shader :: checkCompileErrors ( GLuint id , std :: string type ) { int success ; char infoLog [ 1024 ] ; if ( type != " " ) { glGetShaderiv ( id , GL_COMPILE_STATUS , & success ) ; if ( ! success ) { glGetShaderInfoLog ( id , 1024 , NULL , infoLog ) ; std :: cout << " " << type << " \n " << infoLog << std :: endl ; } } else { glGetProgramiv ( id , GL_COMPILE_STATUS , & success ) ; if ( ! success ) { glGetShaderInfoLog ( id , 1024 , NULL , infoLog ) ; std :: cout << " " << type << " \n " << infoLog << std :: endl ; } } }
check if there is a compile error
check if there is a compile error