From 3542839c6b6ac2f36b174dbd603d55d56ca02fde Mon Sep 17 00:00:00 2001 From: bw Date: Jan 09 2021 10:57:19 +0000 Subject: disable multisampling for imcompatible devices --- diff --git a/src/world.c b/src/world.c index 5bc50ce..94d645a 100644 --- a/src/world.c +++ b/src/world.c @@ -460,13 +460,20 @@ static int init() { unsigned int flags = SDL_WINDOW_OPENGL; if (resizable) flags |= SDL_WINDOW_RESIZABLE; + window = SDL_CreateWindow( - title, - SDL_WINDOWPOS_CENTERED, - SDL_WINDOWPOS_CENTERED, - width, - height, - flags ); + title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + width, height, flags ); + + if (!window) { + // try to create window without multisampling + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); + window = SDL_CreateWindow( + title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + width, height, flags ); + } + if (!window) { fprintf(stderr, "helianthus: cannot create window: %s\n", SDL_GetError());