diff --git a/src/rendering/twn_gl_15_rendering.c b/src/rendering/twn_gl_15_rendering.c index 72de360..b16af82 100644 --- a/src/rendering/twn_gl_15_rendering.c +++ b/src/rendering/twn_gl_15_rendering.c @@ -96,7 +96,11 @@ static void finally_use_space_pipeline(void) { if (GLAD_GL_ARB_depth_clamp) glDisable(GL_DEPTH_CLAMP); - glEnable(GL_CULL_FACE); + if (ctx.cull_faces) + glEnable(GL_CULL_FACE); + else + glDisable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); glEnable(GL_DEPTH_TEST); diff --git a/src/twn_engine_context_c.h b/src/twn_engine_context_c.h index 95b6b4a..4b89e1a 100644 --- a/src/twn_engine_context_c.h +++ b/src/twn_engine_context_c.h @@ -81,6 +81,7 @@ typedef struct EngineContext { /* signals mouse focus, used to disable mouse capture */ bool window_mouse_resident; bool audio_initialized; + bool cull_faces; } EngineContext; /* TODO: does it need to be marked with TWN_API? */ diff --git a/src/twn_loop.c b/src/twn_loop.c index 807f1b4..c05b592 100644 --- a/src/twn_loop.c +++ b/src/twn_loop.c @@ -596,6 +596,13 @@ static bool initialize(void) { } } SDL_free(datum_font_filtering.u.s); + + toml_datum_t datum_cull_faces = toml_bool_in(engine, "cull_faces"); + if (!datum_cull_faces.ok) { + ctx.cull_faces = true; + } else { + ctx.cull_faces = datum_cull_faces.u.b; + } } /* these are dynamic arrays and will be allocated lazily by stb_ds */