相关疑难解决方法(0)

Freetype和OpenGL的问题

嘿,我在装载Freetype 2库的openGL中绘制文本时遇到了一个奇怪的问题.这是我所看到的截图.

例如http://img203.imageshack.us/img203/3316/freetypeweird.png

这是我的代码位,用于加载和呈现我的文本.

class Font
{
    Font(const String& filename)
    {
       if (FT_New_Face(Font::ftLibrary, "arial.ttf", 0, &mFace)) {
          cout << "UH OH!" << endl;
       }

       FT_Set_Char_Size(mFace, 16 * 64, 16 * 64, 72, 72);
    }

    Glyph* GetGlyph(const unsigned char ch)
    {
       if(FT_Load_Char(mFace, ch, FT_LOAD_RENDER))
          cout << "OUCH" << endl;

       FT_Glyph glyph;

       if(FT_Get_Glyph( mFace->glyph, &glyph ))
          cout << "OUCH" << endl;

       FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph)glyph;

       Glyph* thisGlyph = new Glyph;
       thisGlyph->buffer = bitmap_glyph->bitmap.buffer;
       thisGlyph->width = bitmap_glyph->bitmap.width;
       thisGlyph->height = bitmap_glyph->bitmap.rows;

       return thisGlyph;
    } …
Run Code Online (Sandbox Code Playgroud)

c++ opengl fonts text freetype

5
推荐指数
1
解决办法
5768
查看次数

标签 统计

c++ ×1

fonts ×1

freetype ×1

opengl ×1

text ×1