Equalizer  1.6.1
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/client/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/client/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 
70 // Error-check macros
71 namespace eq
72 {
74 EQ_API void debugGLError( const std::string& when, const GLenum error,
75  const char* file, const int line );
76 
78 EQ_API std::string glError( const GLenum error );
79 }
80 
81 #ifdef NDEBUG
82 # define EQ_GL_ERROR( when )
83 # define EQ_GL_CALL( code ) { code; }
84 #else // NDEBUG
85 # define EQ_GL_ERROR( when ) \
86  { \
87  const GLenum eqGlError = glGetError(); \
88  if( eqGlError ) \
89  eq::debugGLError( when, eqGlError, __FILE__, __LINE__ ); \
90  }
91 
92 # define EQ_GL_CALL( code ) \
93  { \
94  EQ_GL_ERROR( std::string( "before " ) + #code ); \
95  code; \
96  EQ_GL_ERROR( std::string( "after " ) + #code ); \
97  }
98 #endif // NDEBUG
99 
100 #endif // EQ_GL_H
101 
std::string glError(const GLenum error)
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.