#include <cmath>
#include <msp/core/getopt.h>
+#include <msp/gl/pipelinetemplate.h>
#include <msp/input/keys.h>
#include <msp/io/console.h>
#include <msp/io/file.h>
#include <msp/strings/regex.h>
#include <msp/time/utils.h>
#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),
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");
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)
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;
}
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)),
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<FilmGrain>("film_grain");
+ GL::PipelineTemplate::register_postprocessor<Vignette>("vignette");
}
LauncherBase::~LauncherBase()
display.tick();
demo->tick();
+#ifdef WITH_DEVELOPER
if(frame_dump)
{
glReadPixels(0, 0, window.get_width(), window.get_height(), GL_RGB, GL_UNSIGNED_BYTE, frame_dump_buffer);
frame_dump->write(frame_dump_buffer, frame_size);
}
+#endif
}
void LauncherBase::tick_launch_screen()
else if(key==Input::KEY_ESC)
exit(0);
}
+
+} // namespace DemoScene
+} // namespace Msp