path: root/src/plugins/platforms/ios/
diff options
authorTor Arne Vestbø <>2013-05-06 13:51:14 +0200
committerThe Qt Project <>2013-05-07 14:19:04 +0200
commit87d08acf4024410c36113a2acc5b0532d4d9bfbc (patch)
tree252803b322dcd8506a214641b07bd0a8a49a2150 /src/plugins/platforms/ios/
parent8dfeb1c374972f06759a92b4edc5d6a18b96ccec (diff)
iOS: Set context and bind FBO before allocating render-buffer storage
defaultFramebufferObject() may be called from anywhere, at any point, not just makeCurrent(). One example is the glyph-cache, which uses it to re-bind the default FBO after generating the texture cache. If the default FBO had already been created, but the render-buffer was out of sync with the window size, we would end up in the resize code without the correct context current, and without the render-buffer's owning FBO bound. This caused "Failed to make complete framebuffer object 8cd7" warnings at runtime. We now make the context current and bind the FBO, even though it might already be bound and the context current from makeCurrent(), or when initially creating the FBO. For the future we should move the whole resize logic out of defaultFramebufferObject() and call it from makeCurrent(), or possibly [EAGLView layoutSubviews]. That's a higher impact change though, which we reserve for the 'dev' branch. Change-Id: I50ea949c12a02ad1af6ec9fdc3215d5da85b324f Reviewed-by: Richard Moe Gustavsen <>
Diffstat (limited to 'src/plugins/platforms/ios/')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/ b/src/plugins/platforms/ios/
index 807c75df54..735dd26b6d 100644
--- a/src/plugins/platforms/ios/
+++ b/src/plugins/platforms/ios/
@@ -156,6 +156,9 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
if (framebufferObject.renderbufferWidth != platformWindow->effectiveWidth() ||
framebufferObject.renderbufferHeight != platformWindow->effectiveHeight()) {
+ [EAGLContext setCurrentContext:m_eaglContext];
+ glBindFramebuffer(GL_FRAMEBUFFER, framebufferObject.handle);
glBindRenderbuffer(GL_RENDERBUFFER, framebufferObject.colorRenderbuffer);
UIView *view = reinterpret_cast<UIView *>(platformWindow->winId());
CAEAGLLayer *layer = static_cast<CAEAGLLayer *>(view.layer);