Merge branch 'master' of https://git.redacted.cc/josh/JGL
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
#include <JGL/Color3.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user