Skip to content
Permalink
Browse files

opengles1: keep cached texturing state correct.

  • Loading branch information
icculus committed Feb 5, 2019
1 parent 40a52ce commit a609c03ac6ca55a4d7ebf5ee7cf34e29972b863c
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/render/opengles/SDL_render_gles.c
@@ -391,6 +391,8 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
texture_h, 0, format, type, NULL);
renderdata->glDisable(GL_TEXTURE_2D);
renderdata->drawstate.texture = texture;
renderdata->drawstate.texturing = SDL_FALSE;

result = renderdata->glGetError();
if (result != GL_NO_ERROR) {
@@ -454,6 +456,9 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
renderdata->glDisable(data->type);
SDL_free(blob);

renderdata->drawstate.texture = texture;
renderdata->drawstate.texturing = SDL_FALSE;

if (renderdata->glGetError() != GL_NO_ERROR) {
return SDL_SetError("Failed to update texture");
}
@@ -1060,6 +1065,9 @@ static int GLES_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, floa
data->glEnable(GL_TEXTURE_2D);
data->glBindTexture(texturedata->type, texturedata->texture);

data->drawstate.texture = texture;
data->drawstate.texturing = SDL_TRUE;

if (texw) {
*texw = (float)texturedata->texw;
}
@@ -1077,6 +1085,9 @@ static int GLES_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
GLES_ActivateRenderer(renderer);
data->glDisable(texturedata->type);

data->drawstate.texture = NULL;
data->drawstate.texturing = SDL_FALSE;

return 0;
}

0 comments on commit a609c03

Please sign in to comment.