shithub: cstory

Download patch

ref: 67b3143ed6269a281541381e9ef6dfb3289de853
parent: cf94736cbfb03e63753c60d0fd55fd8c6b90dddf
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Jul 31 21:26:04 EDT 2019

OpenGL: Only enable blending for glyphs

Should improve performance

--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -199,7 +199,6 @@
 	glEnable(GL_DEBUG_OUTPUT);
 	glDebugMessageCallback(MessageCallback, 0);
 
-	glEnable(GL_BLEND);
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
 	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
@@ -269,6 +268,8 @@
 {
 	glUseProgram(program_texture);
 
+	glDisable(GL_BLEND);
+
 	// Enable texture coordinates, since this uses textures
 	glEnableVertexAttribArray(2);
 
@@ -377,6 +378,8 @@
 	// Switch to colour-key shader if we have to
 	glUseProgram(colour_key ? program_texture_colour_key : program_texture);
 
+	glDisable(GL_BLEND);
+
 	// Enable texture coordinates, since this uses textures
 	glEnableVertexAttribArray(2);
 
@@ -438,6 +441,8 @@
 
 	glUseProgram(program_colour_fill);
 
+	glDisable(GL_BLEND);
+
 	// Disable texture coordinate array, since this doesn't use textures
 	glDisableVertexAttribArray(2);
 
@@ -567,6 +572,8 @@
 	glViewport(0, 0, surface->width, surface->height);
 
 	glUseProgram(program_glyph);
+
+	glEnable(GL_BLEND);
 
 	// Enable texture coordinates, since this uses textures
 	glEnableVertexAttribArray(2);