diff --git a/src/pc/gfx/gfx_opengl.c b/src/pc/gfx/gfx_opengl.c index 3a803ede7..51f052cdf 100644 --- a/src/pc/gfx/gfx_opengl.c +++ b/src/pc/gfx/gfx_opengl.c @@ -836,6 +836,18 @@ static void gfx_opengl_init(void) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } +bool gfx_opengl_check_compatibility(void) { + // check GL version + int vmajor = 0; + int vminor = 0; + bool is_es = false; + gl_get_version(&vmajor, &vminor, &is_es); + if (vmajor < 2 && vminor < 1 && !is_es) + return false; + + return true; +} + static void gfx_opengl_on_resize(void) { } diff --git a/src/pc/gfx/gfx_opengl.h b/src/pc/gfx/gfx_opengl.h index 95be897a2..745274efb 100644 --- a/src/pc/gfx/gfx_opengl.h +++ b/src/pc/gfx/gfx_opengl.h @@ -5,4 +5,6 @@ extern struct GfxRenderingAPI gfx_opengl_api; +bool gfx_opengl_check_compatibility(void); + #endif diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index d4a780097..9220c5f90 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -221,6 +221,11 @@ static void select_graphics_backend(void) { return; } +#if defined(_WIN32) + if (configGraphicsBackend == GAPI_GL && !gfx_opengl_check_compatibility()) { + configGraphicsBackend = GAPI_D3D11; + } +#endif int backend = configGraphicsBackend; #if defined(_WIN32) if (gCLIOpts.backend != -1) { backend = gCLIOpts.backend; }