| Summary: | Regression: cannot create GLES2 context on Android since 2.0.1 | ||
|---|---|---|---|
| Product: | SDL | Reporter: | dnschneid |
| Component: | video | Assignee: | Gabriel Jacobo <gabomdq> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
Can you add SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); before creating the context and let me know if that solves the problem? Thanks! Sorry for the delay. Updated to latest mercurial and tried both with and without setting the profile mask; still fails to create the context. eglGetError returns EGL_BAD_CONFIG after the eglCreateContext call, so it's definitely taking the EGL codepath; it's just not initializing something in the same way as it used to in the Java code. I just tested on my Nexus 7 and it works fine, so it's either due to 4.1.2 or something with Spyder. But the old SDL 2.0.0 java-based initialization code worked... Random observation: SDL_EGL_LoadLibrary ignores the return value of SDL_EGL_ChooseConfig; shouldn't it pass it up? (changing this did not change the point of failure) I can't find any significant differences with the java version, unless one of the EGL10 functions isn't just a dumb wrapper. Some basic behavior matching vs. the old java code, like always prividing default values for the config attributes doesn't help. Not that I fully understand both sources, so I'm sure I'm overlooking the subtle difference that causes the issue at hand. Can you give testrendercopyex a try? There's a handy script in build-scripts/androidbuild.sh to make this easy to try, you just need to remember to copy the test/sample.bmp file manually into the Android assets folder before building the apk. SDL_EGL_ChooseConfig return value being ignored is fixed here: https://hg.libsdl.org/SDL/rev/ffb7bf531644 I updated the SDL_EGL_ChooseConfig to match what the old Java code used to do in terms of finding the best config available. Let me know if this helps. That seems to have done the trick! Latest hg works fine. Thanks for tracking this down. |
Since upgrading to SDL 2.0.1 (confirmed still to be an issue in mercurial), creating a GLES2 context on Android 4.1.2 (Spyder) is broken. The following code (error handling removed) worked in 2.0.0: SDL_InitSubSystem(SDL_INIT_VIDEO); _window = SDL_CreateWindow(PROJ_NAME, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, _width, _height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); _context = SDL_GL_CreateContext(_window); In 2.0.1/mercurial, _context returns NULL, and eglGetError returns EGL_BAD_CONFIG after the eglCreateContext call in the implementation.