00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __GLGETPROC_H__
00013 #define __GLGETPROC_H__
00014
00015 #ifdef __WINDOWS__
00016 #include <GL/glext.h>
00017 #define GLGETPROC(a) wglGetProcAddress(a)
00018 #else
00019 #include <GL/glx.h>
00020 #define GLGETPROC(a) glXGetProcAddress((const unsigned char *)(a))
00021 #endif
00022
00023
00024 #define GLCHECKERROR \
00025 GLenum errCode = glGetError(); \
00026 if (errCode != GL_NO_ERROR) \
00027 { \
00028 static unsigned glErrCounter = 0; \
00029 static GLenum lastGlErrCode; \
00030 if (errCode == lastGlErrCode) \
00031 { \
00032 if (glErrCounter++ == 5) \
00033 LOG(wxT("Stopping redundant OpenGL error logging")); \
00034 } \
00035 else \
00036 { \
00037 lastGlErrCode = errCode; \
00038 glErrCounter = 0; \
00039 } \
00040 if (glErrCounter < 5) \
00041 { \
00042 wxString wxglErrStr((const char *)gluErrorString(errCode), wxConvUTF8); \
00043 LOGWARNING(wxT("OpenGL error: ") + wxglErrStr); \
00044 } \
00045 }
00046
00047 #endif