WateFilter depth write fix (yeah 'fix' Kirill). Issue was glClear(GL_DEPTH_BUFFER_BIT) seems to not work when glDepthMask is false

see http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=257223
Also there might be the same issue when copying frame buffers 

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7628 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent be8929da87
commit 978ee32a96
  1. 9
      engine/src/core/com/jme3/post/FilterPostProcessor.java
  2. 13
      engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglRenderer.java

@ -185,12 +185,12 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
filterCam.resize(buff.getWidth(), buff.getHeight(), true);
fsQuad.setPosition(0, 0);
}
if (mat.getAdditionalRenderState().isDepthWrite()) {
mat.getAdditionalRenderState().setDepthTest(false);
mat.getAdditionalRenderState().setDepthWrite(false);
}
fsQuad.setMaterial(mat);
fsQuad.updateGeometricState();
@ -198,10 +198,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
r.setFrameBuffer(buff);
r.clearBuffers(false, true, true);
renderManager.renderGeometry(fsQuad);
//re applying default render state at the end of the render
// to avoid depth write issues, MUST BE A BETTER WAY
r.applyRenderState(RenderState.DEFAULT);
}
public boolean isInitialized() {

@ -456,6 +456,15 @@ public class LwjglRenderer implements Renderer {
bits = GL_COLOR_BUFFER_BIT;
}
if (depth) {
//glClear(GL_DEPTH_BUFFER_BIT) seems to not work when glDepthMask is false
//here s some link on openl board
//http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=257223
//if depth clear is requested, we enable the depthMask
if (context.depthWriteEnabled == false) {
glDepthMask(true);
context.depthWriteEnabled = true;
}
bits |= GL_DEPTH_BUFFER_BIT;
}
if (stencil) {
@ -548,7 +557,7 @@ public class LwjglRenderer implements Renderer {
context.polyOffsetUnits = 0;
}
}
if (state.getFaceCullMode() != context.cullMode) {
if (state.getFaceCullMode() == RenderState.FaceCullMode.Off) {
glDisable(GL_CULL_FACE);
@ -700,7 +709,7 @@ public class LwjglRenderer implements Renderer {
throw new UnsupportedOperationException("Unrecognized test function: " + testFunc);
}
}
/*********************************************************************\
|* Camera and World transforms *|
\*********************************************************************/

Loading…
Cancel
Save