print_shader_info_log.cpp 612 B

123456789101112131415161718192021222324
  1. #include "print_shader_info_log.h"
  2. #ifndef IGL_NO_OPENGL
  3. #include <cstdio>
  4. #include <stdlib.h>
  5. // Copyright Denis Kovacs 4/10/08
  6. IGL_INLINE void igl::print_shader_info_log(const GLuint obj)
  7. {
  8. GLint infologLength = 0;
  9. GLint charsWritten = 0;
  10. char *infoLog;
  11. // Get shader info log from opengl
  12. glGetShaderiv(obj, GL_INFO_LOG_LENGTH,&infologLength);
  13. // Only print if there is something in the log
  14. if (infologLength > 0)
  15. {
  16. infoLog = (char *)malloc(infologLength);
  17. glGetShaderInfoLog(obj, infologLength, &charsWritten, infoLog);
  18. printf("%s\n",infoLog);
  19. free(infoLog);
  20. }
  21. }
  22. #endif