More OpenGL ES fixes from Scott Percival
authorSam Lantinga <slouken@libsdl.org>
Thu, 19 Jul 2012 09:36:58 -0700
changeset 6373494e0436525f
parent 6372 76d0f2cf2ca6
child 6374 d4ed97e63c22
More OpenGL ES fixes from Scott Percival
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11opengles.c
src/video/x11/SDL_x11window.c
     1.1 --- a/src/video/x11/SDL_x11opengl.c	Wed Jul 18 15:53:33 2012 -0700
     1.2 +++ b/src/video/x11/SDL_x11opengl.c	Thu Jul 19 09:36:58 2012 -0700
     1.3 @@ -128,9 +128,9 @@
     1.4          return -1;
     1.5      }
     1.6  
     1.7 -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
     1.8      /* If SDL_GL_CONTEXT_EGL has been changed to 1, switch over to X11_GLES functions  */
     1.9      if (_this->gl_config.use_egl == 1) {
    1.10 +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
    1.11          _this->GL_LoadLibrary = X11_GLES_LoadLibrary;
    1.12          _this->GL_GetProcAddress = X11_GLES_GetProcAddress;
    1.13          _this->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
    1.14 @@ -141,8 +141,11 @@
    1.15          _this->GL_SwapWindow = X11_GLES_SwapWindow;
    1.16          _this->GL_DeleteContext = X11_GLES_DeleteContext;
    1.17          return X11_GLES_LoadLibrary(_this, path);
    1.18 +#else
    1.19 +        SDL_SetError("SDL not configured with OpenGL ES/EGL support");
    1.20 +        return -1;
    1.21 +#endif
    1.22      }
    1.23 -#endif
    1.24  
    1.25  
    1.26      /* Load the OpenGL library */
     2.1 --- a/src/video/x11/SDL_x11opengles.c	Wed Jul 18 15:53:33 2012 -0700
     2.2 +++ b/src/video/x11/SDL_x11opengles.c	Thu Jul 19 09:36:58 2012 -0700
     2.3 @@ -99,9 +99,9 @@
     2.4          return -1;
     2.5      }
     2.6  
     2.7 -#if SDL_VIDEO_OPENGL_GLX
     2.8      /* If SDL_GL_CONTEXT_EGL has been changed to 0, switch over to X11_GL functions  */
     2.9      if (_this->gl_config.use_egl == 0) {
    2.10 +#if SDL_VIDEO_OPENGL_GLX
    2.11          _this->GL_LoadLibrary = X11_GL_LoadLibrary;
    2.12          _this->GL_GetProcAddress = X11_GL_GetProcAddress;
    2.13          _this->GL_UnloadLibrary = X11_GL_UnloadLibrary;
    2.14 @@ -112,8 +112,11 @@
    2.15          _this->GL_SwapWindow = X11_GL_SwapWindow;
    2.16          _this->GL_DeleteContext = X11_GL_DeleteContext;
    2.17          return X11_GL_LoadLibrary(_this, path);
    2.18 +#else
    2.19 +        SDL_SetError("SDL not configured with OpenGL/GLX support");
    2.20 +        return -1;
    2.21 +#endif
    2.22      }
    2.23 -#endif
    2.24  
    2.25  #ifdef RTLD_GLOBAL
    2.26      dlopen_flags = RTLD_LAZY | RTLD_GLOBAL;
     3.1 --- a/src/video/x11/SDL_x11window.c	Wed Jul 18 15:53:33 2012 -0700
     3.2 +++ b/src/video/x11/SDL_x11window.c	Thu Jul 19 09:36:58 2012 -0700
     3.3 @@ -391,7 +391,12 @@
     3.4          return -1;
     3.5      }
     3.6  #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
     3.7 -    if (window->flags & SDL_WINDOW_OPENGL) {
     3.8 +    if ((window->flags & SDL_WINDOW_OPENGL) && (_this->gl_config.use_egl == 1)) {
     3.9 +        if (!_this->gles_data) {
    3.10 +            XDestroyWindow(display, w);
    3.11 +            return -1;
    3.12 +        }
    3.13 +
    3.14          /* Create the GLES window surface */
    3.15          _this->gles_data->egl_surface =
    3.16              _this->gles_data->eglCreateWindowSurface(_this->gles_data->
    3.17 @@ -401,6 +406,7 @@
    3.18  
    3.19          if (_this->gles_data->egl_surface == EGL_NO_SURFACE) {
    3.20              SDL_SetError("Could not create GLES window surface");
    3.21 +            XDestroyWindow(display, w);
    3.22              return -1;
    3.23          }
    3.24      }