emscripten: Fixed compiling without OpenGL support.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 05 Aug 2017 22:10:48 +0200
changeset 11191c3b94a174d81
parent 11190 478630f6b756
child 11192 3c8377f1a323
emscripten: Fixed compiling without OpenGL support.
src/video/emscripten/SDL_emscriptenvideo.c
src/video/emscripten/SDL_emscriptenvideo.h
     1.1 --- a/src/video/emscripten/SDL_emscriptenvideo.c	Sat Aug 05 22:10:36 2017 +0200
     1.2 +++ b/src/video/emscripten/SDL_emscriptenvideo.c	Sat Aug 05 22:10:48 2017 +0200
     1.3 @@ -111,6 +111,7 @@
     1.4      device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer;
     1.5      device->DestroyWindowFramebuffer = Emscripten_DestroyWindowFramebuffer;
     1.6  
     1.7 +#if SDL_VIDEO_OPENGL_EGL
     1.8      device->GL_LoadLibrary = Emscripten_GLES_LoadLibrary;
     1.9      device->GL_GetProcAddress = Emscripten_GLES_GetProcAddress;
    1.10      device->GL_UnloadLibrary = Emscripten_GLES_UnloadLibrary;
    1.11 @@ -121,6 +122,7 @@
    1.12      device->GL_SwapWindow = Emscripten_GLES_SwapWindow;
    1.13      device->GL_DeleteContext = Emscripten_GLES_DeleteContext;
    1.14      device->GL_GetDrawableSize = Emscripten_GLES_GetDrawableSize;
    1.15 +#endif
    1.16  
    1.17      device->free = Emscripten_DeleteDevice;
    1.18  
    1.19 @@ -228,6 +230,7 @@
    1.20          }
    1.21      }
    1.22  
    1.23 +#if SDL_VIDEO_OPENGL_EGL
    1.24      if (window->flags & SDL_WINDOW_OPENGL) {
    1.25          if (!_this->egl_data) {
    1.26              if (SDL_GL_LoadLibrary(NULL) < 0) {
    1.27 @@ -240,6 +243,7 @@
    1.28              return SDL_SetError("Could not create GLES window surface");
    1.29          }
    1.30      }
    1.31 +#endif
    1.32  
    1.33      wdata->window = window;
    1.34  
    1.35 @@ -284,10 +288,12 @@
    1.36          data = (SDL_WindowData *) window->driverdata;
    1.37  
    1.38          Emscripten_UnregisterEventHandlers(data);
    1.39 +#if SDL_VIDEO_OPENGL_EGL
    1.40          if (data->egl_surface != EGL_NO_SURFACE) {
    1.41              SDL_EGL_DestroySurface(_this, data->egl_surface);
    1.42              data->egl_surface = EGL_NO_SURFACE;
    1.43          }
    1.44 +#endif
    1.45          SDL_free(window->driverdata);
    1.46          window->driverdata = NULL;
    1.47      }
     2.1 --- a/src/video/emscripten/SDL_emscriptenvideo.h	Sat Aug 05 22:10:36 2017 +0200
     2.2 +++ b/src/video/emscripten/SDL_emscriptenvideo.h	Sat Aug 05 22:10:48 2017 +0200
     2.3 @@ -28,7 +28,9 @@
     2.4  #include <emscripten/emscripten.h>
     2.5  #include <emscripten/html5.h>
     2.6  
     2.7 +#if SDL_VIDEO_OPENGL_EGL
     2.8  #include <EGL/egl.h>
     2.9 +#endif
    2.10  
    2.11  typedef struct SDL_WindowData
    2.12  {