]> git.tdb.fi Git - libs/gl.git/blobdiff - demos/desertpillars/source/desertpillars.cpp
Create default context options in the device backend
[libs/gl.git] / demos / desertpillars / source / desertpillars.cpp
index 542ade3b0a8164cb668926e8312bfc90121c67e2..1afd57b8d1a41cc50798976213680061ab15628d 100644 (file)
@@ -4,7 +4,6 @@
 #include <msp/gl/sequencebuilder.h>
 #include <msp/gl/pointlight.h>
 #include <msp/gl/renderer.h>
-#include <msp/gl/tests.h>
 #include <msp/input/keys.h>
 #include <msp/time/utils.h>
 #include "desertpillars.h"
@@ -16,17 +15,15 @@ DesertPillars::Options::Options()
 {
        wnd_opts.width = 1920;
        wnd_opts.height = 1080;
-       gl_opts.gl_version_major = Graphics::GLOptions::LATEST_VERSION;
-       gl_opts.core_profile = true;
 }
 
 
 DesertPillars::DesertPillars(int, char **):
        window(display, opts.wnd_opts),
-       gl_ctx(window, opts.gl_opts),
+       gl_device(window),
        keyboard(window),
-       view(window, gl_ctx),
-       camera(resources.get<GL::Camera>("Camera.camera")),
+       resources(&res_mgr),
+       view(window),
        lighting(resources.get<GL::Lighting>("Desert.lightn")),
        sphere(resources.get<GL::Object>("Sphere.object")),
        sphere_morph(0.0f),
@@ -60,6 +57,7 @@ DesertPillars::DesertPillars(int, char **):
        content.add(*env_map);
        content.add(flare);
 
+       camera.copy_parameters(resources.get<GL::Camera>("Camera.camera"));
        camera.set_debug_name("Main camera");
 
        view.set_content(sequence.get());
@@ -123,6 +121,7 @@ void DesertPillars::tick()
        flare.set_matrix(GL::Matrix::translation(p));
 
        display.tick();
+       res_mgr.tick();
        view.render();
 }
 
@@ -139,13 +138,15 @@ void DesertPillars::key_press(unsigned key)
 }
 
 
-DesertPillars::Resources::Resources()
+DesertPillars::Resources::Resources(GL::ResourceManager *rm)
 {
        FS::Path base_dir = FS::get_sys_data_dir()/"demos"/"desertpillars"/"data";
        source.add_directory(base_dir);
        source.add_directory(base_dir/"textures");
        source.add_directory(base_dir/"exported");
        add_source(source);
+
+       set_resource_manager(rm);
 }