opengles1: keep cached texturing state correct.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 04 Feb 2019 23:24:10 -0500
changeset 12593307b9da13612
parent 12592 10722106b650
child 12594 89dbef84cdcb
opengles1: keep cached texturing state correct.
src/render/opengles/SDL_render_gles.c
     1.1 --- a/src/render/opengles/SDL_render_gles.c	Mon Feb 04 18:55:39 2019 -0500
     1.2 +++ b/src/render/opengles/SDL_render_gles.c	Mon Feb 04 23:24:10 2019 -0500
     1.3 @@ -391,6 +391,8 @@
     1.4      renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
     1.5                               texture_h, 0, format, type, NULL);
     1.6      renderdata->glDisable(GL_TEXTURE_2D);
     1.7 +    renderdata->drawstate.texture = texture;
     1.8 +    renderdata->drawstate.texturing = SDL_FALSE;
     1.9  
    1.10      result = renderdata->glGetError();
    1.11      if (result != GL_NO_ERROR) {
    1.12 @@ -454,6 +456,9 @@
    1.13      renderdata->glDisable(data->type);
    1.14      SDL_free(blob);
    1.15  
    1.16 +    renderdata->drawstate.texture = texture;
    1.17 +    renderdata->drawstate.texturing = SDL_FALSE;
    1.18 +
    1.19      if (renderdata->glGetError() != GL_NO_ERROR) {
    1.20          return SDL_SetError("Failed to update texture");
    1.21      }
    1.22 @@ -1060,6 +1065,9 @@
    1.23      data->glEnable(GL_TEXTURE_2D);
    1.24      data->glBindTexture(texturedata->type, texturedata->texture);
    1.25  
    1.26 +    data->drawstate.texture = texture;
    1.27 +    data->drawstate.texturing = SDL_TRUE;
    1.28 +
    1.29      if (texw) {
    1.30          *texw = (float)texturedata->texw;
    1.31      }
    1.32 @@ -1077,6 +1085,9 @@
    1.33      GLES_ActivateRenderer(renderer);
    1.34      data->glDisable(texturedata->type);
    1.35  
    1.36 +    data->drawstate.texture = NULL;
    1.37 +    data->drawstate.texturing = SDL_FALSE;
    1.38 +
    1.39      return 0;
    1.40  }
    1.41