From 49df8ea371559bce76304af0af3becd9cd02bac3 Mon Sep 17 00:00:00 2001 From: Per Inge Mathisen Date: Sat, 27 Oct 2007 19:20:25 +0000 Subject: [PATCH] Use GLC_TEXTURE for font rendering. Patch by Bertrand Coconnier in bug #10188. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2646 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/ivis_common/textdraw.h | 11 ----------- lib/ivis_opengl/textdraw.c | 37 +++++++++++-------------------------- src/configuration.c | 13 ------------- 3 files changed, 11 insertions(+), 50 deletions(-) diff --git a/lib/ivis_common/textdraw.h b/lib/ivis_common/textdraw.h index dff45f809..99604435e 100644 --- a/lib/ivis_common/textdraw.h +++ b/lib/ivis_common/textdraw.h @@ -47,17 +47,6 @@ extern unsigned int iV_GetCharWidth(uint32_t charCode); extern unsigned int iV_GetTextHeight(const char* string); extern void iV_SetTextColour(SWORD Index); -/** Enable or disable anti-aliasing of text - * \param enable set this to true to enable anti-aliassing of text, - * set it to false to disable it. - */ -extern void iV_SetTextAntialias(bool enable); - -/** Find out if anti-aliasing of text is enabled or disabled - * \return true if anti-aliassing of text is enabled, false otherwise - */ -extern bool iV_TextAntialiased(void); - #define ASCII_SPACE (32) #define ASCII_NEWLINE ('@') #define ASCII_COLOURMODE ('#') diff --git a/lib/ivis_opengl/textdraw.c b/lib/ivis_opengl/textdraw.c index 0d3e2aa80..aeb65a5e6 100644 --- a/lib/ivis_opengl/textdraw.c +++ b/lib/ivis_opengl/textdraw.c @@ -45,8 +45,6 @@ static GLint GLC_Context = 0; static GLint GLC_Font_Regular = 0; static GLint GLC_Font_Bold = 0; -static bool anti_aliasing = true; - /***************************************************************************/ /* * Source @@ -103,7 +101,7 @@ static void iV_initializeGLC() glcContext(GLC_Context); glcDisable(GLC_AUTO_FONT); - glcRenderStyle(GLC_TRIANGLE); + glcRenderStyle(GLC_TEXTURE); GLC_Font_Regular = glcGenFontID(); GLC_Font_Bold = glcGenFontID(); @@ -180,16 +178,6 @@ void iV_TextShutdown() } } -void iV_SetTextAntialias(bool enable) -{ - anti_aliasing = enable; -} - -bool iV_TextAntialiased() -{ - return anti_aliasing; -} - void iV_SetFont(enum iV_fonts FontID) { switch (FontID) @@ -612,15 +600,15 @@ UDWORD iV_DrawFormattedText(const char* String, UDWORD x, UDWORD y, UDWORD Width void iV_DrawTextRotated(const char* string, float XPos, float YPos, float rotation) { + GLint matrix_mode = 0; + pie_SetTexturePage(-2); - // Enable Anti Aliasing if it's enabled - if (anti_aliasing) - { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - glEnable(GL_POLYGON_SMOOTH); - } + glGetIntegerv(GL_MATRIX_MODE, &matrix_mode); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode(matrix_mode); if (rotation != 0.f) { @@ -638,12 +626,9 @@ void iV_DrawTextRotated(const char* string, float XPos, float YPos, float rotati glcRenderString(string); glFrontFace(GL_CCW); - // Turn off anti aliasing (if we enabled it above) - if (anti_aliasing) - { - glDisable(GL_BLEND); - glDisable(GL_POLYGON_SMOOTH); - } + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(matrix_mode); // Reset the current model view matrix glLoadIdentity(); diff --git a/src/configuration.c b/src/configuration.c index 4dac74856..814827dbc 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -33,7 +33,6 @@ #include "lib/sound/track.h" // audio #include "lib/sound/cdaudio.h" // audio #include "lib/ivis_common/piestate.h" // setgamma. -#include "lib/ivis_common/textdraw.h" // text-antialiassing #include "warzoneconfig.h" // renderMode #include "component.h" #include "text.h" @@ -517,16 +516,6 @@ BOOL loadConfig(void) setWarzoneKeyNumeric("radarTerrainMode", radarDrawMode); } - if (getWarzoneKeyNumeric("text-antialiassing", &val)) - { - iV_SetTextAntialias(val); - } - else - { - iV_SetTextAntialias(true); - setWarzoneKeyNumeric("text-antialiassing", true); - } - return closeWarzoneKey(); } @@ -633,8 +622,6 @@ BOOL saveConfig(void) setWarzoneKeyString("phrase4", ingame.phrases[4]); } - setWarzoneKeyNumeric("text-antialiassing", iV_TextAntialiased()); - return closeWarzoneKey(); }