Equalizer
1.2.1
|
00001 00002 /* Copyright (c) 2011, Stefan Eilemann <eile@eyescale.ch> 00003 * 00004 * This library is free software; you can redistribute it and/or modify it under 00005 * the terms of the GNU Lesser General Public License version 2.1 as published 00006 * by the Free Software Foundation. 00007 * 00008 * This library is distributed in the hope that it will be useful, but WITHOUT 00009 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00010 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00011 * details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this library; if not, write to the Free Software Foundation, Inc., 00015 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00016 */ 00017 00018 #ifndef EQ_GL_H 00019 #define EQ_GL_H 00020 00030 #include <eq/client/api.h> 00031 00032 #include <string> 00033 00035 #ifndef NOMINMAX 00036 # define NOMINMAX 00037 #endif 00038 #ifndef EQ_IGNORE_GLEW 00039 # ifdef EQ_FOUND_GLEW_MX 00040 # include <GL/glew.h> 00041 # ifdef GLX 00042 # include <GL/glxew.h> 00043 # endif 00044 # ifdef WGL 00045 # include <GL/wglew.h> 00046 # endif 00047 # else 00048 # include <eq/GL/glew.h> 00049 # ifdef GLX 00050 # include <eq/GL/glxew.h> 00051 # endif 00052 # ifdef WGL 00053 # include <eq/GL/wglew.h> 00054 # endif 00055 # endif 00056 #endif 00057 00058 #ifdef AGL 00059 # include <OpenGL/gl.h> 00060 #else 00061 # include <GL/gl.h> 00062 #endif 00063 00064 #ifndef GL_TEXTURE_RECTANGLE_ARB 00065 # define GL_TEXTURE_RECTANGLE_ARB 0x84F5 00066 #endif 00067 00069 // Error-check macros 00070 namespace eq 00071 { 00073 EQ_API void debugGLError( const std::string& when, const GLenum error, 00074 const char* file, const int line ); 00075 } 00076 00077 #ifdef NDEBUG 00078 # define EQ_GL_ERROR( when ) 00079 # define EQ_GL_CALL( code ) { code; } 00080 #else // NDEBUG 00081 # define EQ_GL_ERROR( when ) \ 00082 { \ 00083 const GLenum eqGlError = glGetError(); \ 00084 if( eqGlError ) \ 00085 eq::debugGLError( when, eqGlError, __FILE__, __LINE__ ); \ 00086 } 00087 00088 # define EQ_GL_CALL( code ) \ 00089 { \ 00090 EQ_GL_ERROR( std::string( "before " ) + #code ); \ 00091 code; \ 00092 EQ_GL_ERROR( std::string( "after " ) + #code ); \ 00093 } 00094 #endif // NDEBUG 00095 00096 #endif // EQ_GL_H 00097