Changeset 5863 in orxonox.OLD for trunk/src/lib/graphics/importer/texture.cc
- Timestamp:
- Dec 1, 2005, 9:14:30 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/texture.cc
r5860 r5863 45 45 } 46 46 47 47 48 /** 48 49 * Destructor of a Texture … … 57 58 SDL_FreeSurface(this->image); 58 59 } 60 59 61 60 62 /** … … 114 116 } 115 117 118 119 /** 120 * rebuilds the texture. 121 * reloads the Texture from Memory to OpenGL. 122 */ 116 123 bool Texture::rebuild() 117 124 { … … 128 135 this->setTexture(loadTexToGL(this->image)); 129 136 } 130 131 } 132 137 } 138 139 140 /** 141 * set the surface this Texture handles 142 * @param newSurface the new Surface to set as the image for this Texture. 143 * 144 * This deletes the old version of the stored Texture, 145 * and sets the newly given Surface as current. 146 */ 147 bool Texture::setSurface(SDL_Surface* newSurface) 148 { 149 if (this->image != NULL) 150 SDL_FreeSurface(this->image); 151 152 this->image = newSurface; 153 154 return (this->image != NULL); 155 } 156 157 158 bool Texture::texturesEnabled = true; 159 160 /** 161 * enables, disables textures 162 * @param texturesEnabled true if the textures should be enabled 163 */ 164 void Texture::setTextureEnableState(bool texturesEnabled) 165 { 166 Texture::texturesEnabled = texturesEnabled; 167 } 168 169 170 ////////////////////////////////////// 171 // UTILITY FUNCTIONALITY OF TEXTURE // 172 ////////////////////////////////////// 133 173 /** 134 174 * converts surface to a new SDL_Surface, that is loadable by openGL … … 148 188 hasAlpha = false; 149 189 retSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 150 surface->w, surface->h,151 32,190 surface->w, surface->h, 191 32, 152 192 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ 153 193 0x000000FF, … … 156 196 0xFF000000 157 197 #else 158 0xFF000000,198 0xFF000000, 159 199 0x00FF0000, 160 200 0x0000FF00, 161 201 0x000000FF 162 202 #endif 163 );203 ); 164 204 if ( retSurface == NULL ) 165 205 { … … 191 231 } 192 232 193 /** 194 * set the surface this Texture handles 195 * @param newSurface the new Surface to set as the image for this Texture. 196 * 197 * This deletes the old version of the stored Texture, 198 * and sets the newly given Surface as current. 199 */ 200 bool Texture::setSurface(SDL_Surface* newSurface) 201 { 202 if (this->image != NULL) 203 SDL_FreeSurface(this->image); 204 205 this->image = newSurface; 206 207 return (this->image != NULL); 208 } 209 210 211 bool Texture::texturesEnabled = true; 212 213 /** 214 * enables, disables textures 215 * @param texturesEnabled true if the textures should be enabled 216 */ 217 void Texture::setTextureEnableState(bool texturesEnabled) 218 { 219 Texture::texturesEnabled = texturesEnabled; 220 } 221 222 223 ////////////////////////////////////// 224 // UTILITY FUNCTIONALITY OF TEXTURE // 225 ////////////////////////////////////// 233 226 234 /** 227 235 * Loads a Texture to the openGL-environment.
Note: See TracChangeset
for help on using the changeset viewer.