src/video/SDL_egl.c
changeset 8966 5771ab3290d6
parent 8964 d9ac759bb62a
child 8971 c30e826412d1
equal deleted inserted replaced
8965:8eceea447276 8966:5771ab3290d6
   414     if (_this->gl_config.share_with_current_context) {
   414     if (_this->gl_config.share_with_current_context) {
   415         share_context = (EGLContext)SDL_GL_GetCurrentContext();
   415         share_context = (EGLContext)SDL_GL_GetCurrentContext();
   416     }
   416     }
   417     
   417     
   418     /* Bind the API */
   418     /* Bind the API */
   419 #if !__ANDROID__ /* No support for desktop OpenGL on Android */
       
   420     if(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
   419     if(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
   421 #endif /* !__ANDROID__ */        
       
   422         _this->egl_data->eglBindAPI(EGL_OPENGL_ES_API);
   420         _this->egl_data->eglBindAPI(EGL_OPENGL_ES_API);
   423         if (_this->gl_config.major_version) {
   421         if (_this->gl_config.major_version) {
   424             context_attrib_list[1] = _this->gl_config.major_version;
   422             context_attrib_list[1] = _this->gl_config.major_version;
   425         }
   423         }
   426 
   424 
   427         egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
   425         egl_context = _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
   428                                           _this->egl_data->egl_config,
   426                                           _this->egl_data->egl_config,
   429                                           share_context, context_attrib_list);
   427                                           share_context, context_attrib_list);
   430 
       
   431 #if !__ANDROID__
       
   432     }
   428     }
   433     else {
   429     else {
   434         _this->egl_data->eglBindAPI(EGL_OPENGL_API);
   430         _this->egl_data->eglBindAPI(EGL_OPENGL_API);
       
   431 #ifdef EGL_KHR_create_context        
   435         if(SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) {
   432         if(SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) {
   436             context_attrib_list[0] = EGL_CONTEXT_MAJOR_VERSION_KHR;
   433             context_attrib_list[0] = EGL_CONTEXT_MAJOR_VERSION_KHR;
   437             context_attrib_list[1] = _this->gl_config.major_version;
   434             context_attrib_list[1] = _this->gl_config.major_version;
   438             context_attrib_list[2] = EGL_CONTEXT_MINOR_VERSION_KHR;
   435             context_attrib_list[2] = EGL_CONTEXT_MINOR_VERSION_KHR;
   439             context_attrib_list[3] = _this->gl_config.minor_version;
   436             context_attrib_list[3] = _this->gl_config.minor_version;
   450             }
   447             }
   451         }
   448         }
   452         else {
   449         else {
   453             context_attrib_list[0] = EGL_NONE;
   450             context_attrib_list[0] = EGL_NONE;
   454         }
   451         }
       
   452 #else /* EGL_KHR_create_context*/
       
   453         context_attrib_list[0] = EGL_NONE;
       
   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);
   458     }
   458     }
   459 #endif /* !__ANDROID__ */
       
   460     
   459     
   461     if (egl_context == EGL_NO_CONTEXT) {
   460     if (egl_context == EGL_NO_CONTEXT) {
   462         SDL_SetError("Could not create EGL context");
   461         SDL_SetError("Could not create EGL context");
   463         return NULL;
   462         return NULL;
   464     }
   463     }