report_gl_error.cpp 768 B

1234567891011121314151617181920212223242526272829
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "report_gl_error.h"
  9. #ifndef IGL_NO_OPENGL
  10. #include <cstdio>
  11. #include "verbose.h"
  12. IGL_INLINE GLenum igl::report_gl_error(const std::string id)
  13. {
  14. GLenum err = glGetError();
  15. if(GL_NO_ERROR != err)
  16. {
  17. verbose("GL_ERROR: ");
  18. fprintf(stderr,"%s%s\n",id.c_str(),gluErrorString(err));
  19. }
  20. return err;
  21. }
  22. IGL_INLINE GLenum igl::report_gl_error()
  23. {
  24. return igl::report_gl_error(std::string(""));
  25. }
  26. #endif