From 099349cafdc7be33a4da40871f42b031af9cfe17 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 5 Sep 2018 15:41:40 +0200 Subject: [PATCH] with CAP_FONT text works better on white background --- basegraph.cpp | 15 ++++----------- nofont.cpp | 4 ++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/basegraph.cpp b/basegraph.cpp index bb349394..f06a2442 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -335,11 +335,7 @@ struct glfont_t { glfont_t *glfont[256]; -#if CAP_TABFONT -typedef int texturepixel; -#else typedef Uint16 texturepixel; -#endif #define FONTTEXTURESIZE 2048 @@ -349,7 +345,8 @@ texturepixel fontdata[FONTTEXTURESIZE][FONTTEXTURESIZE]; void sdltogl(SDL_Surface *txt, glfont_t& f, int ch) { #if CAP_TABFONT if(ch < 32) return; - int otwidth, otheight, tpix[3000], tpixindex = 0; + int otwidth, otheight, tpixindex = 0; + unsigned char tpix[3000]; loadCompressedChar(otwidth, otheight, tpix); #else if(!txt) return; @@ -364,7 +361,7 @@ void sdltogl(SDL_Surface *txt, glfont_t& f, int ch) { for(int j=0; j=otwidth || j>=otheight) ? 0 : tpix[tpixindex++]; + (i>=otwidth || j>=otheight) ? 0 : (tpix[tpixindex++] * 0x100) | 0xFF; #else ((i>=txt->w || j>=txt->h) ? 0 : ((qpixel(txt, i, j)>>24)&0xFF) * 0x100) | 0x00FF; #endif @@ -442,12 +439,8 @@ void init_glfont(int size) { theight = next_p2(cury + theight); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, FONTTEXTURESIZE, theight, 0, -#if CAP_TABFONT - GL_RGBA, GL_UNSIGNED_BYTE, -#else + glTexImage2D( GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, FONTTEXTURESIZE, theight, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, -#endif fontdata); for(int ch=0; ch