opengles1: keep cached texturing state correct.

This commit is contained in:
Ryan C. Gordon 2019-02-04 23:24:10 -05:00
parent 40a52ceef7
commit a609c03ac6
1 changed files with 11 additions and 0 deletions

View File

@ -391,6 +391,8 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w, renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
texture_h, 0, format, type, NULL); texture_h, 0, format, type, NULL);
renderdata->glDisable(GL_TEXTURE_2D); renderdata->glDisable(GL_TEXTURE_2D);
renderdata->drawstate.texture = texture;
renderdata->drawstate.texturing = SDL_FALSE;
result = renderdata->glGetError(); result = renderdata->glGetError();
if (result != GL_NO_ERROR) { if (result != GL_NO_ERROR) {
@ -454,6 +456,9 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
renderdata->glDisable(data->type); renderdata->glDisable(data->type);
SDL_free(blob); SDL_free(blob);
renderdata->drawstate.texture = texture;
renderdata->drawstate.texturing = SDL_FALSE;
if (renderdata->glGetError() != GL_NO_ERROR) { if (renderdata->glGetError() != GL_NO_ERROR) {
return SDL_SetError("Failed to update texture"); 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->glEnable(GL_TEXTURE_2D);
data->glBindTexture(texturedata->type, texturedata->texture); data->glBindTexture(texturedata->type, texturedata->texture);
data->drawstate.texture = texture;
data->drawstate.texturing = SDL_TRUE;
if (texw) { if (texw) {
*texw = (float)texturedata->texw; *texw = (float)texturedata->texw;
} }
@ -1077,6 +1085,9 @@ static int GLES_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
GLES_ActivateRenderer(renderer); GLES_ActivateRenderer(renderer);
data->glDisable(texturedata->type); data->glDisable(texturedata->type);
data->drawstate.texture = NULL;
data->drawstate.texturing = SDL_FALSE;
return 0; return 0;
} }