summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qioscontext.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-12-10 17:49:53 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:55:51 +0100
commit21965187096f8bde7866b05459444793e1a6c1b1 (patch)
tree099a58bd0cc98be844ffb4009040055d334786e4 /src/plugins/platforms/ios/qioscontext.mm
parentd059866eb43a7415dd786a2bcba14f729d938675 (diff)
iOS: Update GL render buffers when the accociated window is resized
We keep track of the with and height of the FBO's buffers, and update their storage if the window size has changed since last time. Change-Id: I97788b69e7067a5b5b9f28e8498cf1bc5d2cf6ea Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qioscontext.mm')
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index 8beb588b03..68db28212b 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -88,7 +88,8 @@ bool QIOSContext::makeCurrent(QPlatformSurface *surface)
[EAGLContext setCurrentContext:m_eaglContext];
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebufferObject(surface));
- return true;
+ // Ensures render buffers are set up and match the size of the window
+ return defaultColorRenderbuffer(surface) != 0;
}
void QIOSContext::doneCurrent()
@@ -101,13 +102,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface)
Q_ASSERT(surface && surface->surface()->surfaceType() == QSurface::OpenGLSurface);
[EAGLContext setCurrentContext:m_eaglContext];
-
- GLint renderbuffer;
- glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebufferObject(surface));
- glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &renderbuffer);
- glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
-
+ glBindRenderbuffer(GL_RENDERBUFFER, defaultColorRenderbuffer(surface));
[m_eaglContext presentRenderbuffer:GL_RENDERBUFFER];
}
@@ -116,6 +111,11 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
return static_cast<QIOSWindow *>(surface)->framebufferObject(*const_cast<const QIOSContext*>(this));
}
+GLuint QIOSContext::defaultColorRenderbuffer(QPlatformSurface *surface) const
+{
+ return static_cast<QIOSWindow *>(surface)->colorRenderbuffer(*const_cast<const QIOSContext*>(this));
+}
+
QFunctionPointer QIOSContext::getProcAddress(const QByteArray& functionName)
{
return reinterpret_cast<QFunctionPointer>(dlsym(RTLD_NEXT, functionName.constData()));