mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-06-08 09:31:58 +00:00
make window + GL context creation more robust in the presence of weird graphics drivers
This commit is contained in:
parent
59706456ce
commit
c2b72fd9dd
1 changed files with 9 additions and 7 deletions
|
@ -66,9 +66,7 @@ void Window::_open(unsigned w, unsigned h, bool full, unsigned bpp, bool vsync,
|
||||||
# endif
|
# endif
|
||||||
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
|
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2 );
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1 );
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0 );
|
|
||||||
SDL_SetHint("SDL_VIDEO_HIGHDPI_DISABLED", "1");
|
SDL_SetHint("SDL_VIDEO_HIGHDPI_DISABLED", "1");
|
||||||
|
|
||||||
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;
|
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;
|
||||||
|
@ -93,12 +91,16 @@ void Window::_open(unsigned w, unsigned h, bool full, unsigned bpp, bool vsync,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
int pos = full
|
||||||
//SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
|
? SDL_WINDOWPOS_UNDEFINED_DISPLAY(display)
|
||||||
#endif
|
: SDL_WINDOWPOS_CENTERED_DISPLAY(display);
|
||||||
|
|
||||||
int pos = SDL_WINDOWPOS_CENTERED_DISPLAY(display);
|
|
||||||
WIN = SDL_CreateWindow("", pos, pos, usew, useh, flags);
|
WIN = SDL_CreateWindow("", pos, pos, usew, useh, flags);
|
||||||
|
if(!WIN) // This may fail on handhelds; maybe plain and dumb fixed-size-fullscreen will work?
|
||||||
|
{
|
||||||
|
full = true;
|
||||||
|
WIN = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, usew, useh, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN);
|
||||||
|
}
|
||||||
if(!WIN)
|
if(!WIN)
|
||||||
exit_error("Failed to create window");
|
exit_error("Failed to create window");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue