Sunday, February 27, 2011

[OpenGL] FreeType and FTGL for Xcode

1) Download FreeType from: http://www.freetype.org and FTGL source from: http://sourceforge.net/projects/ftgl/

2) Extract the source and open a Terminal to navigate under the corresponding folder

3) For each do following steps in Terminal:
a) ./configure
b) make

4) find the libfreetype.a library file, for my case, it is under the folder of objs/.libs

5) copy the libfreetype.a and the include folder to a place, these are the files needed for apps;

6) Similarly for the FTGL, do ./configure, make and find the libftgl.a which is under src/.libs/

7) copy the libftgl.a and the folder FTGL under the src folder for future use.

For testing,

In Xcode, create a command-line app.

Copy the code from FTGL's demo folder's c-demo.c to the main.c of the newly created Xcode project.

drag libftgl.a, libfreetype.a and the header folders FTGL, freetype and the f2build.h to the project.


To compile the program we also need the "config.h" file from the FTGL's folder and add the OpenGL and GLUT frameworks.

Finally the result is :

Posted via email from Troy's posterous

1 comment:

  1. Whenever I run this in xcode, I get this error, (I shortened the error since I didnt think it was relevant)
    [CODE]
    Undefined symbols for architecture i386:
    "FTBitmapFont::FTBitmapFont(char const*)", referenced from:
    setUpFonts(int) in main.o
    "FTPixmapFont::FTPixmapFont(char const*)", referenced from:
    setUpFonts(int) in main.o
    "FTExtrudeFont::FTExtrudeFont(char const*)", referenced from:
    setUpFonts(int) in main.o
    "FTOutlineFont::FTOutlineFont(char const*)", referenced from:
    setUpFonts(int) in main.o
    "FTPolygonFont::FTPolygonFont(char const*)", referenced from:
    setUpFonts(int) in main.o
    "FTTextureFont::FTTextureFont(char const*)", referenced from:
    setUpFonts(int) in main.o
    ...

    mouse(int, int, int, int) in main.o
    "_tbReshape", referenced from:
    myReshape(int, int) in main.o
    [/CODE]

    I tried playing around with the architecture but still doesnt work. Any thoughts on this? Thanks!

    ReplyDelete

Google+