report_gl_error.h 713 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef IGL_REPORT_GL_ERROR_H
  2. #define IGL_REPORT_GL_ERROR_H
  3. #include "igl_inline.h"
  4. #ifdef __APPLE__
  5. # include <OpenGL/gl.h>
  6. # include <OpenGL/glu.h>
  7. #else
  8. # ifdef _WIN32
  9. # define NOMINMAX
  10. # include <Windows.h>
  11. # undef NOMINMAX
  12. # endif
  13. # include <GL/gl.h>
  14. # include <GL/glu.h>
  15. #endif
  16. #include <cstdio>
  17. #include <string>
  18. namespace igl
  19. {
  20. // Print last OpenGL error to stderr prefixed by specified id string
  21. // Inputs:
  22. // id string to appear before any error msgs
  23. // Returns result of glGetError()
  24. IGL_INLINE GLenum report_gl_error(const std::string id);
  25. // No prefix
  26. IGL_INLINE GLenum report_gl_error();
  27. }
  28. #ifdef IGL_HEADER_ONLY
  29. # include "report_gl_error.cpp"
  30. #endif
  31. #endif