Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

KalvinB

Fast fonts

This topic is 5815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m currently using NeHe''s bitmapped font tutorial to render text to the screen but it''s painfully slow. My project runs at 60fps on a ~400Mhz laptop with an 8MB card but drops to 14FPS when text is drawn. I was wondering if there''s a better font class out there or if I''m just going to have to write my own. It needs to at least be able to recognize a ''\n'' although word wrap already put in would be nice. Ben IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]

Share this post


Link to post
Share on other sites
Advertisement
There''s a simple solution to this: stay away from bitmapped fonts at every opportunity. They''re not optimized, and can seriously degrade your high framerates.

There are loads of tutorials out there (even one on NeHe''s site) which deal with texture-mapped quads as a means of creating text. Basically you create a 256x256 texture, and fill it with all the letters and punctuation. Then, you load it in, and create display lists for every character. When you want to draw text, you write an algorithm that runs through the text string character by character, and calls the appropriate list for that character.

As you''re drawing textured quads, they''re hardware accelerated, and much, much faster than bitmapped fonts...


Movie Quote of the Week:

"You''ve been eating retard sandwiches again."
- Birdman, Beautiful Girls.
Try http://uk.geocities.com/mentalmantle. Seriously. It''s brilliant.
And I just completely redesigned it so it looks even better.
DarkVertex Beta 0.8 available soon!

Share this post


Link to post
Share on other sites
"google has some good stuff on fast(er) gl fonts."

thanks n00b

"Basically you create a 256x256 texture, and fill it with all the letters and punctuation"

Yeah, I used that method for Gang Wars, Tombstone and Gravity Kills. However, I want the user to beable to specify the font name and size in the ini file for this project.

This project also has a DX 8.1 version which uses fonts and manages to drop only 11FPS with a long line of text while OpenGL drops 70FPS with the same line of text.

Basically what the DX 8.1 font class does is automatically create the offscreen surface and puts the fonts to them and then stores the vertice information. I''ll probably just have to port that function over to my OpenGL class.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]

Share this post


Link to post
Share on other sites
quote:
Original post by KalvinB
thanks n00b


you''re welcome. i see that you''d rather spend days waiting here for someone to hand a solution to you than spend half an hour searching for it yourself. grow up.

Share this post


Link to post
Share on other sites
"Fonts from textures are goooooood!"

font on a texture

Yep. I managed to create a function which would write all the characters of any font of any size to an OpenGL texture. Unfortunatly it only worked in a 1024x768 because of scaling and offsetting that had to take place. Also, the vertices were dependent on the font and so they couldn't be automatically generated. I had to do translations which didn't go over well when trying to store them in the vertices.

So I'm now writting them to the HDC and they show up just like they're supposed to so the vertices are being stored correctly but now I need to go from the HDC to the OpenGL texture.

How do I go about doing that?

BitBlt is I guess the function for doing it because I have no idea how to reference the texture by an HDC handle so I can copy to it.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]


[edited by - KalvinB on October 19, 2002 7:30:58 PM]

Share this post


Link to post
Share on other sites
http://www.lmnopc.com/bitmapfontbuilder/

Will build the texture for you from two True Type fonts. The program also allows you to export font width information to a file to let you import character information into your application.



ThomW
www.LMNOpc.com

Share this post


Link to post
Share on other sites
ThomW - I like your app. But is there any chance you could add an option to export the font widths as a C array? That''d be great!

2DNow - Specializing in yesterday''s technology today!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!