Changeset 5768 in orxonox.OLD for trunk/src/lib/graphics/text_engine/font.cc
- Timestamp:
- Nov 24, 2005, 8:24:52 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/text_engine/font.cc
r5427 r5768 132 132 this->fontTTF = NULL; 133 133 this->glyphArray = NULL; 134 this->fastTextureID = 0;135 134 } 136 135 … … 149 148 this->fontTTF = NULL; 150 149 } 151 if (this->fastTextureID != 0) 152 { 153 if(glIsTexture(this->fastTextureID)) 154 glDeleteTextures(1, &this->fastTextureID); 155 this->fastTextureID = 0; 156 } 150 157 151 158 152 this->setName(fontFile); … … 161 155 if(this->fontTTF != NULL) 162 156 { 163 this->fastTextureID = this->createFastTexture(); 164 if (this->fastTextureID != 0) 165 return true; 166 else 167 return false; 157 this->createFastTexture(); 158 return (this->getTexture() != 0); 168 159 } 169 160 else … … 190 181 this->fontTTF = NULL; 191 182 } 192 if (this->fastTextureID != 0) 193 { 194 if(glIsTexture(this->fastTextureID)) 195 glDeleteTextures(1, &this->fastTextureID); 196 this->fastTextureID = 0; 197 } 198 199 this->fastTextureID = Text::loadTexture(surface, NULL); 183 if (this->prepareSurface(surface)) 184 this->loadTexToGL( ); 200 185 201 186 // initializing the Glyphs. … … 251 236 Font* Font::defaultFont = NULL; 252 237 238 /** 239 * creates and exports an Image, that has all the characters 240 * stored in a Array (as an image) 241 * @param fileName the File to write the image into. 242 */ 253 243 void Font::createAsciiImage(const char* fileName) 254 244 { … … 400 390 * creates a Fast-Texture of this Font 401 391 */ 402 GLuintFont::createFastTexture()392 bool Font::createFastTexture() 403 393 { 404 394 /* interesting GLYPHS: … … 500 490 // SDL_SaveBMP(tmpSurf, outName); 501 491 502 GLuint texture; 503 glGenTextures(1, &texture); 504 glBindTexture(GL_TEXTURE_2D, texture); 505 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 506 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 507 glTexImage2D(GL_TEXTURE_2D, 508 0, 509 GL_RGBA, 510 tmpSurf->w, tmpSurf->h, 511 0, 512 GL_RGBA, 513 GL_UNSIGNED_BYTE, 514 tmpSurf->pixels); 515 SDL_FreeSurface(tmpSurf); 516 return texture; 492 if (this->setSurface(tmpSurf)) 493 loadTexToGL(); 517 494 } 518 495
Note: See TracChangeset
for help on using the changeset viewer.