|
allegro_gl_printf() and text_height() |
colin fletcher
Member #5,463
January 2005
|
Greetings everyone, I've been using allegro 4.0.3 and allegrogl 0.2.4 and I've been pretty happy with the results. I'm having some difficulty with rendering text, however, and I'm hoping someone out there can give me some pointers. I've been using the allegro text API to render all my text and it has worked as expected with neither muss nor fuss. But I recently ram my game on a number of laptops and noticed a tremendous drop in framerate whenever text is being rendered. I assumed that this had to do with a mode change between allegrogl and allegro and so I looked into the font API that allegrogl offers to see if I could speed things up by avoiding mode switches. allegro_gl_printf() is indeed speedy, but the rest of the API is pretty sparse. I need to be able to determine the length of rendered text in order to apply word wrapping and I can't see any text_height() or text_length() equivalents. Any suggestions? |
Elias
Member #358
May 2000
|
You can simply use text_length() on AllegroGL fonts, that's the reason why they also are represented by FONT * pointers -- |
colin fletcher
Member #5,463
January 2005
|
Fancy! Thanks. EDIT: Actually, this code produces an access violation. Is there something else I have to do here? // install allegro.. // install allegrogl.. // set graphics mode.. char* s = "hello my name is simon"; FONT* f = allegro_gl_convert_allegro_font_ex( font, AGL_FONT_TYPE_TEXTURED, 1.0, GL_ALPHA8); int length = text_length(f,s); // crashes here
|
Bob
Free Market Evangelist
September 2000
|
The text_*() bugs have been fixed in the CVS version of AllegroGL. -- |
Elias
Member #358
May 2000
|
Actually, there's an unapplied patch on the AGL mailing list which fixes a small bug in text_length() -- |
colin fletcher
Member #5,463
January 2005
|
Thanks, guys. |
|