SDL: Make sure a context exists when calling SDL_GL_GetAttribute

This commit is contained in:
Le Philousophe 2022-05-28 15:49:54 +02:00
parent f7a55f3251
commit 31caab89e1

View File

@ -248,11 +248,12 @@ void OpenGLSdlGraphics3dManager::setupScreen() {
#if SDL_VERSION_ATLEAST(2, 0, 0)
bool needsWindowReset = false;
if (_window->getSDLWindow()) {
if (_window->getSDLWindow() && SDL_GL_GetCurrentContext()) {
// The anti-aliasing setting cannot be changed without recreating the window.
// So check if the window needs to be recreated.
int currentSamples = 0;
#if defined(__EMSCRIPTEN__)
// SDL_GL_MULTISAMPLESAMPLES isn't available on a WebGL 1.0 context
// (or not bridged in Emscripten?). This forces a windows reset.