Commit 8ccb3daa authored by Christopher Tenter's avatar Christopher Tenter

Send depth buffer to all post processors #refs 1743

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17533 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e59aa388
...@@ -704,7 +704,6 @@ void glViewer::drawScene() ...@@ -704,7 +704,6 @@ void glViewer::drawScene()
postProcSrc = postProcTarget; postProcSrc = postProcTarget;
postProcInput.colorTex_ = postProcessFBO_[postProcSrc].getAttachment(GL_COLOR_ATTACHMENT0); postProcInput.colorTex_ = postProcessFBO_[postProcSrc].getAttachment(GL_COLOR_ATTACHMENT0);
postProcInput.depthTex_ = postProcessFBO_[postProcSrc].getAttachment(GL_DEPTH_ATTACHMENT);
} }
// ================================================================================= // =================================================================================
...@@ -712,6 +711,9 @@ void glViewer::drawScene() ...@@ -712,6 +711,9 @@ void glViewer::drawScene()
// unbind vbo for qt log window // unbind vbo for qt log window
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
// fbo.release(); // fbo.release();
// //
// QRect blitRect(0,0,glstate_->viewport_width(),glstate_->viewport_height()); // QRect blitRect(0,0,glstate_->viewport_width(),glstate_->viewport_height());
...@@ -2438,9 +2440,11 @@ void glViewer::readBackBuffer(ACG::GLState* _glstate) ...@@ -2438,9 +2440,11 @@ void glViewer::readBackBuffer(ACG::GLState* _glstate)
// Resize if already exists // Resize if already exists
if (width != sceneTexReadBackWidth_ || height != sceneTexReadBackHeight_) if (width != sceneTexReadBackWidth_ || height != sceneTexReadBackHeight_)
{ {
sceneTexReadBack_.enable();
sceneTexReadBack_.bind(); sceneTexReadBack_.bind();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
depthTexReadBack_.enable();
depthTexReadBack_.bind(); depthTexReadBack_.bind();
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0);
...@@ -2450,11 +2454,15 @@ void glViewer::readBackBuffer(ACG::GLState* _glstate) ...@@ -2450,11 +2454,15 @@ void glViewer::readBackBuffer(ACG::GLState* _glstate)
// read back buffer // read back buffer
sceneTexReadBack_.enable();
sceneTexReadBack_.bind(); sceneTexReadBack_.bind();
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, x, y, width , height, 0); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, x, y, width , height, 0);
sceneTexReadBack_.disable();
depthTexReadBack_.enable();
depthTexReadBack_.bind(); depthTexReadBack_.bind();
glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, x, y, width , height, 0); glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, x, y, width , height, 0);
depthTexReadBack_.disable();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment