summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2015-12-09 11:22:37 +0100
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-12-09 11:06:43 +0000
commit3655c334b0f4a28a1487c918384da50498ef9418 (patch)
treeadeb4c65e7de5e80044105fa2e2c1ede494e24cf /src/render
parent0e15154c9f0d982096a551efc53fd363d2b2f68d (diff)
Fix Rendering to Scene3D on Raspberry Pi (maybe other ES2 devices)
When using an external FBO like in the case of Scene3D, we try to get the query the size of the FBO's color attachment so that we can call glViewport in the case that there are multiple viewports. For ES2 this is problematic because it is not possible to query the size of a GL_TEXTURE attachment (which the attachment will normally be if there is no multi-sampling). When the query is not possible we simply return without calling glViewport. On ES2 it is possible to query the size of a RenderBuffer and this has been implemented for this code path. As an oddity in the VideoCore OpenGL drivers for the Raspberry Pi, when we query the type of the color attachment for the FBO, it returns the type as RenderBuffer even though we created it as a GL_TEXTURE (likely because they are the same in the driver). This creates an issue though because when we query the size of the RenderBuffer it returns a height and width of 0, which we then use to call glViewport, leading to nothing being rendered into the FBO. This commit checks the validity of the size before making the call to glViewport. Change-Id: I0c3235afd7bcc7fe70ca0dda0379b1ceb2cdab38 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render')
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index c7aac5c88..41b354c23 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -274,6 +274,10 @@ void GraphicsContext::setViewport(const QRectF &viewport)
}
}
+ // Check that the returned size is before calling glViewport
+ if (renderTargetSize.isEmpty())
+ return;
+
// Qt3D 0------------------> 1 OpenGL 1^
// | |
// | |