shithub: cstory

Download patch

ref: 74c29dbe3c4be5dd1b36005df798770392fbab64
parent: 106827c2ee1bc636384e6f99bb6574795fa08010
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Jul 31 02:35:32 EDT 2019

Disable texture coordinates entirely when colour-filling

--- a/src/Backends/Rendering/OpenGL2.cpp
+++ b/src/Backends/Rendering/OpenGL2.cpp
@@ -169,7 +169,6 @@
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
 	glEnableClientState(GL_VERTEX_ARRAY);
-	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 	glVertexPointer(2, GL_FLOAT, 0, vertex_buffer);
 	glTexCoordPointer(2, GL_FLOAT, 0, texture_coordinate_buffer);
 
@@ -221,6 +220,8 @@
 {
 	glUseProgram(program_texture);
 
+	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
 	// Target actual screen, and not our framebuffer
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 
@@ -317,6 +318,8 @@
 	// Switch to colour-key shader if we have to
 	glUseProgram(colour_key ? program_texture_colour_key : program_texture);
 
+	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
 	glBindTexture(GL_TEXTURE_2D, source_surface->texture_id);
 
 	const GLfloat texture_left = (GLfloat)rect->left / (GLfloat)source_surface->width;
@@ -381,6 +384,8 @@
 
 	glUseProgram(program_colour_fill);
 
+	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+
 	glUniform4f(uniform_colour_fill_colour, red / 255.0f, green / 255.0f, blue / 255.0f, 1.0f);
 
 	const GLfloat vertex_left = (rect->left * (2.0f / surface->width)) - 1.0f;
@@ -516,6 +521,8 @@
 static void DrawGlyphCommon(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
 {
 	glUseProgram(program_glyph);
+
+	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
 	glBindTexture(GL_TEXTURE_2D, glyph->texture_id);