X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flauncher.cpp;h=d6884195ef19645c23c0fe603ded086e15e17f28;hb=94151737f2983ca7cade5be0e20c98fbc6f11eea;hp=2b53c18a2b2dbe92e5b78294e28eefd59dd1fb6c;hpb=2be535f3b531fbda744b740da2150b25f0387173;p=libs%2Fdemoscene.git diff --git a/source/launcher.cpp b/source/launcher.cpp index 2b53c18..d688419 100644 --- a/source/launcher.cpp +++ b/source/launcher.cpp @@ -1,16 +1,21 @@ #include #include +#include #include #include #include #include #include #include "demo.h" +#include "filmgrain.h" #include "launcher.h" #include "launchscreen.h" +#include "vignette.h" using namespace std; -using namespace Msp; + +namespace Msp { +namespace DemoScene { LauncherBase::Options::Options(Graphics::Display &dpy, int argc, char **argv): start_fullscreen(-1), @@ -23,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"); @@ -34,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) @@ -69,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; } @@ -87,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)), @@ -100,6 +114,9 @@ LauncherBase::LauncherBase(int argc, char **argv): gl_context.set_swap_interval(options.no_vsync ? 0 : 1); window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &LauncherBase::exit), 0)); keyboard.signal_button_press.connect(sigc::bind_return(sigc::mem_fun(this, &LauncherBase::key_press), false)); + + GL::PipelineTemplate::register_postprocessor("film_grain"); + GL::PipelineTemplate::register_postprocessor("vignette"); } LauncherBase::~LauncherBase() @@ -214,3 +231,6 @@ void LauncherBase::key_press(unsigned key) else if(key==Input::KEY_ESC) exit(0); } + +} // namespace DemoScene +} // namespace Msp