Equalizer  2.1.0
Parallel Rendering Framework
gl.h
Go to the documentation of this file.
1 
2 /* Copyright (c) 2011-2016, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQ_GL_H
19 #define EQ_GL_H
20 
30 #include <eq/api.h>
31 
32 #include <string>
33 
35 #ifndef NOMINMAX
36 #define NOMINMAX
37 #endif
38 #ifndef EQ_IGNORE_GLEW
39 #ifdef EQ_FOUND_GLEW_MX
40 #include <GL/glew.h>
41 #ifdef GLX
42 #include <GL/glxew.h>
43 #endif
44 #ifdef WGL
45 #include <GL/wglew.h>
46 #endif
47 #else
48 #include <eq/GL/glew.h>
49 #ifdef GLX
50 #include <eq/GL/glxew.h>
51 #endif
52 #ifdef WGL
53 #include <eq/GL/wglew.h>
54 #endif
55 #endif
56 #endif
57 
58 #ifdef AGL
59 #include <OpenGL/gl.h>
60 #else
61 #include <GL/gl.h>
62 #include <eq/os.h>
63 #endif
64 
65 #ifndef GL_TEXTURE_RECTANGLE_ARB
66 #define GL_TEXTURE_RECTANGLE_ARB 0x84F5
67 #endif
68 #ifndef GLX_RGBA_FLOAT_BIT
69 #define GLX_RGBA_FLOAT_BIT GLX_RGBA_FLOAT_BIT_ARB
70 #define GLX_RGBA_FLOAT_TYPE GLX_RGBA_FLOAT_TYPE_ARB
71 #endif
72 
73 #define EQ_UNKNOWN_GL_ERROR 0x1 // GL error codes seem to start at 0x500
74 
76 // Error-check macros
77 namespace eq
78 {
80 EQ_API void debugGLError(const std::string& when, const GLenum error,
81  const char* file, const int line);
82 
84 EQ_API std::string glError(const GLenum error);
85 }
86 
87 #ifdef NDEBUG
88 #define EQ_GL_ERROR(when) \
89  { \
90  }
91 #define EQ_GL_CALL(code) \
92  { \
93  code; \
94  }
95 #else // NDEBUG
96 #define EQ_GL_ERROR(when) \
97  { \
98  const GLenum eqGlError = glGetError(); \
99  if (eqGlError) \
100  eq::debugGLError(when, eqGlError, __FILE__, __LINE__); \
101  }
102 
103 #define EQ_GL_CALL(code) \
104  { \
105  EQ_GL_ERROR(std::string("before ") + #code); \
106  code; \
107  EQ_GL_ERROR(std::string("after ") + #code); \
108  }
109 #endif // NDEBUG
110 
111 #endif // EQ_GL_H
EQ_API std::string glError(const GLenum error)
EQ_API void debugGLError(const std::string &when, const GLenum error, const char *file, const int line)
Output an error OpenGL in a human-readable form to LBWARN.
Includes operating system headers for OpenGL and the used window system(s) correctly.
The Equalizer client library.
Definition: eq/agl/types.h:23