Skip to main content
gamedev.net
🔒 Locked

Rendering Text

Started by Daggerbot Jun 25, 2010 at 6:32 PM 2 replies 750+ views
Original Post
Daggerbot
Daggerbot
I'm about to implement FreeType into my engine, and I was wondering about the best (fastest) way to render text. The two ways that I'm considering are:

1. Render the entire font to a texture, and draw a textured quad for each character in the string. (As per the NeHe tutorials)

2. Render the string to a texture, and draw a textured quad for the entire string. (As implemented in SDL_ttf)

At the moment I'm leaning toward the second choice due to the fact that I plan to support multiple languages, including ones with characters outside of the U+0 to U+FF range. I would have no idea how to determine which characters to render to the texture beforehand with the first choice. Which method have you found most suitable in games? Any help is appreciated.
swiftcoder
swiftcoder
Quote:
Original post by Daggerbot
I'm about to implement FreeType into my engine, and I was wondering about the best (fastest) way to render text. The two ways that I'm considering are:

1. Render the entire font to a texture, and draw a textured quad for each character in the string.

2. Render the string to a texture, and draw a textured quad for the entire string.
Option (1) is the method that a lot of small applications have taken in the past, mostly because of a couple of NeHe tutorials, and a misguided idea that it was faster than (2).

Option (2) is the preferred method these days, because it allows a greater range of character, simpler control over layout, and will generally perform better than (1).
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
Daggerbot
Daggerbot
Thanks for the quick reply :) If option 2 is widely accepted and performs better, then I will go with that.
_the_phantom_
_the_phantom_
Quote:
Original post by swiftcoder
Quote:
Original post by Daggerbot
I'm about to implement FreeType into my engine, and I was wondering about the best (fastest) way to render text. The two ways that I'm considering are:

1. Render the entire font to a texture, and draw a textured quad for each character in the string.

2. Render the string to a texture, and draw a textured quad for the entire string.
Option (1) is the method that a lot of small applications have taken in the past, mostly because of a couple of NeHe tutorials, and a misguided idea that it was faster than (2).

Option (2) is the preferred method these days, because it allows a greater range of character, simpler control over layout, and will generally perform better than (1).


Many commerical games still use a variation on 1, the main difference being text is generated offline into a texture and used directly from there.

Depending on what other limiting factors you have using option 1 could very well be faster and/or easier to manage in a game enviroment.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.