]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/built_in/FGMagRibbon.cxx
Yank out all the glut dependencies and concentrate them in a (easily
[flightgear.git] / src / Cockpit / built_in / FGMagRibbon.cxx
index f76d1126f758643f10dcc816696361116d6c3b51..30c35d49aeec801f4faac5139aa38d41fece4c24 100644 (file)
@@ -20,7 +20,6 @@
 
 
 #include "FGMagRibbon.hxx"
-#include "../steam.hxx"
 
 
 FGMagRibbon::FGMagRibbon (int w, int h)
@@ -28,12 +27,15 @@ FGMagRibbon::FGMagRibbon (int w, int h)
 {
   FGCroppedTexture texture("Aircraft/Instruments/Textures/compass-ribbon.rgb");
   setTexture(texture);
+  _magcompass_node =
+      fgGetNode("/instrumentation/magnetic-compass/indicated-heading-deg",
+                true);
 }
 
 void
 FGMagRibbon::draw ()
 {
-  double heading = globals->get_steam()->get_MH_deg();
+  double heading = _magcompass_node->getDoubleValue();
   double xoffset, yoffset;
 
   while (heading >= 360.0) {
@@ -65,7 +67,11 @@ FGMagRibbon::draw ()
 
   FGCroppedTexture &t = getTexture();
   t.setCrop(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
+
+  glPushAttrib(GL_DEPTH_BUFFER_BIT);
+  glEnable(GL_DEPTH_TEST);
   FGTexturedLayer::draw();
+  glPopAttrib();
 }
 
 // end of FGMagRibbon.cxx