Skip to content

Commit 836ef68

Browse files
authored
Add fallback window creation without multisampling (#17)
1 parent 4f6f0cf commit 836ef68

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/MarlinSimulator/window.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ WindowReturnCode sdl_window_create(WindowConfig config = {}) {
4747

4848
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
4949
window = SDL_CreateWindow((char *)config.title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
50+
if (window == nullptr) {
51+
fprintf(stderr, "SDL_CreateWindow: Failed to Create Window (%s), retrying without multisampling (fallback)\n", SDL_GetError());
52+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
53+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
54+
window = SDL_CreateWindow((char *)config.title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
55+
}
5056
if (window == nullptr) {
5157
fprintf(stderr, "SDL_CreateWindow: Failed to Create Window (%s)\n", SDL_GetError());
5258
return WindowReturnCode::SDL_CREATE_WINDOW_FAILED;

0 commit comments

Comments
 (0)