From 79c241b0d9723a03009e873b9df2fea35654d1fc Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 16 Feb 2002 19:04:22 +0000 Subject: [PATCH] support mipmapping & anisotropic filtering --- panda/src/text/config_text.cxx | 2 ++ panda/src/text/config_text.h | 2 ++ panda/src/text/dynamicTextPage.cxx | 10 +++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/panda/src/text/config_text.cxx b/panda/src/text/config_text.cxx index 847faaa8b5..cc095f581e 100644 --- a/panda/src/text/config_text.cxx +++ b/panda/src/text/config_text.cxx @@ -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); diff --git a/panda/src/text/config_text.h b/panda/src/text/config_text.h index 0bff692018..69b7958aa4 100644 --- a/panda/src/text/config_text.h +++ b/panda/src/text/config_text.h @@ -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; diff --git a/panda/src/text/dynamicTextPage.cxx b/panda/src/text/dynamicTextPage.cxx index e7fe5cc050..5827a61d23 100644 --- a/panda/src/text/dynamicTextPage.cxx +++ b/panda/src/text/dynamicTextPage.cxx @@ -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.