Equalizer  1.11.0
Parallel Rendering Framework
gl.h
Go to the documentation of this file.
1 
2 /* Copyright (c) 2011-2012, 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 <eq/os.h>
62 # include <GL/gl.h>
63 #endif
64 
65 #ifndef GL_TEXTURE_RECTANGLE_ARB
66 # define GL_TEXTURE_RECTANGLE_ARB 0x84F5
67 #endif
68 # define EQ_UNKNOWN_GL_ERROR 0x1 // GL error codes seem to start at 0x500
69 
71 // Error-check macros
72 namespace eq
73 {
75 EQ_API void debugGLError( const std::string& when, const GLenum error,
76  const char* file, const int line );
77 
79 EQ_API std::string glError( const GLenum error );
80 }
81 
82 #ifdef NDEBUG
83 # define EQ_GL_ERROR( when ) {}
84 # define EQ_GL_CALL( code ) { code; }
85 #else // NDEBUG
86 # define EQ_GL_ERROR( when ) \
87  { \
88  const GLenum eqGlError = glGetError(); \
89  if( eqGlError ) \
90  eq::debugGLError( when, eqGlError, __FILE__, __LINE__ ); \
91  }
92 
93 # define EQ_GL_CALL( code ) \
94  { \
95  EQ_GL_ERROR( std::string( "before " ) + #code ); \
96  code; \
97  EQ_GL_ERROR( std::string( "after " ) + #code ); \
98  }
99 #endif // NDEBUG
100 
101 #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