From 0437e1cef6aa2ed27362fc5c7c8df6609f13c9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 30 Jul 2014 13:17:26 +0200 Subject: 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 --- src/gui/opengl/qopenglvertexarrayobject.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') 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(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES"))); helper->DeleteVertexArrays = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES"))); helper->BindVertexArray = reinterpret_cast(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(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysAPPLE"))); -- cgit v1.2.3