This can be useful if an OffscreenView is used to render a sub-scene in
some renderable's setup_frame function.
}
void View::render()
+{
+ Renderer renderer;
+ render(renderer);
+}
+
+void View::render(Renderer &renderer)
{
Bind bind_fbo(target);
target.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
if(content)
{
- Renderer renderer(camera);
+ Renderer::Push push(renderer);
+ renderer.set_camera(*camera);
content->setup_frame(renderer);
content->render(renderer);
content->finish_frame();
class Camera;
class Renderable;
+class Renderer;
/**
Manages the presentation of rendering results on the screen.
void set_content(Renderable *);
virtual void render();
+ virtual void render(Renderer &);
};
} // namespace GL
window_resized(window.get_width(), window.get_height());
}
-void WindowView::render()
+void WindowView::render(Renderer &renderer)
{
- View::render();
+ View::render(renderer);
context.swap_buffers();
}
virtual unsigned get_width() const { return window.get_width(); }
virtual unsigned get_height() const { return window.get_height(); }
- virtual void render();
+ virtual void render(Renderer &);
private:
void window_resized(unsigned, unsigned);