render: Fix OpenGL draw state cache for various points of texture binding.
parent
670f3d3327
commit
40a52ceef7
|
@ -443,6 +443,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
|
|
||||||
GL_ActivateRenderer(renderer);
|
GL_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
renderdata->drawstate.texture = NULL; /* we trash this state. */
|
||||||
|
|
||||||
if (texture->access == SDL_TEXTUREACCESS_TARGET &&
|
if (texture->access == SDL_TEXTUREACCESS_TARGET &&
|
||||||
!renderdata->GL_EXT_framebuffer_object_supported) {
|
!renderdata->GL_EXT_framebuffer_object_supported) {
|
||||||
return SDL_SetError("Render targets not supported by OpenGL");
|
return SDL_SetError("Render targets not supported by OpenGL");
|
||||||
|
@ -641,6 +643,8 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
|
|
||||||
GL_ActivateRenderer(renderer);
|
GL_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
renderdata->drawstate.texture = NULL; /* we trash this state. */
|
||||||
|
|
||||||
renderdata->glEnable(textype);
|
renderdata->glEnable(textype);
|
||||||
renderdata->glBindTexture(textype, data->texture);
|
renderdata->glBindTexture(textype, data->texture);
|
||||||
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
@ -702,6 +706,8 @@ GL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
|
|
||||||
GL_ActivateRenderer(renderer);
|
GL_ActivateRenderer(renderer);
|
||||||
|
|
||||||
|
renderdata->drawstate.texture = NULL; /* we trash this state. */
|
||||||
|
|
||||||
renderdata->glEnable(textype);
|
renderdata->glEnable(textype);
|
||||||
renderdata->glBindTexture(textype, data->texture);
|
renderdata->glBindTexture(textype, data->texture);
|
||||||
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
@ -1469,6 +1475,9 @@ GL_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, floa
|
||||||
}
|
}
|
||||||
data->glBindTexture(textype, texturedata->texture);
|
data->glBindTexture(textype, texturedata->texture);
|
||||||
|
|
||||||
|
data->drawstate.texturing = SDL_TRUE;
|
||||||
|
data->drawstate.texture = texture;
|
||||||
|
|
||||||
if(texw) *texw = (float)texturedata->texw;
|
if(texw) *texw = (float)texturedata->texw;
|
||||||
if(texh) *texh = (float)texturedata->texh;
|
if(texh) *texh = (float)texturedata->texh;
|
||||||
|
|
||||||
|
@ -1496,6 +1505,9 @@ GL_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
|
||||||
|
|
||||||
data->glDisable(textype);
|
data->glDisable(textype);
|
||||||
|
|
||||||
|
data->drawstate.texturing = SDL_FALSE;
|
||||||
|
data->drawstate.texture = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue