Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5420 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Oct 22, 2005, 1:57:29 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Font is now Right, and the Rendering 'should be' faster.

Location:
trunk/src/lib/graphics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/render2D/render_2d.h

    r5417 r5420  
    22 * @file render_2d.h
    33 * @brief Definition of the 2D-rendering engine singleton Class
    4  * @todo implement Layer-rendering
    5 */
     4 */
    65
    76#ifndef _RENDER_2D_H
  • trunk/src/lib/graphics/text_engine/font.cc

    r5418 r5420  
    412412
    413413  this->initGlyphs(32, numberOfGlyphs);
    414   this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space
     414//  this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space
    415415
    416416  int rectSize = this->findOptimalFastTextureSize();
     
    437437  tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h;
    438438  SDL_SetClipRect(tmpSurf, &tmpRect);
    439   int maxLineHeight = 0;
     439  int maxLineHeight = this->getMaxHeight();
    440440
    441441  // all the interessting Glyphs
     
    453453      {
    454454        tmpRect.x = 0;
    455         tmpRect.y = tmpRect.y + maxLineHeight + 1;
    456         maxLineHeight = 0;
     455        tmpRect.y = tmpRect.y + maxLineHeight;
    457456      }
    458457      if (tmpRect.y + maxLineHeight > tmpSurf->h)
     
    470469      {
    471470        SDL_SetAlpha(glyphSurf, 0, 0);
    472 
     471        int tmp = tmpRect.y;
     472        tmpRect.y += this->getMaxAscent()-(int)((float)tmpGlyph->bearingY*this->renderSize);
    473473        SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect);
    474         tmpGlyph->texCoord[0] = (float)tmpRect.x/(float)tmpSurf->w;
    475         tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->advance*this->renderSize)/(float)tmpSurf->w;
     474        tmpRect.y = tmp;
     475
     476        tmpGlyph->texCoord[0] = (float)(tmpRect.x)/(float)tmpSurf->w;
     477        tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->width*(float)this->renderSize)/(float)tmpSurf->w;
    476478        tmpGlyph->texCoord[2] = (float)(tmpRect.y)/(float)tmpSurf->w;
    477         tmpGlyph->texCoord[3] = (float)(tmpRect.y+tmpGlyph->height*this->renderSize)/(float)tmpSurf->w;
     479        tmpGlyph->texCoord[3] = (float)(tmpRect.y+this->getMaxHeight())/(float)tmpSurf->w;
    478480        SDL_FreeSurface(glyphSurf);
    479 
    480         tmpRect.x += (int)(tmpGlyph->advance*this->renderSize)+1;
    481 
    482               // Outputting Glyphs to BMP-files.
     481        tmpRect.x += (int)(tmpGlyph->advance * this->renderSize)+1;
     482
    483483        /*
    484         char outname[512];
     484        // Outputting Glyphs to BMP-files.
     485        char outname[1024];
    485486        if (i < 10)
    486487        sprintf( outname, "%s-glyph-00%d.bmp", this->getName(), i );
     
    489490        else
    490491        sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i );
    491         SDL_SaveBMP(tmpSurf, outname);
    492         */
     492        SDL_SaveBMP(tmpSurf, outname);*/
    493493      }
    494494    }
    495495  }
     496  // outputting the GLYPH-table
     497  //   char outName[1024];
     498  //   sprintf( outName, "%s-glyphs.bmp", this->getName());
     499  //   SDL_SaveBMP(tmpSurf, outName);
    496500
    497501  GLuint texture;
  • trunk/src/lib/graphics/text_engine/text.cc

    r5419 r5420  
    243243    {
    244244      glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0);
    245       glRotatef(this->getAbsDir2D(), 0,0,1);
     245      glRotatef(this->getAbsDir2D(), 0, 0, 1);
    246246      Glyph* tmpGlyph;
    247247      float posX = 0.0f;
     
    253253
    254254          glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]);
    255           glVertex2d(posX, - tmpGlyph->bearingY * this->size);
     255          glVertex2d(posX, 0);
    256256
    257257          glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]);
    258           glVertex2d(posX, (tmpGlyph->height - tmpGlyph->bearingY)*this->size);
     258          glVertex2d(posX, this->size);
    259259
    260260          glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]);
    261           glVertex2d(posX+tmpGlyph->width*this->size, (tmpGlyph->height - tmpGlyph->bearingY)*this->size);
     261          glVertex2d(posX+tmpGlyph->width*this->size, this->size);
    262262
    263263          glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
    264           glVertex2d(posX+tmpGlyph->width*this->size, - tmpGlyph->bearingY*this->size);
     264          glVertex2d(posX+tmpGlyph->width*this->size, 0);
    265265
    266266          glEnd();
Note: See TracChangeset for help on using the changeset viewer.