src/render/opengles2/SDL_render_gles2.c
changeset 8256 bcfb214c2950
parent 8192 560c66a04082
child 8257 a1563cbde7a5
equal deleted inserted replaced
8255:49af9be342cd 8256:bcfb214c2950
  1738     GLboolean hasCompiler;
  1738     GLboolean hasCompiler;
  1739 #endif
  1739 #endif
  1740     Uint32 windowFlags;
  1740     Uint32 windowFlags;
  1741     GLint window_framebuffer;
  1741     GLint window_framebuffer;
  1742     GLint value;
  1742     GLint value;
       
  1743     int profileMask, majorVersion, minorVersion;
       
  1744 
       
  1745     SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profileMask);
       
  1746     SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &majorVersion);
       
  1747     SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minorVersion);
  1743 
  1748 
  1744     SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
  1749     SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
  1745     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
  1750     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
  1746     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
  1751     SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
  1747 
  1752 
  1748     windowFlags = SDL_GetWindowFlags(window);
  1753     windowFlags = SDL_GetWindowFlags(window);
  1749     if (!(windowFlags & SDL_WINDOW_OPENGL)) {
  1754     if (!(windowFlags & SDL_WINDOW_OPENGL) ||
       
  1755         profileMask != SDL_GL_CONTEXT_PROFILE_ES || majorVersion != 2 || minorVersion != 0) {
  1750         if (SDL_RecreateWindow(window, windowFlags | SDL_WINDOW_OPENGL) < 0) {
  1756         if (SDL_RecreateWindow(window, windowFlags | SDL_WINDOW_OPENGL) < 0) {
  1751             /* Uh oh, better try to put it back... */
  1757             /* Uh oh, better try to put it back... */
       
  1758             SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profileMask);
       
  1759             SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, majorVersion);
       
  1760             SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minorVersion);
  1752             SDL_RecreateWindow(window, windowFlags);
  1761             SDL_RecreateWindow(window, windowFlags);
  1753             return NULL;
  1762             return NULL;
  1754         }
  1763         }
  1755     }
  1764     }
  1756 
  1765