Keep better track of the independent alpha test related

state...
This fixes a bug where if alpha test was enabled with
a fall off of 0 that it could never again be disabled
unless alpha falloff was first set to a non-0 value.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10938 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
PSp..om 11 years ago
parent 4fc8cb8443
commit faf04cbb1f
  1. 16
      engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java

@ -494,16 +494,20 @@ public class LwjglRenderer implements Renderer {
context.depthFunc = state.getDepthFunc();
}
if (state.isAlphaTest() && context.alphaTestFallOff == 0) {
if (state.isAlphaTest() && !context.alphaTestEnabled) {
glEnable(GL_ALPHA_TEST);
glAlphaFunc(convertTestFunction(context.alphaFunc), state.getAlphaFallOff());
context.alphaTestFallOff = state.getAlphaFallOff();
} else if (!state.isAlphaTest() && context.alphaTestFallOff != 0) {
glAlphaFunc(convertTestFunction(context.alphaFunc), context.alphaTestFallOff);
context.alphaTestEnabled = true;
} else if (!state.isAlphaTest() && context.alphaTestEnabled) {
glDisable(GL_ALPHA_TEST);
context.alphaTestFallOff = 0;
context.alphaTestEnabled = false;
}
if (state.getAlphaFallOff() != context.alphaTestFallOff) {
glAlphaFunc(convertTestFunction(context.alphaFunc), context.alphaTestFallOff);
context.alphaTestFallOff = state.getAlphaFallOff();
}
if (state.getAlphaFunc() != context.alphaFunc) {
glAlphaFunc(convertTestFunction(state.getAlphaFunc()), state.getAlphaFallOff());
glAlphaFunc(convertTestFunction(state.getAlphaFunc()), context.alphaTestFallOff);
context.alphaFunc = state.getAlphaFunc();
}

Loading…
Cancel
Save