src/video/SDL_egl.c
changeset 8976 1a5d959d7b32
parent 8971 c30e826412d1
child 9162 69856cdc9da6
equal deleted inserted replaced
8975:180271d72b1e 8976:1a5d959d7b32
    67 { \
    67 { \
    68     return SDL_SetError("Could not retrieve EGL function " #NAME); \
    68     return SDL_SetError("Could not retrieve EGL function " #NAME); \
    69 }
    69 }
    70     
    70     
    71 /* EGL implementation of SDL OpenGL ES support */
    71 /* EGL implementation of SDL OpenGL ES support */
       
    72 #ifdef EGL_KHR_create_context        
    72 static int SDL_EGL_HasExtension(_THIS, const char *ext)
    73 static int SDL_EGL_HasExtension(_THIS, const char *ext)
    73 {
    74 {
    74     int i;
    75     int i;
    75     int len = 0;
    76     int len = 0;
    76     int ext_len;
    77     int ext_len;
    98         }
    99         }
    99     }
   100     }
   100 
   101 
   101     return 0;
   102     return 0;
   102 }
   103 }
       
   104 #endif /* EGL_KHR_create_context */
   103 
   105 
   104 void *
   106 void *
   105 SDL_EGL_GetProcAddress(_THIS, const char *proc)
   107 SDL_EGL_GetProcAddress(_THIS, const char *proc)
   106 {
   108 {
   107     static char procname[1024];
   109     static char procname[1024];
   550 }
   552 }
   551 
   553 
   552 EGLSurface *
   554 EGLSurface *
   553 SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) 
   555 SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) 
   554 {
   556 {
   555     EGLint format;
       
   556     
       
   557     if (SDL_EGL_ChooseConfig(_this) != 0) {
   557     if (SDL_EGL_ChooseConfig(_this) != 0) {
   558         return EGL_NO_SURFACE;
   558         return EGL_NO_SURFACE;
   559     }
   559     }
   560     
   560     
   561 #if __ANDROID__
   561 #if __ANDROID__
   562     /* Android docs recommend doing this!
   562     {
   563      * Ref: http://developer.android.com/reference/android/app/NativeActivity.html 
   563         /* Android docs recommend doing this!
   564      */
   564          * Ref: http://developer.android.com/reference/android/app/NativeActivity.html 
   565     _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
   565          */
   566                                         _this->egl_data->egl_config, 
   566         EGLint format;
   567                                         EGL_NATIVE_VISUAL_ID, &format);
   567         _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
   568 
   568                                             _this->egl_data->egl_config, 
   569     ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
   569                                             EGL_NATIVE_VISUAL_ID, &format);
       
   570 
       
   571         ANativeWindow_setBuffersGeometry(nw, 0, 0, format);
       
   572     }
   570 #endif    
   573 #endif    
   571     
   574     
   572     return _this->egl_data->eglCreateWindowSurface(
   575     return _this->egl_data->eglCreateWindowSurface(
   573             _this->egl_data->egl_display,
   576             _this->egl_data->egl_display,
   574             _this->egl_data->egl_config,
   577             _this->egl_data->egl_config,