diff options
author | Mike Krus <mike.krus@kdab.com> | 2015-07-09 18:02:38 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-12-09 09:35:56 +0000 |
commit | 52e994c8a37e9e9b84f32e2c75b8219242481384 (patch) | |
tree | fea755303b1d42446a34d8888c5676f25f1fe816 /src | |
parent | f044b3cc673ce854eae909cfbb7f00647acc61c8 (diff) |
Favor OpenGLES 3 on iOS if available
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ø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/ios/qioscontext.mm | 8 |
1 files changed, 5 insertions, 3 deletions
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]; |