print_shader_info_log.cpp 583 B

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