diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-07-30 13:17:26 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2014-07-30 20:01:52 +0200 |
commit | 0437e1cef6aa2ed27362fc5c7c8df6609f13c9ee (patch) | |
tree | d013d12199293d06e3dff95c98eb37850fe0be81 /src/gui | |
parent | 12867bb8e2bf56e9397ee6b6014e176fdab6e86f (diff) |
Use runtime check instead of ifdef to detect ES3 in QVertexArrayObjectHelper
The code path in QOpenGLVertexArrayObjectPrivate::create() that triggers
the creation of a QVertexArrayObjectHelper is guarded by runtime checks
for ES3 or the GL_OES_vertex_array_object extension, but the actual
function lookup was ifdef'ed, which broke on iOS where the SDK may
support ES3, but an older (supported) runtime target might not.
Change-Id: Id578667c1f5aebf53e197f3a79eb2f9273fea487
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/opengl/qopenglvertexarrayobject.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index c2109a1cec..3b106fecf5 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -65,18 +65,19 @@ void qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, if (context->isOpenGLES()) { #ifdef QT_OPENGL_ES_3 - helper->GenVertexArrays = ::glGenVertexArrays; - helper->DeleteVertexArrays = ::glDeleteVertexArrays; - helper->BindVertexArray = ::glBindVertexArray; - tryARB = false; -#else + if (context->format().majorVersion() >= 3) { + helper->GenVertexArrays = ::glGenVertexArrays; + helper->DeleteVertexArrays = ::glDeleteVertexArrays; + helper->BindVertexArray = ::glBindVertexArray; + tryARB = false; + } else +#endif if (context->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) { helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES"))); helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES"))); helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES"))); tryARB = false; } -#endif } else if (context->hasExtension(QByteArrayLiteral("GL_APPLE_vertex_array_object")) && !context->hasExtension(QByteArrayLiteral("GL_ARB_vertex_array_object"))) { helper->GenVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysAPPLE"))); |