diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-04-23 11:53:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-24 10:36:07 +0200 |
commit | a26e3ecc3ddb407b204df629f2d1561d2293e0ea (patch) | |
tree | cedddb9fdd05c5425241b06781963d2ef50b7370 /src/gui | |
parent | bded052aad12514ba163ca8c7a73f241b3018a28 (diff) |
Include GLES 3.0 and 3.1 headers when available
In ES builds configure will now check for OpenGL ES 3.0 and 3.1
availability. This allows qopengl.h to include the correct header
and, by defining QT_OPENGL_ES_3 and QT_OPENGL_ES_3_1, the OpenGL
wrappers can provide support for MapBuffer, VAOs, etc. on GLES 3.0+
too. Right now this is not possible since the only standard way to
use an ES function specific to a given version is to use the function
directly. The extension mechanism (eglGetProcAddress and friends), that
is often used in desktop GL, is not available for such functions.
[ChangeLog][QtGui] QtGui's OpenGL headers are now automatically including
the highest available header (gl31.h, gl3.h or gl2.h) in OpenGL ES builds.
Task-number: QTBUG-38168
Change-Id: Ib857c58fe1696a9546fdd1aa143a9237e80325a5
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/opengl/qopengl.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index 190c05ba26..731724b862 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -79,7 +79,28 @@ typedef void* GLeglImageOES; # else // "uncontrolled" ES2 platforms -# include <GLES2/gl2.h> + +// In "es2" builds (QT_OPENGL_ES_2) additional defines indicate if ES +// 3.0 or higher is available. In this case include the corresponding +// header. These are backwards compatible and it should be safe to +// include headers on top of each other, meaning that applications can +// include gl2.h even if gl31.h gets included here. + +// This compile time differentation is important inside Qt because, +// unlike desktop GL, GLES is different when it comes to versioning +// and extensions: Standard functions that are new in a given version +// are always available in a version-specific header and are not +// guaranteed to be dynamically resolvable via eglGetProcAddress (and +// are typically not available as extensions even if they were part of +// an extension for a previous version). + +# if defined(QT_OPENGL_ES_3_1) +# include <GLES3/gl31.h> +# elif defined(QT_OPENGL_ES_3) +# include <GLES3/gl3.h> +# else +# include <GLES2/gl2.h> +#endif /* Some GLES2 implementations (like the one on Harmattan) are missing the |