We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2583

Summary: "ERROR: Failed loading eglChooseConfig" message when using opengles2 with windows+ANGLE
Product: SDL Reporter: gdecarp
Component: videoAssignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.3   
Hardware: x86   
OS: Windows 7   

Description gdecarp 2014-06-13 13:01:06 UTC
DESCRIPTION:
When running the opengles2 driver on windows with ANGLE (and using at an error+ logging priority), i get the following dumped message when calling SDL_CreateWindow() with SDL_WINDOW_OPENGL enabled (and at a later point when i try to use SDL_CreateWindow() without SDL_WINDOW_OPENGL):

"ERROR: Failed loading eglChooseConfig: The specified procedure could not be found."


MINIMAL REPRO CODE (again, on windows using ANGLE):
SDL_Init(SDL_INIT_VIDEO);
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengles2");
SDL_GL_SetAttribute(SDL_GL_CONTEXT_EGL, 1);
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_ERROR);
SDL_CreateWindow("Window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);

FIX:
The issue is caused by the call to SDL_LoadFunction() with an invalid parameter (a null dll_handle) in SDL_EGL_LoadLibrary() in SDL_egl.c. 
 
One possible fix is to change line 185 in SDL_egl.c from:

 if (SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {

to:

 if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) {
Comment 1 Sam Lantinga 2014-06-16 00:19:54 UTC
Gabriel, can you verify that this is the correct fix?

Thanks!
Comment 2 Gabriel Jacobo 2014-06-16 12:48:13 UTC
Fixed, thanks!