OpenGL: Only enable blending for glyphs

Should improve performance
This commit is contained in:
Clownacy 2019-08-01 01:26:04 +00:00
parent cf94736cbf
commit 67b3143ed6

View file

@ -199,7 +199,6 @@ BOOL Backend_Init(SDL_Window *p_window)
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 @@ void Backend_DrawScreen(void)
{
glUseProgram(program_texture);
glDisable(GL_BLEND);
// Enable texture coordinates, since this uses textures
glEnableVertexAttribArray(2);
@ -377,6 +378,8 @@ static void BlitCommon(Backend_Surface *source_surface, const RECT *rect, Backen
// 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 @@ static void ColourFillCommon(Backend_Surface *surface, const RECT *rect, unsigne
glUseProgram(program_colour_fill);
glDisable(GL_BLEND);
// Disable texture coordinate array, since this doesn't use textures
glDisableVertexAttribArray(2);
@ -568,6 +573,8 @@ static void DrawGlyphCommon(Backend_Surface *surface, Backend_Glyph *glyph, long
glUseProgram(program_glyph);
glEnable(GL_BLEND);
// Enable texture coordinates, since this uses textures
glEnableVertexAttribArray(2);