Changeset 5754 in orxonox.OLD for trunk/src/lib/graphics/importer
- Timestamp:
- Nov 24, 2005, 11:53:58 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/texture.cc
r5753 r5754 38 38 this->texture = 0; 39 39 this->image = NULL; 40 40 41 if (imageName != NULL) 41 42 this->loadImage(imageName); … … 64 65 if (GraphicsEngine::texturesEnabled) 65 66 { 67 if (this->image != NULL) 68 { 69 SDL_FreeSurface(this->image); 70 this->image = NULL; 71 } 72 if (this->texture != 0) 73 { 74 glDeleteTextures(1, &this->texture); 75 this->texture = 0; 76 } 66 77 if (imageName != NULL) 67 78 { … … 73 84 if(tmpSurf != NULL) 74 85 { 75 PRINTF( 3)("loading Image %s\n", imageName);86 PRINTF(4)("loading Image %s\n", imageName); 76 87 this->image = this->prepareSurface(tmpSurf); 77 88 this->texture = loadTexToGL(this->image); … … 88 99 else 89 100 { 101 PRINTF(2)("Image-Name not specified\n"); 90 102 return false; 91 103 } 92 104 } 93 return false; 94 } 95 105 return false; 106 } 107 108 bool Texture::reload() 109 { 110 if (this->texture != 0) 111 { 112 glDeleteTextures(1,&this->texture); 113 this->texture = 0; 114 } 115 116 if (this->image != NULL) 117 this->texture = this->loadTexToGL(this->image); 118 119 } 120 121 /** 122 * converts surface to a new SDL_Surface, that is loadable by openGL 123 * @param surface the Surface to convert 124 * @returns a !!new!! Surface, that is loadable by openGL. 125 */ 96 126 SDL_Surface* Texture::prepareSurface(SDL_Surface* surface) 97 127 { … … 118 148 #endif 119 149 ); 120 if ( image == NULL ) { 121 return 0; 122 } 150 if ( image == NULL ) 151 return NULL; 123 152 124 153 /* Save the alpha blending attributes */
Note: See TracChangeset
for help on using the changeset viewer.