diff --git a/src/JGL/JGL.cpp b/src/JGL/JGL.cpp index 327b8d5..52ac27e 100644 --- a/src/JGL/JGL.cpp +++ b/src/JGL/JGL.cpp @@ -10,7 +10,6 @@ #include #include - GLuint program; namespace JGL @@ -148,6 +147,10 @@ namespace JGL void DrawString2D(const Color3& color, std::string text, float x, float y, float scale, u32 size) { glUseProgram(0); // Fixed-function pipeline. + + GLfloat currentColor[4]; + glGetFloatv(GL_CURRENT_COLOR, currentColor); + glColor3f(color.r/255.f, color.g/255.f, color.b/255.f); FT_Set_Pixel_Sizes(face, 0, size); @@ -159,8 +162,10 @@ namespace JGL continue; FT_GlyphSlot g = face->glyph; - + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glActiveTexture(GL_TEXTURE0); + glEnable(GL_TEXTURE_2D); glGenTextures(1, &textures[i]); glBindTexture(GL_TEXTURE_2D, textures[i]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -203,7 +208,11 @@ namespace JGL } for (auto& t : textures) glDeleteTextures(1, &t); + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, 0); // Unbind texture + glColor4f(currentColor[0], currentColor[1], currentColor[2], currentColor[3]); //Set draw color back to whatever it was before. } }