]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/built_in/FGMagRibbon.cxx
Merge branch 'jmt/gps'
[flightgear.git] / src / Cockpit / built_in / FGMagRibbon.cxx
index 76e9483dd395f2abfa230a60a6f161044b1e67e2..a05db18ae50db9f671a41d3ea44f2fe08117cb74 100644 (file)
 //  WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 //  General Public License for more details.
-// 
+//
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 //  $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
 
 #include "FGMagRibbon.hxx"
 
@@ -33,7 +36,7 @@ FGMagRibbon::FGMagRibbon (int w, int h)
 }
 
 void
-FGMagRibbon::draw ()
+FGMagRibbon::draw (osg::State& state)
 {
   double heading = _magcompass_node->getDoubleValue();
   double xoffset, yoffset;
@@ -65,13 +68,19 @@ FGMagRibbon::draw ()
                                // Adjust to put the number in the centre
   xoffset -= 0.25;
 
-  FGCroppedTexture &t = getTexture();
-  t.setCrop(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
+  FGCroppedTexture *t = getTexture();
+  t->setCrop(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
+
+  static osg::ref_ptr<osg::StateSet> stateSet = new osg::StateSet;
+  stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
+
+  state.pushStateSet(stateSet.get());
+  state.apply();
+
+  FGTexturedLayer::draw(state);
 
-  glPushAttrib(GL_DEPTH_BUFFER_BIT);
-  glDepthMask(GL_TRUE);
-  FGTexturedLayer::draw();
-  glPopAttrib();
+  state.popStateSet();
+  state.apply();
 }
 
 // end of FGMagRibbon.cxx