Commit 778b8f21ba0b71289aef37e3422d008456445971

Frank Heckenbach 2019-05-24T23:58:47

src/FTFont/FTBufferFont.cpp, src/FTFont/FTTextureFont.cpp: GL_TEXTURE_ENV_MODE is not valid mask for glPushAttrib. Use GL_TEXTURE_BIT instead to avoid leaking texture env mode. (reported by Eddie-cz, https://github.com/frankheckenbach/ftgl/issues/3)

diff --git a/ChangeLog b/ChangeLog
index 10db810..0bb44b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-05-24 23:57  Frank Heckenbach <f.heckenbach@fh-soft.de>
+
+  * src/FTFont/FTBufferFont.cpp, src/FTFont/FTTextureFont.cpp:
+    GL_TEXTURE_ENV_MODE is not valid mask for glPushAttrib.
+    Use GL_TEXTURE_BIT instead to avoid leaking texture env mode.
+    (reported by Eddie-cz, https://github.com/frankheckenbach/ftgl/issues/3)
+
 2019-02-23 16:41  Frank Heckenbach <f.heckenbach@fh-soft.de>
 
   * ftgl-release: new script
diff --git a/src/FTFont/FTBufferFont.cpp b/src/FTFont/FTBufferFont.cpp
index ce04cf5..b330a3b 100644
--- a/src/FTFont/FTBufferFont.cpp
+++ b/src/FTFont/FTBufferFont.cpp
@@ -232,7 +232,7 @@ inline FTPoint FTBufferFontImpl::RenderI(const T* string, const int len,
     bool inCache = false;
 
     // Protect blending functions, GL_TEXTURE_2D and optionally GL_BLEND
-    glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT | GL_TEXTURE_ENV_MODE);
+    glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT);
 
     // Protect glPixelStorei() calls
     glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
diff --git a/src/FTFont/FTTextureFont.cpp b/src/FTFont/FTTextureFont.cpp
index 97e8768..a5145cf 100644
--- a/src/FTFont/FTTextureFont.cpp
+++ b/src/FTFont/FTTextureFont.cpp
@@ -241,7 +241,7 @@ inline FTPoint FTTextureFontImpl::RenderI(const T* string, const int len,
                                           int renderMode)
 {
     // Protect GL_TEXTURE_2D and optionally GL_BLEND
-    glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TEXTURE_ENV_MODE);
+    glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
 
     if(FTLibrary::Instance().GetLegacyOpenGLStateSet())
       {