diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 26b5026eacd6770589dc1ea071bbac331c546aec..3f24a477af0448f27d9bc829b73b621b03f4b8b0 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -6643,15 +6643,21 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 		{
 			gGL.flush();
 			gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE);
-			LLGLEnable fog(GL_FOG);
-			glFogi(GL_FOG_MODE, GL_LINEAR);
-			float d = (viewerCamera.getPointOfInterest()-viewerCamera.getOrigin()).magVec();
-			LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal()-gAgentCamera.getCameraPositionGlobal()).magVec()/(LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec()*4), 0.0, 1.0);
-			glFogf(GL_FOG_START, d);
-			glFogf(GL_FOG_END, d*(1 + (viewerCamera.getView() / viewerCamera.getDefaultFOV())));
-			glFogfv(GL_FOG_COLOR, fogCol.mV);
-
-			LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
+            if (!LLGLSLShader::sNoFixedFunction)
+            {
+                LLGLEnable fog(GL_FOG);
+                glFogi(GL_FOG_MODE, GL_LINEAR);
+                float d = (viewerCamera.getPointOfInterest() - viewerCamera.getOrigin()).magVec();
+                LLColor4 fogCol = color * (F32) llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal() -
+                                   gAgentCamera.getCameraPositionGlobal()).magVec() /
+                                      (LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec() * 4),
+                                  0.0, 1.0);
+                glFogf(GL_FOG_START, d);
+                glFogf(GL_FOG_END, d * (1 + (viewerCamera.getView() / viewerCamera.getDefaultFOV())));
+                glFogfv(GL_FOG_COLOR, fogCol.mV);
+            }
+
+            LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
 			gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
 			gGL.begin(LLRender::LINES);
 			{