| Summary: | opengles2 renderer creation fails with "Could not create EGL context" on Android | ||
|---|---|---|---|
| Product: | SDL | Reporter: | carniblood <carniblood> |
| Component: | video | Assignee: | Gabriel Jacobo <gabomdq> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | gabomdq |
| Version: | HG 2.1 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
| Attachments: | attempt to fix opengles renderer (for reference) | ||
|
Description
carniblood
2013-12-15 22:18:33 UTC
I added the missing define here: http://hg.libsdl.org/SDL/rev/ac809ea54d63 Regarding the first point, I'm afraid the only fix I can offer is maybe an update in the documentation stating this requirement more clearly. To create the EGL surface attached to the window we have to know the type and version of context that will be used, that means that SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION and SDL_GL_CONTEXT_PROFILE_MASK have to be set before the window is created. How does that sound? Created attachment 1500 [details]
attempt to fix opengles renderer (for reference)
Thanks. So that's means what I thought was a workaround was actually the right way to force opengles version. That's good. But I think, if I'm not mistaken, there is still one case where there can be a problem: if opengles2 renderer creation fails for any reason, SDL will be unable to create opengles renderer as a second choice. What about checking for current SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION and SDL_GL_CONTEXT_PROFILE_MASK in GLES2_CreateRenderer() and GLES_CreateRenderer() and recreate the window if it doesn't match (in a similar way with the check for SDL_WINDOW_OPENGL flag)? I put a patch in attachment for reference. I tried it and it seems to work, but maybe it causes some problems if the user actually set manually one of these values? I'm not sure about it. I also tried on Windows platform, and with this patch the window is always recreated on renderer creation, since the default GL values are set for opengl renderer, not opengles. But this means Windows implementation differs with Android one, and doesn't need the right type and version before renderer creation? Anyway if it cause too many undesirable side effects, it would be still possible to fix it on user side, if I manually recreate the windows with a different context version to try to create another renderer, but it would be nice if it can be handled on sdl side. |