Skip to content

Commit

Permalink
Do not include glx.h when using GLES
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
StefanBruens committed Feb 2, 2020
1 parent 84c29dc commit 0a41cb7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/highgui/src/window_QT.cpp
Expand Up @@ -54,9 +54,12 @@
#include <unistd.h>
#endif

// Get GL_PERSPECTIVE_CORRECTION_HINT definition, not available in GLES 2 or
// OpenGL 3 core profile or later
#ifdef HAVE_QT_OPENGL
#if defined Q_WS_X11 /* Qt4 */ || defined Q_OS_LINUX /* Qt5 */
#include <GL/glx.h>
#if defined Q_WS_X11 /* Qt4 */ || \
(!defined(QT_OPENGL_ES_2) && defined Q_OS_LINUX) /* Qt5 with desktop OpenGL */
#include <GL/gl.h>
#endif
#endif

Expand Down

0 comments on commit 0a41cb7

Please sign in to comment.