]> git.tdb.fi Git - libs/demoscene.git/commitdiff
Use an OpenGL 3.2 core context unless requested otherwise
authorMikko Rasa <tdb@tdb.fi>
Mon, 17 Jun 2019 21:37:39 +0000 (00:37 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 17 Jun 2019 21:37:39 +0000 (00:37 +0300)
source/launcher.cpp
source/launcher.h

index aefa1be2b4b57b808f7379ee312bb9034d45b2dd..d6884195ef19645c23c0fe603ded086e15e17f28 100644 (file)
@@ -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)),
index 54e6eda17361bf65a491bfeb695585842b1d338a..f394f2927251dde43c72076f4eac1c176f3aa412 100644 (file)
@@ -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;