iDevGames Forums
More Freetype/FTGL trouble - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: More Freetype/FTGL trouble (/thread-5056.html)

Pages: 1 2 3

More Freetype/FTGL trouble - Fenris - Sep 10, 2005 08:18 AM

Hi all,
I've now pulled out my hair one time too many over this, so I'm going to beg for help. I've managed to get FTGL and Freetype setup and working on one machine once, but I can't repeat the feat.

So, the problems are the following:
First, I download the Freetype source. Trying to run ./configure gives me an error message: ": bad interpreter: No such file or directory".
So, I just run make. make install fails, because there's no such target. I get the libfreetype.a spat out, and I add it to my project.

Now, I can't build FTGL, because the Freetype headers can't be found. I dunk it all into /usr/local/include and install the .a into /usr/local/lib. Still no beef.

I've gotten past this point earlier, but I still get a boatload of header problems, since the headers aren't found. I've tried adding /usr/local/include, /usr/local/include/freetype2 and a host of others to the header include paths, but I'm getting nowhere.

I know that a lot of people have managed to setup this correctly, but I'm clearly doing something wrong. All I want is a simple possibility to static-link FTGL into my program. Google doesn't turn up anything about this, and neither does the forum. Sad Could anyone perhaps help me out?


More Freetype/FTGL trouble - Nick - Sep 10, 2005 12:18 PM

I'm in the same boat. I can't get the FTGL project to work for me. I have Freetype already installed just fine. Anyone got any advice?

More Freetype/FTGL trouble - lightbringer - Sep 10, 2005 01:01 PM

I finally just became fed up enough to screw with the /usr/local/include headers to possibly break FT1.

I ended up moving the /usr/local/include/freetype2/freetype folder to /usr/local/include/freetype, that seems to have stopped the endless number of headaches (though again, it may cause some if you also use freetype1). I also kept the original freetype2 folder in /usr/local/include/ to prevent current stuff that might break from breaking.

EDIT: whoops, I meant include instead of lib

More Freetype/FTGL trouble - Fenris - Sep 12, 2005 03:52 PM

@lightbringer: Have I told you lately that I love you? Love

More Freetype/FTGL trouble - TomorrowPlusX - Sep 13, 2005 07:48 AM

All, for your convenience, I've packaged a zip file with built versions of freetype, ftgl, glew, and a recent version of OpenAL ( from CVS ) which works on Panther as well as Tiger. The package includes headers, and is really easy to use.

Just unpack it, and put the lib and include folders in the root of your Xcode project, and then set the search paths as follows: [Image: SearchPaths.png]

The archive is here:

That said, you probably don't need the $(SRCROOT)/ stuff, I didn't put that there... I guess Xcode was being smart. All my other projects using these libs don't use that part, and they build fine.

Since the headers are stored in folders using the archive name, you can include as if it were a framework, e.g.,

#include <FTGL/FTFont.h>
#include <GL/glew.h>
#include <OpenAL/al.h>
... and so on

More Freetype/FTGL trouble - Fenris - Sep 13, 2005 12:06 PM

Sorry Derek, it wouldn've worked out anyway.
TomorrowPlusX, will you marry me? Love

More Freetype/FTGL trouble - TomorrowPlusX - Sep 13, 2005 01:50 PM

You are an amorous man, Fenris.

More Freetype/FTGL trouble - codemattic - Sep 15, 2005 11:31 AM

he's MINE Fenris back off!

Seriously TPX, this is useful - everyone always seems to have trouble getting freetype/ftgl to build Thanks!

More Freetype/FTGL trouble - TomorrowPlusX - Sep 15, 2005 12:40 PM

Well, if anybody's interested, I just this morning finished a text area class which displays text using FTGL with automatic linewrapping, scrollbars, and such. Addmittedly, it's part of a larger framework ( full opengl gui, with layout and queued message delivery ) but the core logic is basically just c++, opengl, and FTGL. So it could easily be adapted to other uses.

Here's a screenshot:
[Image: Text.png]

It's not a rich-formatted text display, just 1 color and 1 font. But it does respect "\t" and "\n" and in general works pretty well. It'll be good enough for in-game message display.

( for reference, I'm trying to build a robust gui layer for my engine [Image: GUIinGL.png] )

More Freetype/FTGL trouble - TomorrowPlusX - Sep 15, 2005 12:41 PM

codemattic Wrote:he's MINE Fenris back off!

Seriously TPX, this is useful - everyone always seems to have trouble getting freetype/ftgl to build Thanks!

When people finally fight over me, it's men Cry

I'll accept a beer -- the standard unit of hacker payment.

More Freetype/FTGL trouble - OneSadCookie - Sep 15, 2005 03:22 PM

nice GUI toolkit, TomorrowPlusX -- any plans to make it publically available?

More Freetype/FTGL trouble - Fenris - Sep 15, 2005 03:28 PM

TPX: I'd love to take a peek at your line-wrapping code, because that's been stumping me for quite a while. As for having men fight over you and then asking for beer, I'm not sure that's very tactic. Wink

More Freetype/FTGL trouble - AnotherJake - Sep 15, 2005 09:45 PM

TomorrowPlusX, your screenshots just keep looking better and better (heck, they started off good!). Your GUI looks really amazing!

[edit] I hope the Fenris love-tryst works out amicably for all those involved here. We certainly don't want any more broken hearts at iDG. Love

More Freetype/FTGL trouble - TomorrowPlusX - Sep 19, 2005 05:18 AM

OneSadCookie Wrote:nice GUI toolkit, TomorrowPlusX -- any plans to make it publically available?

Absolutely. I've tried to make it *fairly* independant of my engine, but it does require certain unavoidable boilerplate to forward mouse events and the like.

What I'll do is post a project with the GUI working. My actual engine is still in development so it's not really worth looking into ( it's a complete rewrite/refactoring/redesign of the engine for Legion, my stillborn game ).

The GUI programming style ought to be familiar to anybody who's worked with Java or Qt layout managers. You basically just attach a layout manager to a widget, and then add child widgets. So long as all the "leaf" widgets ( like buttons, labels, etc ) provide meaningful values for the preferredContentSize method, it lays out pretty well.

My message passing system, however, is a little expensive and meant *only* for GUI notifications... but it is a more or less proper message queue system.

I'll put up a demo project for you guys soon.

More Freetype/FTGL trouble - TomorrowPlusX - Sep 21, 2005 01:46 PM

OK, as promised, here's a project which includes the text formatting and, in general, the gui api with layout management and so on.
I'd have preferred to hack up a demo with *just* the gui stuff, but the thing is, it's all pretty tied together, since it's all part of an "engine". For reference, there's not much engine there, just the basics, since I'm rewriting Legion from the ground up.

But the gui's pretty solid, at this point, and I'd say more or less ready for public consumption. I spent the last couple days tying up some loose ends in the code and doxygenating it.

The project, as packaged, will build the text demo app in the screenshot.

Now, a few notes:
First, unless you do a deplyment build, you'll have to edit the resource path in main.cpp. Easy enough.

Second, the stuff you're probably interested in is in src/WorldEngine/Hud, specifically, the text layout is in /src/WorldEngine/Hud/Widgets/TextWidget.{h,cpp}

Regarding the architecture, you could probably extract my Hud related classes ( and adapt some of the classes they make use of, like my FontManager, ColorManager, vec2i, etc ), so long as you forward it the proper events, such as key events, mouse events, resizing events, etc.

Of note, my API expects not just a display() call, but also a step() call, since my engine updates the game state at a different rate than it displays. If you don't care about that kind of behavior, you could simply put a call to Hud::step() in Hud::display().

Finally, I make heavy use of a "toolbox" lib (source not included) which I wrote for my AI work, called PANSICore ( Procedural Autonomic Nervous System Interface ). It's not likely much use to any of you, but it includes some useful string functions... the one particularly that I use in my text widget is a string tokenizer, "split". Here's the source,

stringlist split( std::string in, stringlist delimeters )
     stringlist tokens;
     string nonDelimeter;

     size_t start = 0, next = string::npos;
     while (true)
         string delim;

         for (stringlist::iterator it = delimeters.begin(); it != delimeters.end(); ++it)
             next = in.find(*it, start);
             if (next == start)
                 delim = *it;
                 break; //get out

         //if we found a delimeter
         if (delim.length())
             start += delim.length();

             if (nonDelimeter.length())


             if (start >= in.length()) break;

     return tokens;

For reference, "stringlist" is just a typedef'd std::vector< std::string >.

I hope this is useful to people!