src/render/opengles/SDL_render_gles.c
changeset 8256 bcfb214c2950
parent 8149 681eb46b8ac4
child 8257 a1563cbde7a5
equal deleted inserted replaced
8255:49af9be342cd 8256:bcfb214c2950
   277 
   277 
   278     SDL_Renderer *renderer;
   278     SDL_Renderer *renderer;
   279     GLES_RenderData *data;
   279     GLES_RenderData *data;
   280     GLint value;
   280     GLint value;
   281     Uint32 windowFlags;
   281     Uint32 windowFlags;
       
   282     int profileMask, majorVersion, minorVersion;
       
   283 
       
   284     SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profileMask);
       
   285     SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &majorVersion);
       
   286     SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minorVersion);
   282 
   287 
   283     SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
   288     SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
   284     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
   289     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
   285     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
   290     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
   286 
   291 
   287     windowFlags = SDL_GetWindowFlags(window);
   292     windowFlags = SDL_GetWindowFlags(window);
   288     if (!(windowFlags & SDL_WINDOW_OPENGL)) {
   293     if (!(windowFlags & SDL_WINDOW_OPENGL) ||
       
   294         profileMask != SDL_GL_CONTEXT_PROFILE_ES || majorVersion != 1 || minorVersion != 1) {
   289         if (SDL_RecreateWindow(window, windowFlags | SDL_WINDOW_OPENGL) < 0) {
   295         if (SDL_RecreateWindow(window, windowFlags | SDL_WINDOW_OPENGL) < 0) {
   290             /* Uh oh, better try to put it back... */
   296             /* Uh oh, better try to put it back... */
       
   297             SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profileMask);
       
   298             SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, majorVersion);
       
   299             SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minorVersion);
   291             SDL_RecreateWindow(window, windowFlags);
   300             SDL_RecreateWindow(window, windowFlags);
   292             return NULL;
   301             return NULL;
   293         }
   302         }
   294     }
   303     }
   295 
   304