From: Mikko Rasa Date: Mon, 17 Jun 2019 21:37:39 +0000 (+0300) Subject: Use an OpenGL 3.2 core context unless requested otherwise X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=94151737f2983ca7cade5be0e20c98fbc6f11eea;p=libs%2Fdemoscene.git Use an OpenGL 3.2 core context unless requested otherwise --- diff --git a/source/launcher.cpp b/source/launcher.cpp index aefa1be..d688419 100644 --- a/source/launcher.cpp +++ b/source/launcher.cpp @@ -28,6 +28,7 @@ LauncherBase::Options::Options(Graphics::Display &dpy, int argc, char **argv): unsigned windowed = 0; string windowed_size; float seek_seconds = 0.0f; + bool legacy_gl = false; GetOpt getopt; getopt.add_option('f', "fullscreen", fullscreen_size, GetOpt::OPTIONAL_ARG).bind_seen_count(fullscreen).set_help("Start in fullscreen mode", "SIZE"); @@ -39,6 +40,7 @@ LauncherBase::Options::Options(Graphics::Display &dpy, int argc, char **argv): getopt.add_option("no-music", no_music, GetOpt::NO_ARG).set_help("Disable music playback"); getopt.add_option("fps", framerate, GetOpt::REQUIRED_ARG).set_help("Run at NUM fps", "NUM"); getopt.add_option("no-vsync", no_vsync, GetOpt::NO_ARG).set_help("Disable vertical sync"); + getopt.add_option("legacy-gl", legacy_gl, GetOpt::NO_ARG).set_help("Use a legacy OpenGL context"); getopt(argc, argv); if(fullscreen && windowed) @@ -74,6 +76,13 @@ LauncherBase::Options::Options(Graphics::Display &dpy, int argc, char **argv): fullscreen_opts.fullscreen_monitor = desktop_mode.monitor; fullscreen_opts.fullscreen_exclusive = false; + if(!legacy_gl) + { + gl_opts.gl_version_major = 3; + gl_opts.gl_version_minor = 2; + gl_opts.core_profile = true; + } + seek = seek_seconds*Time::sec; } @@ -92,7 +101,7 @@ void LauncherBase::Options::parse_size(const string &size, Graphics::WindowOptio LauncherBase::LauncherBase(int argc, char **argv): options(display, argc, argv), window(display, options.start_fullscreen>0 ? options.fullscreen_opts : options.win_opts), - gl_context(window), + gl_context(window, options.gl_opts), keyboard(window), al_device(options.no_music ? 0 : new AL::Device), al_context(options.no_music ? 0 : new AL::Context(*al_device)), diff --git a/source/launcher.h b/source/launcher.h index 54e6eda..f394f29 100644 --- a/source/launcher.h +++ b/source/launcher.h @@ -26,6 +26,7 @@ protected: { Msp::Graphics::WindowOptions win_opts; Msp::Graphics::WindowOptions fullscreen_opts; + Msp::Graphics::GLOptions gl_opts; int start_fullscreen; std::string frame_dump_fn; float framerate;