src/video/SDL_egl.c
changeset 8971 c30e826412d1
parent 8966 5771ab3290d6
child 8976 1a5d959d7b32
equal deleted inserted replaced
8970:c566c1634307 8971:c30e826412d1
   447             }
   447             }
   448         }
   448         }
   449         else {
   449         else {
   450             context_attrib_list[0] = EGL_NONE;
   450             context_attrib_list[0] = EGL_NONE;
   451         }
   451         }
   452 #else /* EGL_KHR_create_context*/
   452 #else /* EGL_KHR_create_context */
   453         context_attrib_list[0] = EGL_NONE;
   453         context_attrib_list[0] = EGL_NONE;
   454 #endif /* EGL_KHR_create_context */
   454 #endif /* EGL_KHR_create_context */
   455         egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
   455         egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
   456                                           _this->egl_data->egl_config,
   456                                           _this->egl_data->egl_config,
   457                                           share_context, context_attrib_list);
   457                                           share_context, context_attrib_list);
   550 }
   550 }
   551 
   551 
   552 EGLSurface *
   552 EGLSurface *
   553 SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) 
   553 SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) 
   554 {
   554 {
       
   555     EGLint format;
       
   556     
   555     if (SDL_EGL_ChooseConfig(_this) != 0) {
   557     if (SDL_EGL_ChooseConfig(_this) != 0) {
   556         return EGL_NO_SURFACE;
   558         return EGL_NO_SURFACE;
   557     }
   559     }
       
   560     
       
   561 #if __ANDROID__
       
   562     /* Android docs recommend doing this!
       
   563      * Ref: http://developer.android.com/reference/android/app/NativeActivity.html 
       
   564      */
       
   565     _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
       
   566                                         _this->egl_data->egl_config, 
       
   567                                         EGL_NATIVE_VISUAL_ID, &format);
       
   568 
       
   569     ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
       
   570 #endif    
   558     
   571     
   559     return _this->egl_data->eglCreateWindowSurface(
   572     return _this->egl_data->eglCreateWindowSurface(
   560             _this->egl_data->egl_display,
   573             _this->egl_data->egl_display,
   561             _this->egl_data->egl_config,
   574             _this->egl_data->egl_config,
   562             nw, NULL);
   575             nw, NULL);