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
This commit is contained in:
parent
be8929da87
commit
978ee32a96
@ -185,12 +185,12 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
filterCam.resize(buff.getWidth(), buff.getHeight(), true);
|
filterCam.resize(buff.getWidth(), buff.getHeight(), true);
|
||||||
fsQuad.setPosition(0, 0);
|
fsQuad.setPosition(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mat.getAdditionalRenderState().isDepthWrite()) {
|
if (mat.getAdditionalRenderState().isDepthWrite()) {
|
||||||
mat.getAdditionalRenderState().setDepthTest(false);
|
mat.getAdditionalRenderState().setDepthTest(false);
|
||||||
mat.getAdditionalRenderState().setDepthWrite(false);
|
mat.getAdditionalRenderState().setDepthWrite(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fsQuad.setMaterial(mat);
|
fsQuad.setMaterial(mat);
|
||||||
fsQuad.updateGeometricState();
|
fsQuad.updateGeometricState();
|
||||||
|
|
||||||
@ -198,10 +198,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
|
|||||||
r.setFrameBuffer(buff);
|
r.setFrameBuffer(buff);
|
||||||
r.clearBuffers(false, true, true);
|
r.clearBuffers(false, true, true);
|
||||||
renderManager.renderGeometry(fsQuad);
|
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() {
|
public boolean isInitialized() {
|
||||||
|
@ -456,6 +456,15 @@ public class LwjglRenderer implements Renderer {
|
|||||||
bits = GL_COLOR_BUFFER_BIT;
|
bits = GL_COLOR_BUFFER_BIT;
|
||||||
}
|
}
|
||||||
if (depth) {
|
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;
|
bits |= GL_DEPTH_BUFFER_BIT;
|
||||||
}
|
}
|
||||||
if (stencil) {
|
if (stencil) {
|
||||||
@ -548,7 +557,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
context.polyOffsetUnits = 0;
|
context.polyOffsetUnits = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.getFaceCullMode() != context.cullMode) {
|
if (state.getFaceCullMode() != context.cullMode) {
|
||||||
if (state.getFaceCullMode() == RenderState.FaceCullMode.Off) {
|
if (state.getFaceCullMode() == RenderState.FaceCullMode.Off) {
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
@ -700,7 +709,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
throw new UnsupportedOperationException("Unrecognized test function: " + testFunc);
|
throw new UnsupportedOperationException("Unrecognized test function: " + testFunc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************\
|
/*********************************************************************\
|
||||||
|* Camera and World transforms *|
|
|* Camera and World transforms *|
|
||||||
\*********************************************************************/
|
\*********************************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user