Changeset 3718 in orxonox.OLD for orxonox/branches/textEngine/src/lib/graphics/font
- Timestamp:
- Apr 4, 2005, 11:28:59 PM (20 years ago)
- Location:
- orxonox/branches/textEngine/src/lib/graphics/font
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/lib/graphics/font/glfont.cc
r3716 r3718 142 142 143 143 this->setColor(0, 255, 0); 144 this->setPosition(0, 0); 144 145 145 146 this->setText(FONT_DEFAULT_TEXT); 146 147 147 148 this->createTexture(); 149 150 this->createFastTexture(); 148 151 } 149 152 … … 272 275 gluProject(x, y, z, modMat, projMat, viewPort, tmp, tmp+1, tmp+2); 273 276 printf("test %f %f %f,\n", tmp[0], tmp[1], tmp[2]); 274 pos.x = tmp[0] ;275 pos.y = GraphicsEngine::getInstance()->getResolutionY() - tmp[1] ;277 pos.x = tmp[0] + this->currentText->textPosSize.x; 278 pos.y = GraphicsEngine::getInstance()->getResolutionY() - tmp[1] + this->currentText->textPosSize.y; 276 279 pos.z = tmp[2]; 277 280 } 278 281 else 282 { 283 pos.x = this->currentText->textPosSize.x; 284 pos.y = this->currentText->textPosSize.y; 285 pos.z = 0; 286 } 279 287 glBindTexture(GL_TEXTURE_2D, this->currentText->texture); 280 288 glEnable(GL_TEXTURE_2D); … … 429 437 430 438 glPopAttrib(); 439 } 440 441 442 GLuint GLFont::createFastTexture(void) 443 { 444 /* interesting GLYPHS: 445 * 33-47: Special Characters. 446 * 48-57: 0-9 447 * 58-63: some more special chars (minor) 448 * 65-90: A-Z 449 * 97-122: a-z 450 */ 451 SDL_Surface* tmpSurf = SDL_CreateRGBSurface( 452 SDL_SWSURFACE, 453 100, 100, 454 32, 455 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ 456 0x000000FF, 457 0x0000FF00, 458 0x00FF0000, 459 0xFF000000 460 #else 461 0xFF000000, 462 0x00FF0000, 463 0x0000FF00, 464 0x000000FF 465 #endif 466 ); 467 SDL_Rect tmpRect; 468 tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = 100; tmpRect.h = 100; 469 for ( int i = 65; i <= 90; i++ ) 470 { 471 SDL_Surface* glyph = NULL; 472 473 glyph = TTF_RenderGlyph_Blended( this->font, i, this->currentText->color ); 474 475 if( glyph ) { 476 char outname[64]; 477 if (i<10) 478 sprintf( outname, "glyph-00%d.bmp", i ); 479 else if (i <100) 480 sprintf( outname, "glyph-0%d.bmp", i ); 481 else 482 sprintf( outname, "glyph-%d.bmp", i ); 483 484 SDL_BlitSurface(glyph, NULL, tmpSurf, &tmpRect); 485 SDL_SaveBMP( tmpSurf, outname ); 486 } 487 } 488 /* 489 tmpSurf = TTF_RenderText_Blended(this->font, 490 this->name, 491 this->currentText->color); 492 */ 431 493 } 432 494 -
orxonox/branches/textEngine/src/lib/graphics/font/glfont.h
r3715 r3718 116 116 static bool checkVersion(void); 117 117 118 GLuint createFastTexture(); 118 119 GLuint loadTexture(SDL_Surface* surface, TexCoord* texCoord); 119 120
Note: See TracChangeset
for help on using the changeset viewer.