src/video/x11/SDL_x11window.c
changeset 7659 ac4ce59c40e7
parent 7632 d6a8fa507a45
child 7677 871d43c6968a
     1.1 --- a/src/video/x11/SDL_x11window.c	Mon Aug 19 11:02:44 2013 -0400
     1.2 +++ b/src/video/x11/SDL_x11window.c	Mon Aug 19 16:29:46 2013 -0300
     1.3 @@ -34,7 +34,7 @@
     1.4  #include "SDL_x11shape.h"
     1.5  #include "SDL_x11xinput2.h"
     1.6  
     1.7 -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
     1.8 +#if SDL_VIDEO_OPENGL_EGL
     1.9  #include "SDL_x11opengles.h"
    1.10  #endif
    1.11  
    1.12 @@ -363,11 +363,11 @@
    1.13      Atom XdndAware, xdnd_version = 5;
    1.14      Uint32 fevent = 0;
    1.15  
    1.16 -#if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
    1.17 +#if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL
    1.18      if (window->flags & SDL_WINDOW_OPENGL) {
    1.19          XVisualInfo *vinfo;
    1.20  
    1.21 -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
    1.22 +#if SDL_VIDEO_OPENGL_EGL
    1.23          if (_this->gl_config.use_egl == 1) {
    1.24              vinfo = X11_GLES_GetVisual(_this, display, screen);
    1.25          } else
    1.26 @@ -481,26 +481,6 @@
    1.27      if (!w) {
    1.28          return SDL_SetError("Couldn't create window");
    1.29      }
    1.30 -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
    1.31 -    if ((window->flags & SDL_WINDOW_OPENGL) && (_this->gl_config.use_egl == 1)) {
    1.32 -        if (!_this->gles_data) {
    1.33 -            XDestroyWindow(display, w);
    1.34 -            return -1;
    1.35 -        }
    1.36 -
    1.37 -        /* Create the GLES window surface */
    1.38 -        _this->gles_data->egl_surface =
    1.39 -            _this->gles_data->eglCreateWindowSurface(_this->gles_data->
    1.40 -                                                 egl_display,
    1.41 -                                                 _this->gles_data->egl_config,
    1.42 -                                                 (NativeWindowType) w, NULL);
    1.43 -
    1.44 -        if (_this->gles_data->egl_surface == EGL_NO_SURFACE) {
    1.45 -            XDestroyWindow(display, w);
    1.46 -            return SDL_SetError("Could not create GLES window surface");
    1.47 -        }
    1.48 -    }
    1.49 -#endif
    1.50  
    1.51      SetWindowBordered(display, screen, w,
    1.52                        (window->flags & SDL_WINDOW_BORDERLESS) == 0);
    1.53 @@ -568,6 +548,24 @@
    1.54          return -1;
    1.55      }
    1.56  
    1.57 +#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
    1.58 +    if ((window->flags & SDL_WINDOW_OPENGL) && (_this->gl_config.use_egl == 1)) {
    1.59 +        if (!_this->egl_data) {
    1.60 +            XDestroyWindow(display, w);
    1.61 +            return -1;
    1.62 +        }
    1.63 +
    1.64 +        /* Create the GLES window surface */
    1.65 +        ((SDL_WindowData *) window->driverdata)->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) w);
    1.66 +
    1.67 +        if (((SDL_WindowData *) window->driverdata)->egl_surface == EGL_NO_SURFACE) {
    1.68 +            XDestroyWindow(display, w);
    1.69 +            return SDL_SetError("Could not create GLES window surface");
    1.70 +        }
    1.71 +    }
    1.72 +#endif
    1.73 +    
    1.74 +
    1.75  #ifdef X_HAVE_UTF8_STRING
    1.76      if (SDL_X11_HAVE_UTF8) {
    1.77          pXGetICValues(((SDL_WindowData *) window->driverdata)->ic,