diff --git a/meson.build b/meson.build index cd9193df..220a2dca 100644 --- a/meson.build +++ b/meson.build @@ -89,6 +89,13 @@ if get_option('threaded_gl_init') global_args += '-DTHREADED_GLINIT' endif +# Mainly for virtual machines +if get_option('gl3') + global_args += ['-DZ_GL_MINOR=3','-DZ_GL_MAJOR=3'] +else + global_args += ['-DZ_GL_MINOR=1','-DZ_GL_MAJOR=4'] +endif + # Objectify our C global_args += run_command(objfw,'--cppflags').stdout().split() diff --git a/meson_options.txt b/meson_options.txt index e0abc6bd..86cd632c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,6 +3,7 @@ option('mk', type: 'boolean', value: false, description: 'Build to fit Marin\'s option('console', type: 'boolean', value: true, description: 'Whether to debug information in the console') option('macos_min_version', type: 'string', value: '10.10', description: 'Minimum macOS system version to support') option('threaded_gl_init', type: 'boolean', value: true, description: 'Init GL on secondary thread') +option('gl3', type: 'boolean', value: false, description: 'Use OpenGL 3.3 instead of 4.1') option('shared_fluid', type: 'boolean', value: false, description: 'Dynamically link fluidsynth at build time') option('cjk_fallback_font', type: 'boolean', value: false, description: 'Use WenQuanYi Micro Hei as the fallback font') diff --git a/shader/common.h b/shader/common.h index 810bf6d1..64068da9 100644 --- a/shader/common.h +++ b/shader/common.h @@ -1,4 +1,4 @@ -#version 410 +#version 330 #define attribute in #define varying out diff --git a/src/main.mm b/src/main.mm index 2ee0d4c5..2aa07536 100644 --- a/src/main.mm +++ b/src/main.mm @@ -412,8 +412,8 @@ static SDL_GLContext initGL(SDL_Window *win, Config &conf, // Core profile enables OpenGL4 on macOS // Using OpenGL 4.1 requires a GPU with max texture size of 16384 or better - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, Z_GL_MAJOR); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, Z_GL_MINOR); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); glCtx = SDL_GL_CreateContext(win);