MorphoGraphX  2.0-1-227
GL.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2016 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef GL_HPP
12 #define GL_HPP
13 
14 #include <Config.hpp>
15 #include <GL/gl.h>
16 #include <GL/glu.h>
17 #include <Information.hpp>
18 
19 // For renderbuffers we need OpenGL >= 3.0
20 #define MGX_REQUIRED_OPENGL_VERSION "3.0"
21 #include <QOpenGLFunctions_3_0>
22 #define REPORT_GL_ERROR(str) reportGLError(str, __FILE__, __LINE__)
23 namespace mgx
24 {
25  typedef QOpenGLFunctions_3_0 MGXOpenGLFunctions;
26  extern mgx_EXPORT MGXOpenGLFunctions *glfuncs;
27 
28  inline bool reportGLError(const QString& str, const char* file, int line)
29  {
30  GLenum error = glGetError();
31  if(error) {
32  Information::out << "OpenGL error in file " << file << " on line " << line << " for command : " << str << endl
33  << (char*)gluErrorString(error) << endl;
34  return true;
35  }
36  return false;
37  }
38 }
39 
40 #endif
Information.hpp
mgx::glfuncs
mgx_EXPORT MGXOpenGLFunctions * glfuncs
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::reportGLError
bool reportGLError(const QString &str, const char *file, int line)
Definition: GL.hpp:28
mgx::MGXOpenGLFunctions
QOpenGLFunctions_3_0 MGXOpenGLFunctions
Definition: GL.hpp:25
mgx::Information::out
mgx_EXPORT QTextStream out