]> git.mxchange.org Git - flightgear.git/commitdiff
Enable back face culling for cockpit instruments, disable depth buffer writes for...
authorehofman <ehofman>
Tue, 16 Sep 2003 10:02:32 +0000 (10:02 +0000)
committerehofman <ehofman>
Tue, 16 Sep 2003 10:02:32 +0000 (10:02 +0000)
src/Cockpit/built_in/FGMagRibbon.cxx
src/Cockpit/panel.cxx

index fe8d971d77022e68b40f926b63955b7c465677a2..76e9483dd395f2abfa230a60a6f161044b1e67e2 100644 (file)
@@ -67,7 +67,11 @@ FGMagRibbon::draw ()
 
   FGCroppedTexture &t = getTexture();
   t.setCrop(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
+
+  glPushAttrib(GL_DEPTH_BUFFER_BIT);
+  glDepthMask(GL_TRUE);
   FGTexturedLayer::draw();
+  glPopAttrib();
 }
 
 // end of FGMagRibbon.cxx
index 4483dfa2a4a189998a273d37074be47321ed3af7..0ec6523db3bca1a8e810fd73c6cb8d3a5aba149f 100644 (file)
@@ -346,9 +346,7 @@ FGPanel::update (GLfloat winx, GLfloat winw, GLfloat winy, GLfloat winh)
   
   glTranslated(x_offset, y_offset, 0);
   
-  glDepthMask(GL_FALSE);
   draw();
-  glDepthMask(GL_TRUE);
 
   glMatrixMode(GL_PROJECTION);
   glPopMatrix();
@@ -370,7 +368,8 @@ FGPanel::draw()
 
   // save some state
   glPushAttrib( GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT
-                | GL_TEXTURE_BIT | GL_PIXEL_MODE_BIT );
+                | GL_TEXTURE_BIT | GL_PIXEL_MODE_BIT | GL_CULL_FACE 
+                | GL_DEPTH_BUFFER_BIT );
 
   // Draw the background
   glEnable(GL_TEXTURE_2D);
@@ -378,6 +377,8 @@ FGPanel::draw()
   glEnable(GL_BLEND);
   glEnable(GL_ALPHA_TEST);
   glEnable(GL_COLOR_MATERIAL);
+  glEnable(GL_CULL_FACE);
+  glCullFace(GL_BACK);
   sgVec4 panel_color;
   sgCopyVec4( panel_color, cur_light_params.scene_diffuse );
   if ( fgGetDouble("/systems/electrical/outputs/instrument-lights") > 1.0 ) {
@@ -424,6 +425,10 @@ FGPanel::draw()
   instrument_list_type::const_iterator current = _instruments.begin();
   instrument_list_type::const_iterator end = _instruments.end();
 
+  // Don't let the instruments be visible trhought the roof of the c310-3d
+  // This does hurt the magnetic compass in the default c172-3d,
+  //  but we need a real 3d compass anyway.
+  glDepthMask(GL_FALSE);
   for ( ; current != end; current++) {
     FGPanelInstrument * instr = *current;
     glPushMatrix();