Remove more redundant OpenGL code

This commit is contained in:
Clownacy 2019-07-31 23:43:08 +00:00
parent 607bbfcef8
commit 706aff0c8c

View file

@ -548,6 +548,13 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph)
static void DrawGlyphCommon(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
{
if (glyph == NULL || surface == NULL)
return;
// Point our framebuffer to the destination texture
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, surface->texture_id, 0);
glViewport(0, 0, surface->width, surface->height);
glUseProgram(program_glyph);
// Enable texture coordinates, since this uses textures
@ -586,25 +593,11 @@ static void DrawGlyphCommon(Backend_Surface *surface, Backend_Glyph *glyph, long
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
{
if (glyph == NULL || surface == NULL)
return;
// Point our framebuffer to the destination texture
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, surface->texture_id, 0);
glViewport(0, 0, surface->width, surface->height);
DrawGlyphCommon(surface, glyph, x, y, colours);
}
void Backend_DrawGlyphToScreen(Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
{
if (glyph == NULL)
return;
// Point our framebuffer to the screen texture
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebuffer_surface.texture_id, 0);
glViewport(0, 0, framebuffer_surface.width, framebuffer_surface.height);
DrawGlyphCommon(&framebuffer_surface, glyph, x, y, colours);
}