summaryrefslogtreecommitdiffstats
path: root/src/render/graphicshelpers/graphicshelpergl3_3.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-06-21 10:01:55 +0200
committerPaul Lemire <paul.lemire@kdab.com>2017-07-17 09:28:56 +0000
commitd82620680292f40af522317bf360e48b4e1c7990 (patch)
tree7fc47be80369f2d7d18b6158925521e6dcf53d2e /src/render/graphicshelpers/graphicshelpergl3_3.cpp
parentdc744a54ae6f2a58ff3f0e4b12ec336bcb1bf2d0 (diff)
RenderCapture: read back from the correct framebuffer
Up until now, RenderCapture would read back from the back buffer. In cases where it's used within a RenderTargetSelector, it should instead read back from the ColorAttachment0 of the framebuffer. Later on we might allow to specify the ColorAttachment. Change-Id: I9ca94333184338b2fdb79c5c2668d5929ac8d405 Task-number: QTBUG-61547 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Diffstat (limited to 'src/render/graphicshelpers/graphicshelpergl3_3.cpp')
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
index 6959bdc6b..7bbc333f7 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
@@ -347,9 +347,20 @@ void GraphicsHelperGL3_3::releaseFrameBufferObject(GLuint frameBufferId)
m_funcs->glDeleteFramebuffers(1, &frameBufferId);
}
-void GraphicsHelperGL3_3::bindFrameBufferObject(GLuint frameBufferId)
+void GraphicsHelperGL3_3::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode)
{
- m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId);
+ switch (mode) {
+ case FBODraw:
+ m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId);
+ return;
+ case FBORead:
+ m_funcs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId);
+ return;
+ case FBOReadAndDraw:
+ default:
+ m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId);
+ return;
+ }
}
GLuint GraphicsHelperGL3_3::boundFrameBufferObject()