print_program_info_log.h 859 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. # ifdef _WIN32
  7. # define NOMINMAX
  8. # include <Windows.h>
  9. # undef NOMINMAX
  10. # endif
  11. # include <GL/gl.h>
  12. #endif
  13. namespace igl
  14. {
  15. // Inputs:
  16. // obj OpenGL index of program to print info log about
  17. inline void print_program_info_log(const GLuint obj);
  18. }
  19. // Implementation
  20. #include <cstdio>
  21. // Copyright Denis Kovacs 4/10/08
  22. inline void igl::print_program_info_log(const GLuint obj)
  23. {
  24. GLint infologLength = 0;
  25. GLint charsWritten = 0;
  26. char *infoLog;
  27. glGetProgramiv(obj, GL_INFO_LOG_LENGTH,&infologLength);
  28. if (infologLength > 0)
  29. {
  30. infoLog = (char *)malloc(infologLength);
  31. glGetProgramInfoLog(obj, infologLength, &charsWritten, infoLog);
  32. printf("%s\n",infoLog);
  33. free(infoLog);
  34. }
  35. }
  36. #endif