X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fopengl%2Fframebuffer_backend.cpp;h=18566ac3c2553fd82ea1dd71ab735dc0f3cd3168;hb=3b98e13c823d4cb7e4d2d4d14e8440b44bc71f91;hp=b56499d1609186572a8ada56492163c0bfbfaf1b;hpb=b9e720f36185c6fe4d39a1056ecb88dec0ce950d;p=libs%2Fgl.git diff --git a/source/backends/opengl/framebuffer_backend.cpp b/source/backends/opengl/framebuffer_backend.cpp index b56499d1..18566ac3 100644 --- a/source/backends/opengl/framebuffer_backend.cpp +++ b/source/backends/opengl/framebuffer_backend.cpp @@ -19,7 +19,6 @@ namespace Msp { namespace GL { OpenGLFramebuffer::OpenGLFramebuffer(bool is_system): - id(0), status(is_system ? GL_FRAMEBUFFER_COMPLETE : GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT) { if(!is_system) @@ -33,6 +32,13 @@ OpenGLFramebuffer::OpenGLFramebuffer(bool is_system): } } +OpenGLFramebuffer::OpenGLFramebuffer(OpenGLFramebuffer &&other): + id(other.id), + status(other.status) +{ + other.id = 0; +} + OpenGLFramebuffer::~OpenGLFramebuffer() { if(id) @@ -70,23 +76,24 @@ void OpenGLFramebuffer::require_layered() void OpenGLFramebuffer::resize_system(unsigned w, unsigned h) { - Framebuffer *self = static_cast(this); - self->width = w; - self->height = h; + Framebuffer &self = *static_cast(this); + self.width = w; + self.height = h; } void OpenGLFramebuffer::update(unsigned mask) const { - const FrameFormat &format = static_cast(this)->format; + const Framebuffer &self = *static_cast(this); + vector color_bufs; - color_bufs.reserve(format.size()); + color_bufs.reserve(self.format.size()); unsigned i = 0; - for(FrameAttachment a: format) + for(FrameAttachment a: self.format) { GLenum gl_attach_point = get_gl_attachment(a); if(mask&(1<(this)->attachments[i]; + const Framebuffer::Attachment &attch = self.attachments[i]; if(attch.tex) { if(ARB_direct_state_access)