Equalizer  1.4.1
gl.h
Go to the documentation of this file.
00001 
00002 /* Copyright (c) 2011-2012, 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 <eq/client/os.h>
00062 #  include <GL/gl.h>
00063 #endif
00064 
00065 #ifndef GL_TEXTURE_RECTANGLE_ARB
00066 #  define GL_TEXTURE_RECTANGLE_ARB 0x84F5
00067 #endif
00068 
00070 // Error-check macros
00071 namespace eq
00072 {
00074 EQ_API void debugGLError( const std::string& when, const GLenum error,
00075                           const char* file, const int line );
00076 
00078 EQ_API std::string glError( const GLenum error );
00079 }
00080 
00081 #ifdef NDEBUG
00082 #  define EQ_GL_ERROR( when )
00083 #  define EQ_GL_CALL( code ) { code; }
00084 #else // NDEBUG
00085 #  define EQ_GL_ERROR( when )                                           \
00086     {                                                                   \
00087         const GLenum eqGlError = glGetError();                          \
00088         if( eqGlError )                                                 \
00089             eq::debugGLError( when, eqGlError, __FILE__, __LINE__ );    \
00090     }
00091 
00092 #  define EQ_GL_CALL( code )                              \
00093     {                                                     \
00094         EQ_GL_ERROR( std::string( "before " ) + #code );  \
00095         code;                                             \
00096         EQ_GL_ERROR( std::string( "after " ) + #code );   \
00097     }
00098 #endif // NDEBUG
00099 
00100 #endif // EQ_GL_H
00101 
Generated on Mon Nov 26 2012 14:41:48 for Equalizer 1.4.1 by  doxygen 1.7.6.1