Changeset 3343 in orxonox.OLD for orxonox/branches/parenting/src/importer/texture.cc
- Timestamp:
- Jan 5, 2005, 3:39:08 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/importer/texture.cc
r3341 r3343 146 146 return NULL; 147 147 } 148 149 inline void Texture::swap (unsigned char &a, unsigned char &b) 150 { 151 unsigned char temp; 152 temp = a; 153 a = b; 154 b = temp; 155 } 156 148 157 149 158 /** … … 186 195 pImage->width = map->w; 187 196 pImage->data = (GLubyte*)map->pixels; 197 pImage->bpp = 3;//map->BytesPerPixel; 188 198 if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb"))) 189 199 for (int i=0;i<map->h * map->w *3;i+=3) … … 193 203 pImage->data[i+2] = temp; 194 204 } 205 /* this is the real swapping algorithm */ 206 for( int i = 0 ; i < (pImage->height / 2) ; ++i ) 207 for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp ) 208 for(int k = 0; k < pImage->bpp; ++k) 209 swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]); 210 195 211 this->loadTexToGL (pImage, texture); 196 212 }
Note: See TracChangeset
for help on using the changeset viewer.