From b3e63e9732f61f4caf93a1b14afa71f905c421d9 Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sat, 10 Nov 2012 20:30:56 +0000 Subject: [PATCH] * Depth writes now completely disabled for all nifty elements - should fix various glitches when nifty is rendered with jME3 gui or 3D objects git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9981 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/niftygui/com/jme3/niftygui/RenderDeviceJme.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java b/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java index 342c51b1f..06f785dcd 100644 --- a/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java +++ b/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java @@ -77,6 +77,13 @@ public class RenderDeviceJme implements RenderDevice { private Matrix4f tempMat = new Matrix4f(); private ColorRGBA tempColor = new ColorRGBA(); + private static final RenderState noZWriteState = new RenderState(); + + static { + noZWriteState.setDepthTest(false); + noZWriteState.setDepthWrite(false); + } + private static class CachedTextKey { BitmapFont font; @@ -156,6 +163,7 @@ public class RenderDeviceJme implements RenderDevice { } public void beginFrame() { + rm.setForcedRenderState(noZWriteState); } public void endFrame() { @@ -163,6 +171,7 @@ public class RenderDeviceJme implements RenderDevice { textCacheLastFrame = textCacheCurrentFrame; textCacheCurrentFrame = temp; textCacheCurrentFrame.clear(); + rm.setForcedRenderState(null); } public int getWidth() {