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>
bb10
Mike Krus 2015-07-09 18:02:38 +01:00 committed by Simon Hausmann
parent f044b3cc67
commit 52e994c8a3
1 changed files with 5 additions and 3 deletions

View File

@ -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];