move SDL_GL_SetAttribute after SDL_InitSubSystem and use SDL_GL_CONTEXT_PROFILE_COMPATIBILITY for everything but apple

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9419 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: d1234600a87c2e9cd65a64c9edf4f5d3599ae6f7
Former-commit-id: fdf67bbbc1fcb8944490ec550d2cfc3d98b353d0
This commit is contained in:
iobyte 2024-05-16 15:02:20 +00:00
parent 27b4c960a4
commit 83bb469528

View file

@ -414,18 +414,6 @@ int GfScrGetAttachedDisplays()
bool GfScrInitSDL2(int nWinWidth, int nWinHeight, int nFullScreen)
{
#ifdef __APPLE__
// Version d'OpenGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
#else
// Version d'OpenGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
#endif
// Prepare video mode.
int bfVideoMode = SDL_WINDOW_OPENGL;
@ -435,6 +423,19 @@ bool GfScrInitSDL2(int nWinWidth, int nWinHeight, int nFullScreen)
GfLogError("Couldn't initialize SDL audio/video sub-system (%s)\n", SDL_GetError());
return false;
}
#ifdef __APPLE__
// Version d'OpenGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
#else
// Version d'OpenGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
#endif
#if ((SDL_MAJOR_VERSION >= 2) && (SDL_PATCHLEVEL >= 5))
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
#endif
@ -1243,6 +1244,18 @@ bool GfScrInitSDL2()
return false;
}
#ifdef __APPLE__
// Version d'OpenGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
#else
// Version d'OpenGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
#endif
// Get system info
// Read saved info