Skip to content

Commit f05d588

Browse files
authored
Merge pull request opencv#16479 from StefanBruens:fix_gles_glx_h_include
Fix compilation errors on GLES platforms * Do not include glx.h when using GLES GL/glx.h is included on all LINUX plattforms, which is wrong for a number of reasons: - GL_PERSPECTIVE_CORRECTION_HINT is defined in GL/gl.h, so we want gl.h not glx.h, the latter just includes the former - GL/gl.h is a Desktop GL header, and should not be included on GLES plattforms - GL/gl.h is already included via QtOpenGL -> QtGui/qopengl.h on desktop plattforms This fixes a problem when Qt is compiled with GLES, which is often done on ARM platforms where desktop GL is not or only poorly supported (e.g. slow due to emulation). Fixes part of opencv#9171. * Only set GL_PERSPECTIVE_CORRECTION_HINT when GL version defines it GL_PERSPECTIVE_CORRECTION_HINT does not exist in GLES 2.0/3.x, and has been deprecated in OpenGL 3.0 core profiles. Fixes part of opencv#9171.
1 parent 84c29dc commit f05d588

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/highgui/src/window_QT.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@
5454
#include <unistd.h>
5555
#endif
5656

57+
// Get GL_PERSPECTIVE_CORRECTION_HINT definition, not available in GLES 2 or
58+
// OpenGL 3 core profile or later
5759
#ifdef HAVE_QT_OPENGL
58-
#if defined Q_WS_X11 /* Qt4 */ || defined Q_OS_LINUX /* Qt5 */
59-
#include <GL/glx.h>
60+
#if defined Q_WS_X11 /* Qt4 */ || \
61+
(!defined(QT_OPENGL_ES_2) && defined Q_OS_LINUX) /* Qt5 with desktop OpenGL */
62+
#include <GL/gl.h>
6063
#endif
6164
#endif
6265

@@ -3226,7 +3229,9 @@ void OpenGlViewPort::updateGl()
32263229

32273230
void OpenGlViewPort::initializeGL()
32283231
{
3232+
#ifdef GL_PERSPECTIVE_CORRECTION_HINT
32293233
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
3234+
#endif
32303235
}
32313236

32323237
void OpenGlViewPort::resizeGL(int w, int h)

0 commit comments

Comments
 (0)