Unverified Commit f05d5888 authored by StefanBruens's avatar StefanBruens Committed by GitHub

Merge pull request #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 #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 #9171.
parent 84c29dce
......@@ -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
......@@ -3226,7 +3229,9 @@ void OpenGlViewPort::updateGl()
void OpenGlViewPort::initializeGL()
{
#ifdef GL_PERSPECTIVE_CORRECTION_HINT
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
#endif
}
void OpenGlViewPort::resizeGL(int w, int h)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment