From 52e994c8a37e9e9b84f32e2c75b8219242481384 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Thu, 9 Jul 2015 18:02:38 +0100 Subject: Favor OpenGLES 3 on iOS if available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First tries OpenGLES 3 context since it’s strictly compatible with OpenGLES 2. If it fails, then try 2. This is required to use QOpenGLFramebufferObject::blitFramebuffer without having to look at using an Apple-specific extension. Change-Id: I01f8f058fa82e7f2c90d1b894ad36f3d3939c994 Reviewed-by: Tor Arne Vestbø Reviewed-by: Laszlo Agocs --- src/plugins/platforms/ios/qioscontext.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index fe0ca33c13..cc42b6057e 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -48,9 +48,11 @@ QIOSContext::QIOSContext(QOpenGLContext *context) , m_format(context->format()) { m_format.setRenderableType(QSurfaceFormat::OpenGLES); - m_eaglContext = [[EAGLContext alloc] - initWithAPI:EAGLRenderingAPI(m_format.majorVersion()) - sharegroup:m_sharedContext ? [m_sharedContext->m_eaglContext sharegroup] : nil]; + 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) { + m_eaglContext = [[EAGLContext alloc] initWithAPI:EAGLRenderingAPI(version) sharegroup:shareGroup]; + } if (m_eaglContext != nil) { EAGLContext *originalContext = [EAGLContext currentContext]; -- cgit v1.2.3