Disable texture coordinates entirely when colour-filling

This commit is contained in:
Clownacy 2019-07-31 06:35:32 +00:00
parent 106827c2ee
commit 74c29dbe3c

View file

@ -169,7 +169,6 @@ BOOL Backend_Init(SDL_Window *p_window)
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 @@ void Backend_DrawScreen(void)
{
glUseProgram(program_texture);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// Target actual screen, and not our framebuffer
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
@ -317,6 +318,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);
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 @@ static void ColourFillCommon(Backend_Surface *surface, const RECT *rect, unsigne
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;
@ -517,6 +522,8 @@ static void DrawGlyphCommon(Backend_Surface *surface, Backend_Glyph *glyph, long
{
glUseProgram(program_glyph);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glBindTexture(GL_TEXTURE_2D, glyph->texture_id);
const GLfloat vertex_left = (x * (2.0f / surface->width)) - 1.0f;