Xcode and FTGL

Nibbie
Posts: 1
Joined: 2010.04
Post: #1
I just downloaded and installed FTGL and Freetype2 to render text in openGL. I was able to compile and run the demo programs included in the FTGL "demo" folder, but I'm having a hard time using FTGL in my Xcode project. I've added "/usr/local/include/" to the User Header Search Path of my project. When I build the project it fails at the Linking stage, yielding an error regarding the ctor of FTOulineFont. My best guess is that it can't find an implementation of the FTOutlineFont in the "include" directories and that I need to add the proper libraries to my project for it to compile. This is where I'm stuck. Can anyone point me in the right direction?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
why is FTGL in /usr/local?

just add the dir containing the FTGL headers to your target's header search paths, and drag libftgl.a into your project.

(then realize that FTGL is slow, and has one of the most bizarre APIs known to man).
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #3
A few years ago when I did some stuff with FTGL, I made an XCode project to compile it into a framework. I still have a download up for it here. Since the latest stable release is in 2004, it should still be up to date. I don't remember if I made any changes to the source code to get it to compile, but if I didn't then you should be able to drop in any newer source and re-use the projects. (though you might have to add or remove files from the project)
Quote this message in a reply
Apprentice
Posts: 11
Joined: 2013.10
Post: #4
I'm pretty much stuck at the same place hiddenspring81 is at, but Im getting this error message when I try to compile it when I try to use this line:

Code:
FTPixmapFont infoFont = new FTPixmapFont("/System/Library/Fonts/Helvetica.dfont");

Quote:Undefined symbols for architecture x86_64:
"_BZ2_bzDecompress", referenced from:
_ft_bzip2_file_fill_output in libfreetype.a(ftbzip2.o)
"_BZ2_bzDecompressEnd", referenced from:
_ft_bzip2_stream_io in libfreetype.a(ftbzip2.o)
_ft_bzip2_stream_close in libfreetype.a(ftbzip2.o)
"_BZ2_bzDecompressInit", referenced from:
_FT_Stream_OpenBzip2 in libfreetype.a(ftbzip2.o)
_ft_bzip2_stream_io in libfreetype.a(ftbzip2.o)
"_inflate", referenced from:
_ft_gzip_file_fill_output in libfreetype.a(ftgzip.o)
"_inflateEnd", referenced from:
_FT_Stream_OpenGzip in libfreetype.a(ftgzip.o)
_ft_gzip_stream_close in libfreetype.a(ftgzip.o)
"_inflateInit2_", referenced from:
_FT_Stream_OpenGzip in libfreetype.a(ftgzip.o)
"_inflateReset", referenced from:
_ft_gzip_file_io in libfreetype.a(ftgzip.o)
"_png_create_info_struct", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_create_read_struct", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_destroy_read_struct", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_error", referenced from:
_read_data_from_FT_Stream in libfreetype.a(sfnt.o)
"_png_get_IHDR", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_get_error_ptr", referenced from:
_error_callback in libfreetype.a(sfnt.o)
_read_data_from_FT_Stream in libfreetype.a(sfnt.o)
"_png_get_io_ptr", referenced from:
_read_data_from_FT_Stream in libfreetype.a(sfnt.o)
"_png_get_valid", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_read_end", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_read_image", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_read_info", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_read_update_info", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_expand_gray_1_2_4_to_8", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_filler", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_gray_to_rgb", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_interlace_handling", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_longjmp_fn", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
_error_callback in libfreetype.a(sfnt.o)
"_png_set_packing", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_palette_to_rgb", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_read_fn", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_read_user_transform_fn", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_strip_16", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
"_png_set_tRNS_to_alpha", referenced from:
_Load_SBit_Png in libfreetype.a(sfnt.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Also @akb825, do you still have the project to compile ftgl into a framework? The link isnt working anymore, I was hoping to leverage that and see if I might have made a mistake installing FTGL and FreeType.

Thanks!
Quote this message in a reply
⌘-R in Chief
Posts: 1,256
Joined: 2002.05
Post: #5
You're not linking against all the requisite libraries. (The "in xyz" ones.) That or you are, but they're not 64-bit. You can lipo -info /path/to/lib to see if it's 64-bit.
Quote this message in a reply
Apprentice
Posts: 11
Joined: 2013.10
Post: #6
I changed the target from 64 bit to 32 bit and now its giving me this error:

Code:
Undefined symbols for architecture i386:
  "FTPixmapFont::FTPixmapFont(char const*)", referenced from:
      -[BoxTest renderOutput:withInfo:] in BoxTest.o
  "FTPixmapFont::~FTPixmapFont()", referenced from:
      -[BoxTest renderOutput:withInfo:] in BoxTest.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I also pasted the libftgl.dylib, libftgl.a, libfreetype.a and libfreetype.dylib along with the project.

They are also included in the "Link Binary with Libraries"

Then the headers are searched by the header search path.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
what necromancy!

why are you trying to use FTGL? don’t do that Sad
Quote this message in a reply
Apprentice
Posts: 11
Joined: 2013.10
Post: #8
I'm trying to create 3d text in opengl.

Are there better alternatives to ftgl for 3d text?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How do I flip upside down fonts in FTGL mr5z 4 1,141 Mar 3, 2014 03:36 PM
Last Post: JustinFic
  Anyone run into this problem with FTGL? wadesworld 1 3,085 Apr 21, 2009 02:19 PM
Last Post: Oddity007
  FTGL crash when exiting program Malarkey 8 5,363 Mar 27, 2008 03:33 PM
Last Post: Malarkey
  More Freetype/FTGL trouble Fenris 33 17,307 Sep 15, 2006 06:27 AM
Last Post: TomorrowPlusX
  FTGL point size question TomorrowPlusX 3 3,835 Aug 26, 2005 04:56 AM
Last Post: TomorrowPlusX