Skip to content

Fix compilation errors on GLES platforms - #16479

Merged
alalek merged 2 commits into
opencv:3.4from
StefanBruens:fix_gles_glx_h_include
Feb 2, 2020
Merged

alalek merged 2 commits into
opencv:3.4from
StefanBruens:fix_gles_glx_h_include

Conversation

@StefanBruens

@StefanBruens StefanBruens commented Feb 2, 2020 •

Copy link
Copy Markdown
Contributor

resolves #9171

build_image:Custom=qt:16.04
buildworker:Custom=linux-1

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.
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.

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you for the contribution 👍

@alalek
alalek merged commit f05d588 into opencv:3.4 Feb 2, 2020
@alalek alalek mentioned this pull request Feb 4, 2020
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug category: build/install Hackathon https://opencv.org/opencv-hackathon-starts-next-week/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants