]> git.mxchange.org Git - flightgear.git/blobdiff - src/Objects/matlib.cxx
I'm attaching diffs to add a new FGInput module to FlightGear
[flightgear.git] / src / Objects / matlib.cxx
index 25535f8f42eceee120417ef538612917065df1d0..ac2be6b947324c9dc2168562000846a405ad965d 100644 (file)
@@ -34,7 +34,7 @@
 #endif
 
 #include <GL/glut.h>
-#include <simgear/xgl/xgl.h>
+#include <GL/gl.h>
 
 #include <simgear/compiler.h>
 
@@ -129,10 +129,8 @@ bool FGMaterialLib::load( const string& mpath ) {
                in >> m;
 
                // build the ssgSimpleState
-               SGPath tmp_path( globals->get_fg_root() );
-               tmp_path.append( "Textures.high" );
-
-               SGPath tex_path = tmp_path;
+               SGPath tex_path( globals->get_fg_root() );
+               tex_path.append( "Textures.high" );
                tex_path.append( m.get_texture_name() );
                if ( ! local_file_exists(tex_path.str())
                     || general.get_glMaxTexSize() < 512 ) {
@@ -280,11 +278,23 @@ void FGMaterialLib::set_step ( int step )
 }
 
 
-
-
-
-
-
-
-
-
+// Load one pending "deferred" texture.  Return true if a texture
+// loaded successfully, false if no pending, or error.
+void FGMaterialLib::load_next_deferred() {
+    // container::iterator it = begin();
+    for ( material_map_iterator it = begin(); it != end(); it++ ) {
+       const string &key = it->first;
+       FGNewMat &slot = it->second;
+       if ( ! slot.get_texture_loaded() ) {
+            SG_LOG( SG_GENERAL, SG_INFO, "Loading texture for " << key );
+#ifdef PLIB_1_2_X
+            slot.get_textured()->
+                setTexture( (char *)slot.get_texture_name_c_str(), 0, 0 );
+#else
+            slot.get_textured()->
+                setTexture( (char *)slot.get_texture_name_c_str(), 0, 0, 1 );
+#endif
+            slot.set_texture_loaded( true );
+        }
+    }
+}