Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3748 in orxonox.OLD


Ignore:
Timestamp:
Apr 7, 2005, 5:29:54 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/textEngine: now the Glyph is transparent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/textEngine/src/lib/graphics/font/glfont.cc

    r3747 r3748  
    471471  // Surface definition.
    472472  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,
    475474                                               rectSize, rectSize,
    476475                                               32,
     
    487486#endif
    488487                                               );
    489 
    490488  tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h;
    491489  SDL_SetClipRect(tmpSurf, &tmpRect);
     
    515513            }
    516514          // 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);
    521517          if( glyphSurf )
    522518            {
     519
     520              SDL_SetAlpha(glyphSurf, 0, 0);
     521
    523522              SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect);
    524523              TexCoord tmpTexCoord;
     
    534533              glVertex2d(0, 0);
    535534              glTexCoord2f(tmpTexCoord.minU, tmpTexCoord.maxV);
    536               glVertex2d(0, tmpRect.y);
     535              glVertex2d(0, tmpGlyph->height);
    537536              glTexCoord2f(tmpTexCoord.maxU, tmpTexCoord.maxV);
    538               glVertex2d(tmpRect.x, tmpRect.y);
     537              glVertex2d(tmpGlyph->width, tmpGlyph->height);
    539538              glTexCoord2f(tmpTexCoord.maxU, tmpTexCoord.minV);
    540               glVertex2d(tmpRect.x, 0);
     539              glVertex2d(tmpGlyph->width, 0);
    541540              glEnd();
    542541              glEndList();
     
    559558        }
    560559    }
    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);
    563573  SDL_FreeSurface(tmpSurf);
    564   return tmpRet;
     574  return texture;
    565575}
    566576
     
    590600      texCoord->maxV = (GLfloat)surface->h / h;
    591601    }
    592   image = SDL_CreateRGBSurface(
    593                                SDL_SWSURFACE,
     602  image = SDL_CreateRGBSurface(SDL_SWSURFACE,
    594603                               w, h,
    595604                               32,
Note: See TracChangeset for help on using the changeset viewer.