diff options
-rw-r--r-- | config.tests/unix/opengldesktop/opengldesktop.cpp | 1 | ||||
-rw-r--r-- | config.tests/unix/opengles2/opengles2.cpp | 1 | ||||
-rw-r--r-- | config.tests/unix/opengles3/opengles3.cpp | 1 | ||||
-rw-r--r-- | src/gui/opengl/qopengl.h | 22 |
4 files changed, 24 insertions, 1 deletions
diff --git a/config.tests/unix/opengldesktop/opengldesktop.cpp b/config.tests/unix/opengldesktop/opengldesktop.cpp index 13e3059364..7ca8764a09 100644 --- a/config.tests/unix/opengldesktop/opengldesktop.cpp +++ b/config.tests/unix/opengldesktop/opengldesktop.cpp @@ -34,6 +34,7 @@ #ifdef __APPLE__ #include <OpenGL/gl.h> #else +#define GL_GLEXT_PROTOTYPES #include <GL/gl.h> #endif diff --git a/config.tests/unix/opengles2/opengles2.cpp b/config.tests/unix/opengles2/opengles2.cpp index b3b9be6d49..81926f3ee4 100644 --- a/config.tests/unix/opengles2/opengles2.cpp +++ b/config.tests/unix/opengles2/opengles2.cpp @@ -34,6 +34,7 @@ #ifdef BUILD_ON_MAC #include <OpenGLES/ES2/gl.h> #else + #define GL_GLEXT_PROTOTYPES #include <GLES2/gl2.h> #endif diff --git a/config.tests/unix/opengles3/opengles3.cpp b/config.tests/unix/opengles3/opengles3.cpp index 506ac8b19c..80b2323465 100644 --- a/config.tests/unix/opengles3/opengles3.cpp +++ b/config.tests/unix/opengles3/opengles3.cpp @@ -34,6 +34,7 @@ #ifdef BUILD_ON_MAC #include <OpenGLES/ES3/gl.h> #else + #define GL_GLEXT_PROTOTYPES #include <GLES3/gl3.h> #endif diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index a060949c17..aa0e6394d3 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -89,6 +89,13 @@ typedef void* GLeglImageOES; // applications cannot target ES 3. Therefore QOpenGLFunctions and // friends do everything dynamically and never rely on these macros. +// Some Khronos headers use the ext proto guard in the standard headers as well, +// which is bad. Work it around, but avoid spilling over to the ext header. +# ifndef GL_GLEXT_PROTOTYPES +# define GL_GLEXT_PROTOTYPES +# define QGL_TEMP_GLEXT_PROTO +# endif + # if defined(QT_OPENGL_ES_3_1) # include <GLES3/gl31.h> # elif defined(QT_OPENGL_ES_3) @@ -97,6 +104,11 @@ typedef void* GLeglImageOES; # include <GLES2/gl2.h> #endif +# ifdef QGL_TEMP_GLEXT_PROTO +# undef GL_GLEXT_PROTOTYPES +# undef QGL_TEMP_GLEXT_PROTO +# endif + /* Some GLES2 implementations (like the one on Harmattan) are missing the typedef for GLchar. Work around it here by adding it. The Kkronos headers @@ -117,7 +129,15 @@ typedef char GLchar; # include <OpenGL/glext.h> # else # define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system glext.h -# include <GL/gl.h> +// Some Khronos headers use the ext proto guard in the standard headers as well, +// which is bad. Work it around, but avoid spilling over to the ext header. +# ifndef GL_GLEXT_PROTOTYPES +# define GL_GLEXT_PROTOTYPES +# include <GL/gl.h> +# undef GL_GLEXT_PROTOTYPES +# else +# include <GL/gl.h> +# endif # include <QtGui/qopenglext.h> # endif // Q_OS_MAC #endif // QT_OPENGL_ES_2 |