Fixed bug 2579 - SDL fails to compile on Windows when only EGL+OpenGL ES defined
authorSam Lantinga <slouken@libsdl.org>
Sun, 22 Jun 2014 09:48:46 -0700
changeset 89088333acde0b91
parent 8907 e4c67eb79af8
child 8909 a894224dc538
Fixed bug 2579 - SDL fails to compile on Windows when only EGL+OpenGL ES defined

callow.mark

Compiling with SDL_VIDEO_RENDER_OGL=0, SDL_VIDEO_OPENGL=0, SDL_VIDEO_OPENGL_WGL=0, SDL_VIDEO_RENDER_OGL_ES2=1, SDL_VIDEO_OPENGL_ES2=1 and SDL_VIDEO_OPENGL_EGL=1 set in SDL_config_windows.h fails.

A patch is attached. See bug #2570 for reasons you might want to compile this way.
src/video/windows/SDL_windowsopengles.c
src/video/windows/SDL_windowsvideo.c
     1.1 --- a/src/video/windows/SDL_windowsopengles.c	Sun Jun 22 09:42:43 2014 -0700
     1.2 +++ b/src/video/windows/SDL_windowsopengles.c	Sun Jun 22 09:48:46 2014 -0700
     1.3 @@ -64,6 +64,7 @@
     1.4      SDL_GLContext context;
     1.5      SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
     1.6  
     1.7 +#if SDL_VIDEO_OPENGL_WGL
     1.8      if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
     1.9          /* Switch to WGL based functions */
    1.10          WIN_GLES_UnloadLibrary(_this);
    1.11 @@ -83,6 +84,7 @@
    1.12  
    1.13          return WIN_GL_CreateContext(_this, window);
    1.14      }
    1.15 +#endif
    1.16  
    1.17      context = SDL_EGL_CreateContext(_this, data->egl_surface);
    1.18      return context;
     2.1 --- a/src/video/windows/SDL_windowsvideo.c	Sun Jun 22 09:42:43 2014 -0700
     2.2 +++ b/src/video/windows/SDL_windowsvideo.c	Sun Jun 22 09:48:46 2014 -0700
     2.3 @@ -159,6 +159,17 @@
     2.4      device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
     2.5      device->GL_SwapWindow = WIN_GL_SwapWindow;
     2.6      device->GL_DeleteContext = WIN_GL_DeleteContext;
     2.7 +#elif SDL_VIDEO_OPENGL_EGL        
     2.8 +    /* Use EGL based functions */
     2.9 +    device->GL_LoadLibrary = WIN_GLES_LoadLibrary;
    2.10 +    device->GL_GetProcAddress = WIN_GLES_GetProcAddress;
    2.11 +    device->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
    2.12 +    device->GL_CreateContext = WIN_GLES_CreateContext;
    2.13 +    device->GL_MakeCurrent = WIN_GLES_MakeCurrent;
    2.14 +    device->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
    2.15 +    device->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
    2.16 +    device->GL_SwapWindow = WIN_GLES_SwapWindow;
    2.17 +    device->GL_DeleteContext = WIN_GLES_DeleteContext;
    2.18  #endif
    2.19      device->StartTextInput = WIN_StartTextInput;
    2.20      device->StopTextInput = WIN_StopTextInput;