summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index cc42b6057e..8bdb4bcdb3 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -45,14 +45,15 @@
QIOSContext::QIOSContext(QOpenGLContext *context)
: QPlatformOpenGLContext()
, m_sharedContext(static_cast<QIOSContext *>(context->shareHandle()))
+ , m_eaglContext(0)
, m_format(context->format())
{
m_format.setRenderableType(QSurfaceFormat::OpenGLES);
+
EAGLSharegroup *shareGroup = m_sharedContext ? [m_sharedContext->m_eaglContext sharegroup] : nil;
- for (int version = m_format.majorVersion() == 1 ? kEAGLRenderingAPIOpenGLES1 : kEAGLRenderingAPIOpenGLES3;
- version >= m_format.majorVersion() && !m_eaglContext; --version) {
+ const int preferredVersion = m_format.majorVersion() == 1 ? kEAGLRenderingAPIOpenGLES1 : kEAGLRenderingAPIOpenGLES3;
+ for (int version = preferredVersion; !m_eaglContext && version >= m_format.majorVersion(); --version)
m_eaglContext = [[EAGLContext alloc] initWithAPI:EAGLRenderingAPI(version) sharegroup:shareGroup];
- }
if (m_eaglContext != nil) {
EAGLContext *originalContext = [EAGLContext currentContext];