More Freetype/FTGL trouble

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
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?

Thanks,
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #2
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?
Quote this message in a reply
Member
Posts: 144
Joined: 2004.07
Post: #3
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
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
@lightbringer: Have I told you lately that I love you? Love
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #5
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: http://zakariya.net/shamyl/UsefulLibs.zip

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.,

Code:
#include <FTGL/FTFont.h>
#include <GL/glew.h>
#include <OpenAL/al.h>
... and so on
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
Sorry Derek, it wouldn've worked out anyway.
TomorrowPlusX, will you marry me? Love
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #7
You are an amorous man, Fenris.
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #8
he's MINE Fenris back off!

Seriously TPX, this is useful - everyone always seems to have trouble getting freetype/ftgl to build Thanks!
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #9
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] )
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #10
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.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #11
nice GUI toolkit, TomorrowPlusX -- any plans to make it publically available?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #12
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
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #13
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
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #14
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.
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #15
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,

Code:
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())
             {
                 tokens.push_back(nonDelimeter);
                 nonDelimeter.clear();
             }

             tokens.push_back(delim);
         }
         else
         {
             nonDelimeter.push_back(in[start]);

             start++;
             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!
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,009 Mar 3, 2014 03:36 PM
Last Post: JustinFic
  Xcode and FTGL hiddenspring81 7 5,987 Oct 10, 2013 03:00 PM
Last Post: ardowz
  Anyone run into this problem with FTGL? wadesworld 1 3,046 Apr 21, 2009 02:19 PM
Last Post: Oddity007
  FTGL crash when exiting program Malarkey 8 5,289 Mar 27, 2008 03:33 PM
Last Post: Malarkey
  Freetype Demo kodex 0 2,396 Mar 6, 2006 10:27 PM
Last Post: kodex