2 #include "framebuffer.h"
3 #include "renderable.h"
11 View::View(Graphics::Window &w, Graphics::GLContext &c):
14 target(Framebuffer::system()),
17 window.signal_resize.connect(sigc::mem_fun(this, &View::window_resized));
20 void View::set_content(const Renderable *r)
25 void View::synchronize_camera_aspect(Camera &c)
27 synced_cameras.push_back(&c);
28 c.set_aspect(static_cast<float>(window.get_width())/window.get_height());
33 target.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
36 context.swap_buffers();
39 void View::window_resized(unsigned w, unsigned h)
41 target.viewport(0, 0, w, h);
42 float aspect = static_cast<float>(w)/h;
43 for(list<Camera *>::iterator i=synced_cameras.begin(); i!=synced_cameras.end(); ++i)
44 (*i)->set_aspect(aspect);