summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-05-06 13:51:14 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-07 14:19:04 +0200
commit87d08acf4024410c36113a2acc5b0532d4d9bfbc (patch)
tree252803b322dcd8506a214641b07bd0a8a49a2150 /src/plugins
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 <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index 807c75df54..735dd26b6d 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -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);