Remove GL_BLEND tampering. It's the caller application's responsibility to enable or disable blending.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
diff --git a/src/FTFont/FTBitmapFont.cpp b/src/FTFont/FTBitmapFont.cpp
index c8b8d0c..1bb774c 100644
--- a/src/FTFont/FTBitmapFont.cpp
+++ b/src/FTFont/FTBitmapFont.cpp
@@ -68,22 +68,16 @@ inline FTPoint FTBitmapFontImpl::RenderI(const T* string, const int len,
FTPoint position, FTPoint spacing,
int renderMode)
{
- // Protect GL_BLEND
- glPushAttrib(GL_COLOR_BUFFER_BIT);
-
// Protect glPixelStorei() calls (also in FTBitmapGlyphImpl::RenderImpl)
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glDisable(GL_BLEND);
-
FTPoint tmp = FTFontImpl::Render(string, len,
position, spacing, renderMode);
glPopClientAttrib();
- glPopAttrib();
return tmp;
}
diff --git a/src/FTFont/FTBufferFont.cpp b/src/FTFont/FTBufferFont.cpp
index 0e25777..73a875d 100644
--- a/src/FTFont/FTBufferFont.cpp
+++ b/src/FTFont/FTBufferFont.cpp
@@ -230,15 +230,13 @@ inline FTPoint FTBufferFontImpl::RenderI(const T* string, const int len,
int cacheIndex = -1;
bool inCache = false;
- // Protect blending functions, GL_BLEND and GL_TEXTURE_2D
+ // Protect blending functions and GL_TEXTURE_2D
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
// Protect glPixelStorei() calls
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
- glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
// Search whether the string is already in a texture we uploaded
for(int n = 0; n < BUFFER_CACHE_SIZE; n++)
diff --git a/src/FTFont/FTOutlineFont.cpp b/src/FTFont/FTOutlineFont.cpp
index 5cad183..0b21a1f 100644
--- a/src/FTFont/FTOutlineFont.cpp
+++ b/src/FTFont/FTOutlineFont.cpp
@@ -93,15 +93,13 @@ inline FTPoint FTOutlineFontImpl::RenderI(const T* string, const int len,
FTPoint position, FTPoint spacing,
int renderMode)
{
- // Protect GL_TEXTURE_2D, glHint(), GL_LINE_SMOOTH and blending functions
+ // Protect GL_TEXTURE_2D, glHint() and GL_LINE_SMOOTH
glPushAttrib(GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT
| GL_COLOR_BUFFER_BIT);
glDisable(GL_TEXTURE_2D);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
FTPoint tmp = FTFontImpl::Render(string, len,
position, spacing, renderMode);
diff --git a/src/FTFont/FTPixmapFont.cpp b/src/FTFont/FTPixmapFont.cpp
index 01e2f4e..0c11fd5 100644
--- a/src/FTFont/FTPixmapFont.cpp
+++ b/src/FTFont/FTPixmapFont.cpp
@@ -84,16 +84,12 @@ inline FTPoint FTPixmapFontImpl::RenderI(const T* string, const int len,
FTPoint position, FTPoint spacing,
int renderMode)
{
- // Protect GL_TEXTURE_2D and GL_BLEND, glPixelTransferf(), and blending
- // functions.
+ // Protect GL_TEXTURE_2D and glPixelTransferf()
glPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
// Protect glPixelStorei() calls (made by FTPixmapGlyphImpl::RenderImpl).
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
glDisable(GL_TEXTURE_2D);
GLfloat ftglColour[4];
diff --git a/src/FTFont/FTTextureFont.cpp b/src/FTFont/FTTextureFont.cpp
index fcae355..e7ba20b 100644
--- a/src/FTFont/FTTextureFont.cpp
+++ b/src/FTFont/FTTextureFont.cpp
@@ -231,12 +231,9 @@ inline FTPoint FTTextureFontImpl::RenderI(const T* string, const int len,
FTPoint position, FTPoint spacing,
int renderMode)
{
- // Protect GL_TEXTURE_2D, GL_BLEND and blending functions
+ // Protect GL_TEXTURE_2D
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
-
glEnable(GL_TEXTURE_2D);
FTTextureGlyphImpl::ResetActiveTexture();