Commit 33c9b87c authored by Christopher Tenter's avatar Christopher Tenter
Browse files

ToonRenderer: copy scene depth texture to depth buffer for further post-processing

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18215 383ad7c9-94d9-4d36-a494-682f7c89f535
parent aad6c736
......@@ -55,7 +55,7 @@ void main()
// fragD.x *= fragD.x;
// oColor = -fragD.xxxx;
// write depth in case any future post-processors require scene depth information
gl_FragDepth = texture2D(samplerDepth, vTexCoord).x;
}
......@@ -193,7 +193,7 @@ void ToonRenderer::render(ACG::GLState* _glState, Viewer::ViewerProperties& _pro
// clear depth texture
glDrawBuffer(GL_COLOR_ATTACHMENT1);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// clear scene color
......@@ -245,7 +245,13 @@ void ToonRenderer::render(ACG::GLState* _glState, Viewer::ViewerProperties& _pro
// enable color/depth write access
glDepthMask(1);
glColorMask(1,1,1,1);
glDisable(GL_DEPTH_TEST);
// note: using glDisable(GL_DEPTH_TEST) not only disables depth testing,
// but actually discards any write operations to the depth buffer.
// However, we can provide scene depth for further post-processing.
// -> Enable depth testing with func=always
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS);
glDisable(GL_BLEND);
// setup composition shader
......@@ -265,6 +271,9 @@ void ToonRenderer::render(ACG::GLState* _glState, Viewer::ViewerProperties& _pro
ACG::ScreenQuad::draw(progOutline_);
progOutline_->disable();
// reset depth func to opengl default
glDepthFunc(GL_LESS);
ACG::glCheckErrors();
......
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