X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fframebuffer.cpp;h=b0777171448b5a27222e4b631e8d04cc52143ae6;hp=613277233a84d78258fe40c2c585cbca24cf41bb;hb=7ef75a4c4dbfc437e466381dd67c23357e607b82;hpb=f19366d32cc29287a2730cfba90893e407754081 diff --git a/source/core/framebuffer.cpp b/source/core/framebuffer.cpp index 61327723..b0777171 100644 --- a/source/core/framebuffer.cpp +++ b/source/core/framebuffer.cpp @@ -16,21 +16,11 @@ framebuffer_incomplete::framebuffer_incomplete(const std::string &reason): Framebuffer::Framebuffer(bool s): - FramebufferBackend(s), - dirty(0) -{ - if(s) - { - format = get_system_format(); - get_system_size(width, height); - } -} + FramebufferBackend(s) +{ } Framebuffer::Framebuffer(): - FramebufferBackend(false), - width(0), - height(0), - dirty(0) + FramebufferBackend(false) { } Framebuffer::Framebuffer(FrameAttachment fa): @@ -47,7 +37,7 @@ Framebuffer::Framebuffer(const FrameFormat &f): void Framebuffer::set_format(const FrameFormat &fmt) { - if(!format.empty() || !id) + if(!format.empty()) throw invalid_operation("Framebuffer::set_format"); if(fmt.empty() || !is_format_supported(fmt)) throw invalid_argument("Framebuffer::set_format"); @@ -107,7 +97,7 @@ void Framebuffer::check_size() void Framebuffer::set_attachment(FrameAttachment attch, Texture &tex, unsigned level, int layer, unsigned samples) { - if(format.empty() || !id) + if(format.empty() || attachments.empty()) throw invalid_operation("Framebuffer::attach"); if((format.get_samples()>1 && samples!=format.get_samples()) || (format.get_samples()==1 && samples)) @@ -163,7 +153,7 @@ void Framebuffer::attach_layered(FrameAttachment attch, TextureCube &tex, unsign void Framebuffer::detach(FrameAttachment attch) { - if(!id) + if(attachments.empty()) throw invalid_operation("Framebuffer::detach"); int i = format.index(attch); @@ -175,20 +165,8 @@ void Framebuffer::detach(FrameAttachment attch) } } -void Framebuffer::resize(const WindowView &view) -{ - if(id) - throw invalid_operation("Framebuffer::resize"); - - width = view.get_width(); - height = view.get_height(); -} - void Framebuffer::require_complete() const { - if(!id) - return; - bool layered = (!attachments.empty() && attachments.front().layer<0); for(const Attachment &a: attachments) { @@ -201,18 +179,6 @@ void Framebuffer::require_complete() const FramebufferBackend::require_complete(); } -Framebuffer &Framebuffer::system() -{ - static Framebuffer sys_framebuf(true); - return sys_framebuf; -} - - -Framebuffer::Attachment::Attachment(): - tex(0), - level(0), - layer(0) -{ } void Framebuffer::Attachment::set(Texture &t, unsigned l, int z) {