Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5305 in orxonox.OLD for trunk/src/lib/graphics/importer


Ignore:
Timestamp:
Oct 7, 2005, 3:34:01 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better implementation of the Texture-loading

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/texture.cc

    r5304 r5305  
    3636  this->bAlpha = false;
    3737  this->texture = 0;
    38   if (imageName)
     38  if (imageName != NULL)
    3939    this->loadImage(imageName);
    4040}
     
    146146  if (GraphicsEngine::texturesEnabled)
    147147    {
    148       if (imageName)
     148      if (imageName != NULL)
    149149        {
    150150          SDL_Surface* tmpSurf;
     
    153153          // load the new Image to memory
    154154          tmpSurf = IMG_Load(imageName);
    155           if(!tmpSurf)
     155          if(tmpSurf == NULL)
    156156            {
    157157              PRINTF(1)("IMG_Load: %s\n", IMG_GetError());
     158              this->texture = 0;
    158159              return false;
    159160            }
    160 
    161           GLubyte* pixels = (GLubyte*)tmpSurf->pixels;
    162 
    163           PRINTF(3)("loading Image %s\n", imageName);
    164           if (tmpSurf)
     161          else
     162          {
     163            PRINTF(3)("loading Image %s\n", imageName);
    165164            loadTexToGL(tmpSurf);
    166 
    167 
    168           SDL_FreeSurface(tmpSurf);
    169           return true;
     165            SDL_FreeSurface(tmpSurf);
     166            return true;
     167          }
    170168        }
    171169      else
    172170        {
    173           PRINTF(2)("Image not Found: %s\n", imageName);
    174171          return false;
    175172        }
    176173    }
     174    return false;
    177175}
Note: See TracChangeset for help on using the changeset viewer.