]> git.mxchange.org Git - flightgear.git/commitdiff
Add an option to FGTextureManager to create dynamic textures.
authortimoore <timoore>
Fri, 7 Dec 2007 09:14:16 +0000 (09:14 +0000)
committertimoore <timoore>
Fri, 7 Dec 2007 09:14:16 +0000 (09:14 +0000)
Dynamic textures shouldn't have their STATIC attribute set.

src/Cockpit/panel.cxx
src/Cockpit/panel.hxx
src/Instrumentation/wxradar.cxx

index 86b82903e9f7128fc8ae40d4f0851af2acfe1543..5be11a20e142f61c2b05c2f34324b2c0db84fb72 100644 (file)
@@ -118,7 +118,7 @@ fgPanelVisible ()
 map<string,osg::ref_ptr<osg::Texture2D> > FGTextureManager::_textureMap;
 
 osg::Texture2D*
-FGTextureManager::createTexture (const string &relativePath)
+FGTextureManager::createTexture (const string &relativePath, bool staticTexture)
 {
   osg::Texture2D* texture = _textureMap[relativePath].get();
   if (texture == 0) {
@@ -127,7 +127,7 @@ FGTextureManager::createTexture (const string &relativePath)
     SGPath tpath(globals->get_fg_root());
     tpath.append(relativePath);
 
-    texture = SGLoadTexture2D(tpath);
+    texture = SGLoadTexture2D(staticTexture, tpath);
 
     _textureMap[relativePath] = texture;
     if (!_textureMap[relativePath].valid()) 
index af113c977649df4794d9dbe569e3dc1071be800c..a8241b9d43717e465793b1dc78fbbbaa3b5e84f8 100644 (file)
@@ -75,7 +75,8 @@ class FGPanelInstrument;
 class FGTextureManager
 {
 public:
-  static osg::Texture2D* createTexture(const string &relativePath);
+  static osg::Texture2D* createTexture(const string &relativePath,
+                                       bool staticTexture = true);
   static void addTexture(const string &relativePath, osg::Texture2D* texture);
 private:
   static map<string,osg::ref_ptr<osg::Texture2D> > _textureMap;
index b83278cb3acac8268cdc1661a866393bbcaf9ce2..fa71560b98b331be8d9391367238a69adc2e730f 100644 (file)
@@ -112,7 +112,8 @@ wxRadarBg::init ()
     // texture name to use in 2D and 3D instruments
     _texture_path = _Instrument->getStringValue("radar-texture-path",
             "Aircraft/Instruments/Textures/od_wxradar.rgb");
-    _resultTexture = FGTextureManager::createTexture(_texture_path.c_str());
+    _resultTexture = FGTextureManager::createTexture(_texture_path.c_str(),
+                                                     false);
 
     SGPath tpath(globals->get_fg_root());
     string path = _Instrument->getStringValue("echo-texture-path",
@@ -120,7 +121,7 @@ wxRadarBg::init ()
     tpath.append(path);
 
     // no mipmap or else alpha will mix with pixels on the border of shapes, ruining the effect
-    _wxEcho = SGLoadTexture2D(tpath.c_str(), false, false);
+    _wxEcho = SGLoadTexture2D(tpath, false, false);
 
 
     _Instrument->setFloatValue("trk", 0.0);