]> git.mxchange.org Git - flightgear.git/commitdiff
Modified Files:
authorfrohlich <frohlich>
Sat, 6 Jan 2007 13:51:47 +0000 (13:51 +0000)
committerfrohlich <frohlich>
Sat, 6 Jan 2007 13:51:47 +0000 (13:51 +0000)
src/Cockpit/panel.cxx src/Main/renderer.cxx: Make sure we run on
texture unit 0 in plain opengl code.

src/Cockpit/panel.cxx
src/Main/renderer.cxx

index 68151bcb7046598a8f448519fb4917c5ef5d4776..7274e5570ccbf2949643c1c23e3a13c1afa15480 100644 (file)
@@ -378,6 +378,8 @@ FGPanel::draw(osg::State& state)
     panelStateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
   state.pushStateSet(panelStateSet.get());
   state.apply();
+  state.setActiveTextureUnit(0);
+  state.setClientActiveTextureUnit(0);
 
   FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
   sgCopyVec4( panel_color, l->scene_diffuse().data());
@@ -390,6 +392,9 @@ FGPanel::draw(osg::State& state)
   if (_bg != 0) {
     state.pushStateSet(_bg.get());
     state.apply();
+    state.setActiveTextureUnit(0);
+    state.setClientActiveTextureUnit(0);
+
     glBegin(GL_POLYGON);
     glTexCoord2f(0.0, 0.0); glVertex2f(WIN_X, WIN_Y);
     glTexCoord2f(1.0, 0.0); glVertex2f(WIN_X + _width, WIN_Y);
@@ -398,11 +403,17 @@ FGPanel::draw(osg::State& state)
     glEnd();
     state.popStateSet();
     state.apply();
+    state.setActiveTextureUnit(0);
+    state.setClientActiveTextureUnit(0);
+
   } else {
     for (int i = 0; i < 4; i ++) {
       // top row of textures...(1,3,5,7)
       state.pushStateSet(_mbg[i*2].get());
       state.apply();
+      state.setActiveTextureUnit(0);
+      state.setClientActiveTextureUnit(0);
+
       glBegin(GL_POLYGON);
       glTexCoord2f(0.0, 0.0); glVertex2f(WIN_X + (_width/4) * i, WIN_Y + (_height/2));
       glTexCoord2f(1.0, 0.0); glVertex2f(WIN_X + (_width/4) * (i+1), WIN_Y + (_height/2));
@@ -411,9 +422,15 @@ FGPanel::draw(osg::State& state)
       glEnd();
       state.popStateSet();
       state.apply();
+      state.setActiveTextureUnit(0);
+      state.setClientActiveTextureUnit(0);
+
       // bottom row of textures...(2,4,6,8)
       state.pushStateSet(_mbg[i*2+1].get());
       state.apply();
+      state.setActiveTextureUnit(0);
+      state.setClientActiveTextureUnit(0);
+
       glBegin(GL_POLYGON);
       glTexCoord2f(0.0, 0.0); glVertex2f(WIN_X + (_width/4) * i, WIN_Y);
       glTexCoord2f(1.0, 0.0); glVertex2f(WIN_X + (_width/4) * (i+1), WIN_Y);
@@ -422,6 +439,9 @@ FGPanel::draw(osg::State& state)
       glEnd();
       state.popStateSet();
       state.apply();
+      state.setActiveTextureUnit(0);
+      state.setClientActiveTextureUnit(0);
+
     }
   }
 
@@ -467,6 +487,9 @@ FGPanel::draw(osg::State& state)
 
   state.popStateSet();
   state.apply();
+  state.setActiveTextureUnit(0);
+  state.setClientActiveTextureUnit(0);
+
 
   // Draw yellow "hotspots" if directed to.  This is a panel authoring
   // feature; not intended to be high performance or to look good.
@@ -480,6 +503,9 @@ FGPanel::draw(osg::State& state)
 
     state.pushStateSet(hotspotStateSet.get());
     state.apply();
+    state.setActiveTextureUnit(0);
+    state.setClientActiveTextureUnit(0);
+
 
     glPushAttrib(GL_ENABLE_BIT);
     glDisable(GL_COLOR_MATERIAL);
@@ -492,6 +518,9 @@ FGPanel::draw(osg::State& state)
 
     state.popStateSet();
     state.apply();
+    state.setActiveTextureUnit(0);
+    state.setClientActiveTextureUnit(0);
+
   }
 }
 
@@ -1019,6 +1048,9 @@ FGTexturedLayer::draw (osg::State& state)
     transform();
     state.pushStateSet(_texture.getTexture());
     state.apply();
+    state.setActiveTextureUnit(0);
+    state.setClientActiveTextureUnit(0);
+
     glBegin(GL_POLYGON);
 
     if (_emissive) {
@@ -1036,6 +1068,9 @@ FGTexturedLayer::draw (osg::State& state)
     glEnd();
     state.popStateSet();
     state.apply();
+    state.setActiveTextureUnit(0);
+    state.setClientActiveTextureUnit(0);
+
   }
 }
 
index a6aa86f8a0dd00814741bdcef0599d187d425c08..97ff85c7edda45408ff5ee46add35afbf2a011f2 100644 (file)
@@ -124,7 +124,8 @@ public:
   {
     state.pushStateSet(getStateSet());
     state.apply();
-
+    state.setActiveTextureUnit(0);
+    state.setClientActiveTextureUnit(0);
 
     if((fgGetBool("/sim/atc/enabled"))
        || (fgGetBool("/sim/ai-traffic/enabled")))
@@ -176,6 +177,8 @@ public:
   {
     state.pushStateSet(getStateSet());
     state.apply();
+    state.setActiveTextureUnit(0);
+    state.setClientActiveTextureUnit(0);
 
     glPushAttrib(GL_ALL_ATTRIB_BITS);
     glPushClientAttrib(~0u);
@@ -531,6 +534,10 @@ FGRenderer::update( bool refresh_camera_settings ) {
                           || fgGetBool("sim/sceneryloaded-override");
 
     if ( idle_state < 1000 || !scenery_loaded ) {
+        if (sceneView.valid() && sceneView->getState()) {
+            sceneView->getState()->setActiveTextureUnit(0);
+            sceneView->getState()->setClientActiveTextureUnit(0);
+        }
         // still initializing, draw the splash screen
         glPushAttrib(GL_ALL_ATTRIB_BITS);
         glPushClientAttrib(~0u);