From 706aff0c8c9f6c518b88cb8d1ca875a0e7d05544 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Wed, 31 Jul 2019 23:43:08 +0000 Subject: [PATCH] Remove more redundant OpenGL code --- src/Backends/Rendering/OpenGL3.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Backends/Rendering/OpenGL3.cpp b/src/Backends/Rendering/OpenGL3.cpp index af5d5847..81c870f7 100644 --- a/src/Backends/Rendering/OpenGL3.cpp +++ b/src/Backends/Rendering/OpenGL3.cpp @@ -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); }