]> git.tdb.fi Git - libs/gltk.git/commitdiff
Change Root::render to use the passed in Renderer
authorMikko Rasa <tdb@tdb.fi>
Thu, 29 Dec 2016 17:21:24 +0000 (19:21 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 29 Dec 2016 17:21:24 +0000 (19:21 +0200)
source/root.cpp
source/root.h

index e9e62f6785c3a203914dfb10594d1a0db74c812d..b31b53f2d7e2f767cd48fb253eef5e436afdb863 100644 (file)
@@ -1,6 +1,7 @@
 #include <msp/gl/blend.h>
 #include <msp/gl/extensions/arb_shader_objects.h>
 #include <msp/gl/programbuilder.h>
+#include <msp/gl/tests.h>
 #include <msp/gl/uniform.h>
 #include <msp/input/keys.h>
 #include <msp/time/units.h>
@@ -135,11 +136,8 @@ void Root::tick()
        }
 }
 
-void Root::render(const GL::Tag &tag) const
+void Root::render() const
 {
-       if(tag.id)
-               return;
-
        GL::Bind bind_blend(GL::Blend::alpha());
 
        GL::Renderer renderer(&camera);
@@ -152,8 +150,12 @@ void Root::render(GL::Renderer &renderer, const GL::Tag &tag) const
        if(tag.id)
                return;
 
-       renderer.end();
-       render(tag);
+       GL::Renderer::Push push(renderer);
+       renderer.set_camera(camera);
+       renderer.set_shader_program(shprog);
+       GL::BindRestore bind_blend(GL::Blend::alpha());
+       GL::BindRestore unbind_dtest(static_cast<GL::DepthTest *>(0));
+       Widget::render(renderer);
 }
 
 bool Root::button_press_event(unsigned btn)
index 5dbf7bb1aa112a317f59763ac6fd9c8ccb7bad9a..7d5a592805f187a096e1fbc5e6f1a40822981d78 100644 (file)
@@ -63,7 +63,7 @@ public:
        virtual unsigned get_height() const { return geom.h; }
 
        void tick();
-       virtual void render(const GL::Tag & = GL::Tag()) const;
+       void render() const;
        virtual void render(GL::Renderer &, const GL::Tag & = GL::Tag()) const;
 
 private: