From 6d1ba5b06d3c11cb14a0c62e50f88f34ca893a5d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 13 Sep 2011 09:21:07 +0000 Subject: [PATCH] From Farshild Lashkari, "Attached is a simple patch that avoids the depth write pass in Text::renderWithDelayedDepthWrites if the current osg::State object has GL_DEPTH_TEST disabled." --- src/osgText/Text.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index fdd31f8ab..514cb271e 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -1601,6 +1601,12 @@ void Text::renderOnlyForegroundText(osg::State& state, const osg::Vec4& colorMul void Text::renderWithDelayedDepthWrites(osg::State& state, const osg::Vec4& colorMultiplier) const { + // If depth testing is disabled, then just render text as normal + if( !state.getLastAppliedMode(GL_DEPTH_TEST) ) { + drawTextWithBackdrop(state,colorMultiplier); + return; + } + //glPushAttrib( _enableDepthWrites ? (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) : GL_DEPTH_BUFFER_BIT); // Render to color buffer without writing to depth buffer. glDepthMask(GL_FALSE);