Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3107 in orxonox.OLD for orxonox/branches/images/importer


Ignore:
Timestamp:
Dec 5, 2004, 6:52:02 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/images: now the Image will have the right Colors (at loeast bmp, tga, png and jpg)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/images/importer/material.cc

    r3103 r3107  
    1414
    1515   TGA-code: borrowed from nehe-Tutorials
     16
     17   ToDo: free SDL-surface when deleting Material.
    1618*/
    1719
     
    390392  pImage->data   = (GLubyte*)map->pixels;
    391393
     394  SDL_RWops *imgType;
     395  imgType=SDL_RWFromFile(imageName, "rb");
     396  if( !IMG_isPNG(SDL_RWFromFile(imageName, "rb")) && !IMG_isJPG(SDL_RWFromFile(imageName, "rb")))
     397    for (int i=0;i<map->h * map->w *3;i+=3)
     398      {
     399        GLuint temp = pImage->data[i];
     400        pImage->data[i] = pImage->data[i+2];
     401        pImage->data[i+2] = temp;
     402      }
    392403  loadTexToGL (pImage, texture);
    393  
     404
    394405}
    395406#else
Note: See TracChangeset for help on using the changeset viewer.