From f80364a8c2979f810e9d03e65ba0ae942a69e52e Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Thu, 10 Sep 2015 22:34:12 -0400 Subject: [PATCH] GLRenderer: don't set depth function twice --- .../src/main/java/com/jme3/renderer/RenderContext.java | 6 +++--- .../src/main/java/com/jme3/renderer/opengl/GLRenderer.java | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/renderer/RenderContext.java b/jme3-core/src/main/java/com/jme3/renderer/RenderContext.java index 4b51e0727..8287a270e 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/RenderContext.java +++ b/jme3-core/src/main/java/com/jme3/renderer/RenderContext.java @@ -241,12 +241,12 @@ public class RenderContext { public IDList attribIndexList = new IDList(); /** - * depth tets function + * depth test function */ - public RenderState.TestFunction depthFunc = RenderState.TestFunction.LessOrEqual; + public RenderState.TestFunction depthFunc = RenderState.TestFunction.Less; /** - * alpha tets function + * alpha test function */ public RenderState.TestFunction alphaFunc = RenderState.TestFunction.Greater; diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java index de11d7898..2d8287817 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java @@ -614,17 +614,16 @@ public class GLRenderer implements Renderer { if (state.isDepthTest() && !context.depthTestEnabled) { gl.glEnable(GL.GL_DEPTH_TEST); - gl.glDepthFunc(convertTestFunction(context.depthFunc)); context.depthTestEnabled = true; } else if (!state.isDepthTest() && context.depthTestEnabled) { gl.glDisable(GL.GL_DEPTH_TEST); context.depthTestEnabled = false; } - if (state.getDepthFunc() != context.depthFunc) { + if (state.isDepthTest() && state.getDepthFunc() != context.depthFunc) { gl.glDepthFunc(convertTestFunction(state.getDepthFunc())); context.depthFunc = state.getDepthFunc(); } - + if (state.isDepthWrite() && !context.depthWriteEnabled) { gl.glDepthMask(true); context.depthWriteEnabled = true;