|
AllegroGL textured fonts - Original colours |
james_lohr
Member #1,947
February 2002
|
Is there some way to get allegrogl to display an allegro font in it's original (palette) colours? - In a similar way to textprintf() when a negative value is given as the colour and the correct palette is set. It only seems to come out in monochrone. I've tried setting different internal texture formats before converting the font to an OpenGL font, but nothing's helped much.
|
Gnatinator
Member #2,330
May 2002
|
Ive tried for a long time, bob says' its a bug. I just recently created a TGA font loader/printf displayer if you want some code for some decent looking fontage.
|
james_lohr
Member #1,947
February 2002
|
Quote: Ive tried for a long time, bob says' its a bug. Noooo! . A bug as in a problem with the AllegroGL code, or an OpenGL limitation? Quote: I just recently created a TGA font loader/printf displayer if you want some code for some decent looking fontage. Sounds good, but ideally I want something that uses or converts allegro fonts.
|
Gnatinator
Member #2,330
May 2002
|
Heh, I tried to post the code and maxed out the post size Anyway I got it all packaged into an attachement To use it just include the .h then do something like this: // Set text color glColor4f ( 1.0f, 1.0f, 1.0f, 1.0f ); // Texture, x pos, y pox, z pos, texture x dimension, texture y dimension, character x dimension, character y dimension, character seperation factor, text, ... TGA_Text_printf(&tex_font[0], 10.0, 180.0, 0.0, 256.0 ,128.0, 16.0, 16.0, -2.0, "FPS: %d",fps_time); I decided to keep the color seperate, check out the beggining of the cpp file and modify any initial opengl settings as you wish. The characters on the texture can be any width or hieght, just as long as they are all constant. And you must keep the exact order in the texture file or it will screw up the reading. I think thats it, if ou have any further questions just ask. Enjoy! EDIT:
|
james_lohr
Member #1,947
February 2002
|
Ok thanks , I'll give it a try. [edit] If you keep the characters in the usual ASCII order and subtruct 32 (I think it's 32 if SPACE is the first character) from the characters integer value, you can work out the characters texture coordinates. It'll save you having to do a 125 case switch. Also you can avoid having to pass the texture size to the function with: glGetTexLevelParameterfv(GL_TEXTURE_2D,0, GL_TEXTURE_WIDTH, &w); //get width glGetTexLevelParameterfv(GL_TEXTURE_2D,0, GL_TEXTURE_HEIGHT,&h); //get height
|
pantz
Member #3,387
March 2003
|
That code has a lot of copy'n'paste redundancy |
|