]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed a problem with texture loading and mipmap building where the lower
authorcurt <curt>
Thu, 13 May 1999 19:01:29 +0000 (19:01 +0000)
committercurt <curt>
Thu, 13 May 1999 19:01:29 +0000 (19:01 +0000)
  mipmap levels were coming out hosed.
Adding a call to xglPixelStorei(GL_UNPACK_ALIGNMENT, 4); restores it to the
  default setting which was getting set to something else in other parts of
  the code.

Simulator/Objects/material.cxx
Simulator/Objects/obj.cxx

index 0f1a2e0a8dc2d7f81d57e071ea13814701584940..98ae6286422557fc6d8ac525b406736b80dcd824 100644 (file)
@@ -127,12 +127,10 @@ FGMaterial::load_texture( const string& root )
 #endif
 
     // set the texture parameters for this texture
+    xglPixelStorei(GL_UNPACK_ALIGNMENT, 4);
     xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ) ;
     xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ) ;
-    xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 
-                     GL_LINEAR );
-    // xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
-    //                   GL_NEAREST_MIPMAP_NEAREST );
+    xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
     xglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, 
                      /* GL_LINEAR */ 
                      /* GL_NEAREST_MIPMAP_LINEAR */
@@ -203,18 +201,17 @@ FGMaterial::load_texture( const string& root )
                   read_r8_texture(fg_oav_tpath.c_str(), &width, &height)) 
                  != NULL )
            ;
-       else
-           {
-               FG_LOG( FG_GENERAL, FG_ALERT, 
-                       "Error in loading texture " << tpath.str() );
-               exit(-1);
-           } 
-
-       /* xglTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0,
-          GL_RGB, GL_UNSIGNED_BYTE, texbuf); */
+       else {
+           FG_LOG( FG_GENERAL, FG_ALERT, 
+                   "Error in loading texture " << tpath.str() );
+           exit(-1);
+       } 
 
-       gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGB, width, height, 
-                          GL_RGB, GL_UNSIGNED_BYTE, texbuf );
+       if ( gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGB, width, height, 
+                               GL_RGB, GL_UNSIGNED_BYTE, texbuf ) != 0 )
+           FG_LOG( FG_GENERAL, FG_ALERT, "Error building mipmaps");
+           exit(-1);
+       }
     } else if ( alpha == 1 ) {
        // load rgba (alpha) texture
 
index cb9e379f735b1e14c83a6e2573b0c930c240fee0..6ac92a53db680b39350b90fd67578d4f9ea67c95 100644 (file)
@@ -249,7 +249,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
                FGMaterial m = fragment.material_ptr->get_m();
                tex_width = m.get_xsize();
                tex_height = m.get_ysize();
-               cout << "(w) = " << tex_width << " (h) = " << tex_width << endl;
+               // cout << "(w) = " << tex_width << " (h) = " 
+               //      << tex_width << endl;
+
                // initialize the fragment transformation matrix
                /*
                 for ( i = 0; i < 16; i++ ) {