Don't create SDL renderer when using OpenGL rendering
SDL_CreateRenderer changes OpenGL state, and that interferes with libtcod's own
settings. It is also unnecessary to create a SDL renderer when handling our own
rendering.
@@ -293,10 +293,12 @@ static void create_window(int w, int h, bool fullscreen) {
}
if ( window == NULL ) TCOD_fatal_nopar("SDL : cannot create window");
}
+ if (TCOD_ctx.renderer == TCOD_RENDERER_SDL ) {
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if ( renderer == NULL ) TCOD_fatal_nopar("SDL : cannot create renderer");
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
}
+}
static void destroy_window(void) {
#ifndef NO_OPENGL
