]> git.tdb.fi Git - libs/gl.git/commitdiff
Some cleanup for View and WindowView
authorMikko Rasa <tdb@tdb.fi>
Fri, 24 May 2019 17:49:07 +0000 (20:49 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 24 May 2019 17:49:07 +0000 (20:49 +0300)
source/view.cpp
source/view.h
source/windowview.cpp
source/windowview.h

index 074967cfe1e3b14cafb925e0902e9e9cf11500b0..7ab41912ef19d1be6251e279725a9fbfa7830bbe 100644 (file)
@@ -6,8 +6,8 @@
 namespace Msp {
 namespace GL {
 
-View::View():
-       target(Framebuffer::system()),
+View::View(Framebuffer &t):
+       target(t),
        camera(0),
        content(0)
 { }
@@ -32,6 +32,7 @@ void View::synchronize_camera_aspect(Camera &c)
 
 void View::render()
 {
+       Bind bind_fbo(target);
        target.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
        if(content)
        {
index 6aca12f1a117ab3d3c0f14ffdfb565075d289d0b..24188de44564f02d6a66e4b6feb7e43a5cf2bbb4 100644 (file)
@@ -21,7 +21,7 @@ protected:
        Renderable *content;
        std::list<Camera *> synced_cameras;
 
-       View();
+       View(Framebuffer &);
 
 public:
        virtual unsigned get_width() const { return target.get_width(); }
index 6a0eebda574034de2beb0025d84bec924d781ebb..0927407a316ed92823ad8e605daa85f15326e3b3 100644 (file)
@@ -7,6 +7,7 @@ namespace Msp {
 namespace GL {
 
 WindowView::WindowView(Graphics::Window &w, Graphics::GLContext &c):
+       View(Framebuffer::system()),
        window(w),
        context(c)
 {
index 825601f186cd14b2da061c320938f45a30eff2f8..6ba93f88b735e44e30e9182fc8bda1daae30091f 100644 (file)
@@ -20,8 +20,8 @@ public:
 
        Graphics::Window &get_window() { return window; }
        Graphics::GLContext &get_context() { return context; }
-       unsigned get_width() const { return window.get_width(); }
-       unsigned get_height() const { return window.get_height(); }
+       virtual unsigned get_width() const { return window.get_width(); }
+       virtual unsigned get_height() const { return window.get_height(); }
 
        virtual void render();