From 7d71fd8bc7e1a562aa8dac99832b5ca767d644d2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 30 Nov 2022 00:45:57 +0100 Subject: main: remove framebuffer code again --- main/draw.cpp | 23 ++--------------------- main/main-impl.hpp | 7 ------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/main/draw.cpp b/main/draw.cpp index cab331ff..91000e81 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -15,21 +14,6 @@ namespace floormat { void main_impl::recalc_viewport(Vector2i size) noexcept { - if (_screen.fb.id()) - { - _screen.fb.detach(GL::Framebuffer::ColorAttachment{0}); - _screen.fb.detach(GL::Framebuffer::BufferAttachment::Depth); - } - - _screen.fb = GL::Framebuffer{{{}, size}}; - _screen.color = GL::Renderbuffer{}; - _screen.color.setStorage(GL::RenderbufferFormat::RGBA8, size); - _screen.depthstencil = GL::Renderbuffer{}; - _screen.depthstencil.setStorage(GL::RenderbufferFormat::Depth24Stencil8, size); - - _screen.fb.attachRenderbuffer(GL::Framebuffer::ColorAttachment{0}, _screen.color); - _screen.fb.attachRenderbuffer(GL::Framebuffer::BufferAttachment::DepthStencil, _screen.depthstencil); - update_window_state(); _shader.set_scale(Vector2{size}); GL::defaultFramebuffer.setViewport({{}, size }); @@ -46,8 +30,6 @@ void main_impl::recalc_viewport(Vector2i size) noexcept GL::Renderer::setDepthFunction(R::DepthFunction::Greater); GL::Renderer::setScissor({{}, size}); - _screen.fb.bind(); - // -- user-- app.on_viewport_event(size); } @@ -101,7 +83,7 @@ void main_impl::draw_world() noexcept } GL::Renderer::enable(GL::Renderer::Feature::DepthTest); - _screen.fb.clearDepth(0); + GL::defaultFramebuffer.clearDepthStencil(0, 0); for (std::int16_t y = miny; y <= maxy; y++) for (std::int16_t x = minx; x <= maxx; x++) { @@ -206,14 +188,13 @@ void main_impl::drawEvent() { _shader.set_tint({1, 1, 1, 1}); const auto clear_color = 0x222222ff_rgbaf; - _screen.fb.clearColor(0, clear_color); + GL::defaultFramebuffer.clearColor(clear_color); draw_world(); draw_anim(); GL::Renderer::disable(GL::Renderer::Feature::DepthTest); } app.draw(); - GL::Framebuffer::blit(_screen.fb, GL::defaultFramebuffer, {{}, windowSize()}, GL::FramebufferBlit::Color); GL::Renderer::flush(); do_update(); diff --git a/main/main-impl.hpp b/main/main-impl.hpp index e923306f..cc17f9bc 100644 --- a/main/main-impl.hpp +++ b/main/main-impl.hpp @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include namespace floormat { @@ -78,11 +76,6 @@ private: tile_shader _shader; std::vector> _clickable_scenery; struct world _world{}; - - struct { - GL::Framebuffer fb{NoCreate}; - GL::Renderbuffer color{NoCreate}, depthstencil{NoCreate}; - } _screen; Magnum::Timeline timeline; floor_mesh _floor_mesh; wall_mesh _wall_mesh; -- cgit v1.2.3