| Summary: | SDL_Renderer is sometimes replacing a texture by another | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sylvain <sylvain.becker> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | amaranth72 |
| Version: | don't know | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
test-case
test-case opengles 1 |
||
|
Description
Sylvain
2018-12-20 15:25:37 UTC
Created attachment 3554 [details]
test-case
test case.
(but no patch ..)
Thanks for the easy repro. I believe it's fixed as of https://hg.libsdl.org/SDL/rev/fbce19db4e53 , but post again if it still happens on a particular platform. Hi, thanks a lot as it indeed fixes the issue on GL and GLES2 ! I looked at the opengles 1 renderer, and it suffers the same issue so I re-opened. Probably the same fix, but I believe there is also some strangeness On my side, I don't even get anything renders (all remains black on Linux and Android), unless I add (on Linux): data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); (https://hg.libsdl.org/SDL/rev/48b40c223503 ) What is strange is SDL 2.0.8 doesn't have this call, but it displays correctly. On opengles 1. I am not sure what needs to be fixed, but I also need to call "glEnable(GL_TEXTURE_2D)" before "glBindTexture()" in SetCopyState() Opengles 1: Black texture issue (which would be also solved glTexEnvf) is fixed with using the correct colour: https://hg.libsdl.org/SDL/rev/06031bc24165 I also apply the same fix as in opengl and opengles2 (it solves this issue too): https://hg.libsdl.org/SDL/rev/c3bc7d1f4179 Still have a glitch with opengles 1. Solved (workaround?) by calling "glEnable(GL_TEXTURE_2D)" before "glBindTexture()" in SetCopyState() Created attachment 3556 [details]
test-case opengles 1
Test-case for opengles 1. At first, it draws correctly, then textures turn white.
A patch would be:
--- a/src/render/opengles/SDL_render_gles.c Sat Dec 29 17:59:34 2018 +0100
+++ b/src/render/opengles/SDL_render_gles.c Sat Dec 29 21:56:27 2018 +0100
@@ -795,6 +795,7 @@
if (texture != data->drawstate.texture) {
GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
+ data->glEnable(GL_TEXTURE_2D);
data->glBindTexture(GL_TEXTURE_2D, texturedata->texture);
data->drawstate.texture = texture;
}
What do you think ?
This fix looks reasonable to me.. Ryan? |