support mipmapping & anisotropic filtering

This commit is contained in:
David Rose 2002-02-16 19:04:22 +00:00
parent c86b3b016e
commit 79c241b0d9
3 changed files with 13 additions and 1 deletions

View File

@ -56,6 +56,8 @@ ConfigureFn(config_text) {
const bool text_flatten = config_text.GetBool("text-flatten", true);
const bool text_update_cleared_glyphs = config_text.GetBool("text-update-cleared-glyphs", false);
const bool text_mipmap = config_text.GetBool("text-mipmap", true);
const int text_anisotropic_degree = config_text.GetInt("text-anisotropic-degree", 1);
const int text_texture_margin = config_text.GetInt("text-texture-margin", 2);
const float text_poly_margin = config_text.GetFloat("text-poly-margin", 1.0f);
const int text_page_x_size = config_text.GetInt("text-page-x-size", 256);

View File

@ -28,6 +28,8 @@ NotifyCategoryDecl(text, EXPCL_PANDA, EXPTP_PANDA);
extern const bool text_flatten;
extern const bool text_update_cleared_glyphs;
extern const bool text_mipmap;
extern const int text_anisotropic_degree;
extern const int text_texture_margin;
extern const float text_poly_margin;
extern const int text_page_x_size;

View File

@ -50,7 +50,15 @@ DynamicTextPage(DynamicTextFont *font) :
// regenerate those every time the texture changes, but we do want
// at least linear filtering.
set_magfilter(FT_linear);
set_minfilter(FT_linear);
if (text_mipmap) {
set_minfilter(FT_linear_mipmap_linear);
} else {
set_minfilter(FT_linear);
}
// Anisotropic filtering can help the look of the text, and doesn't
// require generating mipmaps, but does require hardware support.
set_anisotropic_degree(text_anisotropic_degree);
// It's slightly better to let the texture clamp, rather than
// wrapping, so we're less likely to get bleeding at the edges.