More Freetype/FTGL trouble

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. Could anyone perhaps help me out?

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.

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:

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:

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.

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.

OK, as promised, here's a project which includes the text formatting and, in general, the gui api with layout management and so on.

http://zakariya.net/shamyl/WorldEngine.zip
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,