--- /dev/null
+#include "camera.h"
+#include "framebuffer.h"
+#include "renderable.h"
+#include "view.h"
+
+using namespace std;
+
+namespace Msp {
+namespace GL {
+
+View::View(Graphics::Window &w, Graphics::GLContext &c):
+ window(w),
+ context(c),
+ target(Framebuffer::system()),
+ content(0)
+{
+ window.signal_resize.connect(sigc::mem_fun(this, &View::window_resized));
+}
+
+void View::set_content(const Renderable *r)
+{
+ content = r;
+}
+
+void View::synchronize_camera_aspect(Camera &c)
+{
+ synced_cameras.push_back(&c);
+ c.set_aspect(static_cast<float>(window.get_width())/window.get_height());
+}
+
+void View::render()
+{
+ target.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
+ if(content)
+ content->render();
+ context.swap_buffers();
+}
+
+void View::window_resized(unsigned w, unsigned h)
+{
+ target.viewport(0, 0, w, h);
+ float aspect = static_cast<float>(w)/h;
+ for(list<Camera *>::iterator i=synced_cameras.begin(); i!=synced_cameras.end(); ++i)
+ (*i)->set_aspect(aspect);
+}
+
+} // namespace GL
+} // namespace Msp
--- /dev/null
+#ifndef MSP_GL_VIEW_H_
+#define MSP_GL_VIEW_H_
+
+#include <list>
+#include <msp/graphics/glcontext.h>
+#include <msp/graphics/window.h>
+
+namespace Msp {
+namespace GL {
+
+class Camera;
+class Framebuffer;
+class Renderable;
+
+/**
+Manages the presentation of rendering results on the screen.
+*/
+class View
+{
+private:
+ Graphics::Window &window;
+ Graphics::GLContext &context;
+ Framebuffer ⌖
+ const Renderable *content;
+ std::list<Camera *> synced_cameras;
+
+public:
+ View(Graphics::Window &, Graphics::GLContext &);
+
+ void set_content(const Renderable *);
+ void synchronize_camera_aspect(Camera &);
+
+ void render();
+
+private:
+ void window_resized(unsigned, unsigned);
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif