report_gl_error.cpp 750 B

12345678910111213141516171819202122232425262728
  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 "verbose.h"
  11. IGL_INLINE GLenum igl::report_gl_error(const std::string id)
  12. {
  13. GLenum err = glGetError();
  14. if(GL_NO_ERROR != err)
  15. {
  16. verbose("GL_ERROR: ");
  17. fprintf(stderr,"%s%s\n",id.c_str(),gluErrorString(err));
  18. }
  19. return err;
  20. }
  21. IGL_INLINE GLenum igl::report_gl_error()
  22. {
  23. return igl::report_gl_error(std::string(""));
  24. }
  25. #endif