print_program_info_log.h 770 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef IGL_PRINT_PROGRAM_INFO_LOG_H
  2. #define IGL_PRINT_PROGRAM_INFO_LOG_H
  3. #ifdef __APPLE__
  4. # include <OpenGL/gl.h>
  5. #else
  6. # include <GL/gl.h>
  7. #endif
  8. namespace igl
  9. {
  10. // Inputs:
  11. // obj OpenGL index of program to print info log about
  12. inline void print_program_info_log(const GLuint obj);
  13. }
  14. // Implmentation
  15. #include <cstdio>
  16. // Copyright Denis Kovacs 4/10/08
  17. inline void igl::print_program_info_log(const GLuint obj)
  18. {
  19. GLint infologLength = 0;
  20. GLint charsWritten = 0;
  21. char *infoLog;
  22. glGetProgramiv(obj, GL_INFO_LOG_LENGTH,&infologLength);
  23. if (infologLength > 0)
  24. {
  25. infoLog = (char *)malloc(infologLength);
  26. glGetProgramInfoLog(obj, infologLength, &charsWritten, infoLog);
  27. printf("%s\n",infoLog);
  28. free(infoLog);
  29. }
  30. }
  31. #endif