src/render/opengles2/SDL_render_gles2.c
changeset 8256 bcfb214c2950
parent 8192 560c66a04082
child 8257 a1563cbde7a5
     1.1 --- a/src/render/opengles2/SDL_render_gles2.c	Tue Feb 25 10:04:49 2014 -0800
     1.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Thu Dec 19 06:01:18 2013 +0900
     1.3 @@ -1740,15 +1740,24 @@
     1.4      Uint32 windowFlags;
     1.5      GLint window_framebuffer;
     1.6      GLint value;
     1.7 +    int profileMask, majorVersion, minorVersion;
     1.8 +
     1.9 +    SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profileMask);
    1.10 +    SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &majorVersion);
    1.11 +    SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minorVersion);
    1.12  
    1.13      SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
    1.14      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
    1.15      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
    1.16  
    1.17      windowFlags = SDL_GetWindowFlags(window);
    1.18 -    if (!(windowFlags & SDL_WINDOW_OPENGL)) {
    1.19 +    if (!(windowFlags & SDL_WINDOW_OPENGL) ||
    1.20 +        profileMask != SDL_GL_CONTEXT_PROFILE_ES || majorVersion != 2 || minorVersion != 0) {
    1.21          if (SDL_RecreateWindow(window, windowFlags | SDL_WINDOW_OPENGL) < 0) {
    1.22              /* Uh oh, better try to put it back... */
    1.23 +            SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profileMask);
    1.24 +            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, majorVersion);
    1.25 +            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minorVersion);
    1.26              SDL_RecreateWindow(window, windowFlags);
    1.27              return NULL;
    1.28          }