src/video/SDL_egl.c
changeset 8971 c30e826412d1
parent 8966 5771ab3290d6
child 8976 1a5d959d7b32
     1.1 --- a/src/video/SDL_egl.c	Thu Jul 03 10:22:26 2014 -0700
     1.2 +++ b/src/video/SDL_egl.c	Thu Jul 03 17:36:08 2014 -0300
     1.3 @@ -449,7 +449,7 @@
     1.4          else {
     1.5              context_attrib_list[0] = EGL_NONE;
     1.6          }
     1.7 -#else /* EGL_KHR_create_context*/
     1.8 +#else /* EGL_KHR_create_context */
     1.9          context_attrib_list[0] = EGL_NONE;
    1.10  #endif /* EGL_KHR_create_context */
    1.11          egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
    1.12 @@ -552,10 +552,23 @@
    1.13  EGLSurface *
    1.14  SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) 
    1.15  {
    1.16 +    EGLint format;
    1.17 +    
    1.18      if (SDL_EGL_ChooseConfig(_this) != 0) {
    1.19          return EGL_NO_SURFACE;
    1.20      }
    1.21      
    1.22 +#if __ANDROID__
    1.23 +    /* Android docs recommend doing this!
    1.24 +     * Ref: http://developer.android.com/reference/android/app/NativeActivity.html 
    1.25 +     */
    1.26 +    _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
    1.27 +                                        _this->egl_data->egl_config, 
    1.28 +                                        EGL_NATIVE_VISUAL_ID, &format);
    1.29 +
    1.30 +    ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
    1.31 +#endif    
    1.32 +    
    1.33      return _this->egl_data->eglCreateWindowSurface(
    1.34              _this->egl_data->egl_display,
    1.35              _this->egl_data->egl_config,