]> git.tdb.fi Git - libs/gl.git/commitdiff
Use a renderer in the viewer
authorMikko Rasa <tdb@tdb.fi>
Sat, 16 Aug 2014 09:53:37 +0000 (12:53 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 16 Aug 2014 09:53:37 +0000 (12:53 +0300)
Some renderables using more sophisticated features won't even render
properly without one.

tools/viewer.cpp

index 2582b887ffcd51256fcfc0b0bd40be9d6e0a6bef..3e12321f014857d0763dd0a7c496b3479de76712 100644 (file)
@@ -16,6 +16,7 @@
 #include <msp/gl/lighting.h>
 #include <msp/gl/mesh.h>
 #include <msp/gl/object.h>
+#include <msp/gl/renderer.h>
 #include <msp/gl/resources.h>
 #include <msp/gl/technique.h>
 #include <msp/gl/tests.h>
@@ -217,12 +218,11 @@ void Viewer::tick()
 
        GL::Framebuffer::system().clear(GL::COLOR_BUFFER_BIT|GL::DEPTH_BUFFER_BIT);
 
-       camera.apply();
-
-       GL::Bind bind_lighting(lighting);
        GL::Bind bind_depth(GL::DepthTest::lequal());
        GL::Bind bind_blend(GL::Blend::alpha());
-       renderable->render();
+       GL::Renderer renderer(&camera);
+       renderer.set_lighting(&lighting);
+       renderable->render(renderer);
 
        window.swap_buffers();
 }