PDA

View Full Version : Urgent FTGL crash :: Cannot render text after the 500th items.....???



KenOng
08-21-2013, 02:36 AM
Hi all, I need some urgent info for this. Thank you.

I am new to openGL and FTGL text rendering.

I am able to draw text. I've done something like this :
FTBitmapFont *flbl = new FTBitmapFont("C:/Windows/Fonts/Arial.ttf");
flbl->FaceSize(12);
flbl->Render("Hello");

But the application will crash after the 500++th items. eg.

static int count= 0;
char counter[1000];
if (count < 700) {
count++;
sprintf(counter,"%d",count);
FTBitmapFont *flbl = new FTBitmapFont("C:/Windows/Fonts/Arial.ttf");
flbl->FaceSize(24);
flbl->Render(counter);
}

then the program will crash after showing 509.

Anyone can help me on this?
Any limitation for FTGL to do large amount of text rendering?

Thank you very much.

Claude
08-21-2013, 07:35 AM
How about if you create only 1 FTBitmapFont instead of 700 times the same one?

aronsatie
08-21-2013, 12:52 PM
I don't know how FTGL works, but you are probably out of memory (system, GPU or both). Arial has a lot of glyphs to convert. 700 times?

KenOng
08-22-2013, 04:05 AM
Thanks Claude & aronsatie,

I tried to create only 1 FTBitmapFont now, it seems like working but now I am trying to see how can I rotate these texts i created.
I wish to maintain certain graphic quality so I dont think PolygonFont is suitable for me.

Is that any method to rotate and scale FTBitmapFont or FTPixmapFont ?

aronsatie,
Ya , I think might be some sort of out of memory but I am actually dont know what is glyphs at the moment. Sorry and thank you very much.

^_^

aronsatie
08-22-2013, 12:47 PM
The individual characters of a font are made up of one or more glyphs (these are more or less made from a number of straight or curved lines). The more languages a font supports, the more glyphs there are. Arial is one of the bigger fonts supporting the alphabets of quite a few languages. Somehow FTGL renders all glyphs into bitmaps, the higher the resolution of these bitmaps, the more memory needed. Don't even try a font supporting e.g. Chinese . These can contain 30-40,000 glyphs. However, I just read the description of FTGL. It says that only the first 128 characters are preloaded to save memory. Polygonfont is your best choice if you want total freedom of scaling your texts. Pixmap is only different to Bitmap in that it is antialiased. Rotating and scaling is done by opengl transformations (glRotate and glScale if you use pre 3.0 opengl versions). You can use transformations on any type of FTGL text.