SDL: Use OpenGL 3.1 if 3.2 is not available (like WGL)

console-destruction
Lukas Werling 2016-09-17 12:32:18 +02:00
parent 6a6f4520d3
commit b614209593
1 changed files with 8 additions and 0 deletions

View File

@ -464,6 +464,14 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *)
this->pWindow = pWindow;
ctx = SDL_GL_CreateContext(pWindow->window);
if (!ctx)
{
LogSilentF(" gl: OpenGL %d.%d not available; falling back to 3.1 emergency context.", REQUESTED_GL_CTX_MAJOR, REQUESTED_GL_CTX_MINOR);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
pGL->Workarounds.ForceSoftwareTransform = true;
ctx = SDL_GL_CreateContext(pWindow->window);
}
if (!ctx)
{
return pGL->Error(FormatString("SDL_GL_CreateContext: %s", SDL_GetError()).getData());
}