From e598e9d8dacad73b7ee1688e2be738e94b07b9fa Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 24 May 2019 20:49:07 +0300 Subject: [PATCH] Some cleanup for View and WindowView --- source/view.cpp | 5 +++-- source/view.h | 2 +- source/windowview.cpp | 1 + source/windowview.h | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/view.cpp b/source/view.cpp index 074967cf..7ab41912 100644 --- a/source/view.cpp +++ b/source/view.cpp @@ -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) { diff --git a/source/view.h b/source/view.h index 6aca12f1..24188de4 100644 --- a/source/view.h +++ b/source/view.h @@ -21,7 +21,7 @@ protected: Renderable *content; std::list synced_cameras; - View(); + View(Framebuffer &); public: virtual unsigned get_width() const { return target.get_width(); } diff --git a/source/windowview.cpp b/source/windowview.cpp index 6a0eebda..0927407a 100644 --- a/source/windowview.cpp +++ b/source/windowview.cpp @@ -7,6 +7,7 @@ namespace Msp { namespace GL { WindowView::WindowView(Graphics::Window &w, Graphics::GLContext &c): + View(Framebuffer::system()), window(w), context(c) { diff --git a/source/windowview.h b/source/windowview.h index 825601f1..6ba93f88 100644 --- a/source/windowview.h +++ b/source/windowview.h @@ -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(); -- 2.43.0