From 656a3ace07484ac12a02528a790a03dcb1a6617e Mon Sep 17 00:00:00 2001
From: frohlich <frohlich>
Date: Sun, 3 Dec 2006 17:27:46 +0000
Subject: [PATCH] Modified Files: 	simgear/scene/material/mat.cxx: Put
 solid scenery into the 	opaque render bin

---
 simgear/scene/material/mat.cxx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx
index e73ba37c..cf5266d8 100644
--- a/simgear/scene/material/mat.cxx
+++ b/simgear/scene/material/mat.cxx
@@ -268,11 +268,12 @@ SGMaterial::build_state( bool defer_tex_load )
         // Set up the textured state
         osg::ShadeModel* shadeModel = new osg::ShadeModel;
         shadeModel->setMode(osg::ShadeModel::SMOOTH);
-        stateSet->setAttributeAndModes(shadeModel, osg::StateAttribute::ON);
+        stateSet->setAttribute(shadeModel);
 
         osg::CullFace* cullFace = new osg::CullFace;
         cullFace->setMode(osg::CullFace::BACK);
-        stateSet->setAttributeAndModes(cullFace, osg::StateAttribute::ON);
+        stateSet->setMode(GL_CULL_FACE, osg::StateAttribute::ON);
+        stateSet->setAttribute(cullFace);
 
         stateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON);
 
@@ -295,9 +296,11 @@ SGMaterial::build_state( bool defer_tex_load )
 
         if (ambient[3] < 1 || diffuse[3] < 1 ||
             specular[3] < 1 || emission[3] < 1) {
+          stateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
           stateSet->setMode(GL_BLEND, osg::StateAttribute::ON);
           stateSet->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
         } else {
+          stateSet->setRenderingHint(osg::StateSet::OPAQUE_BIN);
           stateSet->setMode(GL_BLEND, osg::StateAttribute::OFF);
           stateSet->setMode(GL_ALPHA_TEST, osg::StateAttribute::OFF);
         }
-- 
2.39.5