Changeset 3748 in orxonox.OLD for orxonox/branches
- Timestamp:
- Apr 7, 2005, 5:29:54 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/lib/graphics/font/glfont.cc
r3747 r3748 471 471 // Surface definition. 472 472 SDL_Rect tmpRect; // this represents a Rectangle for blitting. 473 SDL_Surface* tmpSurf = SDL_CreateRGBSurface( 474 SDL_SWSURFACE, 473 SDL_Surface* tmpSurf = SDL_CreateRGBSurface(SDL_SWSURFACE, 475 474 rectSize, rectSize, 476 475 32, … … 487 486 #endif 488 487 ); 489 490 488 tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h; 491 489 SDL_SetClipRect(tmpSurf, &tmpRect); … … 515 513 } 516 514 // reading in the new Glyph 517 glyphSurf = TTF_RenderGlyph_Shaded(this->font, 518 i, 519 this->currentText->color, 520 tmpColor); 515 //glyphSurf = TTF_RenderGlyph_Shaded(this->font, i, this->currentText->color, tmpColor); 516 glyphSurf = TTF_RenderGlyph_Blended(this->font, i, this->currentText->color); 521 517 if( glyphSurf ) 522 518 { 519 520 SDL_SetAlpha(glyphSurf, 0, 0); 521 523 522 SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect); 524 523 TexCoord tmpTexCoord; … … 534 533 glVertex2d(0, 0); 535 534 glTexCoord2f(tmpTexCoord.minU, tmpTexCoord.maxV); 536 glVertex2d(0, tmp Rect.y);535 glVertex2d(0, tmpGlyph->height); 537 536 glTexCoord2f(tmpTexCoord.maxU, tmpTexCoord.maxV); 538 glVertex2d(tmp Rect.x, tmpRect.y);537 glVertex2d(tmpGlyph->width, tmpGlyph->height); 539 538 glTexCoord2f(tmpTexCoord.maxU, tmpTexCoord.minV); 540 glVertex2d(tmp Rect.x, 0);539 glVertex2d(tmpGlyph->width, 0); 541 540 glEnd(); 542 541 glEndList(); … … 559 558 } 560 559 } 561 562 GLuint tmpRet = this->loadTexture(tmpSurf, NULL); 560 GLuint texture; 561 glGenTextures(1, &texture); 562 glBindTexture(GL_TEXTURE_2D, texture); 563 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 564 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 565 glTexImage2D(GL_TEXTURE_2D, 566 0, 567 GL_RGBA, 568 tmpSurf->w, tmpSurf->h, 569 0, 570 GL_RGBA, 571 GL_UNSIGNED_BYTE, 572 tmpSurf->pixels); 563 573 SDL_FreeSurface(tmpSurf); 564 return t mpRet;574 return texture; 565 575 } 566 576 … … 590 600 texCoord->maxV = (GLfloat)surface->h / h; 591 601 } 592 image = SDL_CreateRGBSurface( 593 SDL_SWSURFACE, 602 image = SDL_CreateRGBSurface(SDL_SWSURFACE, 594 603 w, h, 595 604 32,
Note: See TracChangeset
for help on using the changeset viewer.