X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fframebuffer.cpp;h=97b5c8b1394e428bcc640339af98d58a68607462;hp=a60b437eff6fbe9e4c9a1eec8e2b6012b35395af;hb=2e09b4f72f06537431151fe8b2574e1aa886ad48;hpb=b6dbbbee0c7e6a3af10391f2d9f4bb9e007afb29 diff --git a/source/core/framebuffer.cpp b/source/core/framebuffer.cpp index a60b437e..97b5c8b1 100644 --- a/source/core/framebuffer.cpp +++ b/source/core/framebuffer.cpp @@ -139,24 +139,23 @@ void Framebuffer::update() const const Attachment &attch = attachments[i]; if(attch.tex) { - GLenum type = attch.tex->get_target(); if(ARB_direct_state_access) { - if(type==GL_TEXTURE_2D || type==GL_TEXTURE_2D_MULTISAMPLE || attch.layer<0) - glNamedFramebufferTexture(id, gl_attach_point, attch.tex->get_id(), attch.level); + if(attch.tex->target==GL_TEXTURE_2D || attch.tex->target==GL_TEXTURE_2D_MULTISAMPLE || attch.layer<0) + glNamedFramebufferTexture(id, gl_attach_point, attch.tex->id, attch.level); else - glNamedFramebufferTextureLayer(id, gl_attach_point, attch.tex->get_id(), attch.level, attch.layer); + glNamedFramebufferTextureLayer(id, gl_attach_point, attch.tex->id, attch.level, attch.layer); } - else if(type==GL_TEXTURE_2D || type==GL_TEXTURE_2D_MULTISAMPLE) - glFramebufferTexture2D(GL_FRAMEBUFFER, gl_attach_point, type, attch.tex->get_id(), attch.level); + else if(attch.tex->target==GL_TEXTURE_2D || attch.tex->target==GL_TEXTURE_2D_MULTISAMPLE) + glFramebufferTexture2D(GL_FRAMEBUFFER, gl_attach_point, attch.tex->target, attch.tex->id, attch.level); else if(attch.layer<0) - glFramebufferTexture(GL_FRAMEBUFFER, gl_attach_point, attch.tex->get_id(), attch.level); - else if(type==GL_TEXTURE_2D_ARRAY) - glFramebufferTextureLayer(GL_FRAMEBUFFER, gl_attach_point, attch.tex->get_id(), attch.level, attch.layer); - else if(type==GL_TEXTURE_3D) - glFramebufferTexture3D(GL_FRAMEBUFFER, gl_attach_point, type, attch.tex->get_id(), attch.level, attch.layer); - else if(type==GL_TEXTURE_CUBE_MAP) - glFramebufferTexture2D(GL_FRAMEBUFFER, gl_attach_point, get_gl_cube_face(static_cast(attch.layer)), attch.tex->get_id(), attch.level); + glFramebufferTexture(GL_FRAMEBUFFER, gl_attach_point, attch.tex->id, attch.level); + else if(attch.tex->target==GL_TEXTURE_2D_ARRAY) + glFramebufferTextureLayer(GL_FRAMEBUFFER, gl_attach_point, attch.tex->id, attch.level, attch.layer); + else if(attch.tex->target==GL_TEXTURE_3D) + glFramebufferTexture3D(GL_FRAMEBUFFER, gl_attach_point, attch.tex->target, attch.tex->id, attch.level, attch.layer); + else if(attch.tex->target==GL_TEXTURE_CUBE_MAP) + glFramebufferTexture2D(GL_FRAMEBUFFER, gl_attach_point, get_gl_cube_face(static_cast(attch.layer)), attch.tex->id, attch.level); } else if(ARB_direct_state_access) glNamedFramebufferTexture(id, gl_attach_point, 0, 0); @@ -206,28 +205,27 @@ void Framebuffer::check_size() for(Attachment &a: attachments) if(a.tex) { - GLenum type = a.tex->get_target(); unsigned w = 0; unsigned h = 0; - if(type==GL_TEXTURE_2D) + if(a.tex->target==GL_TEXTURE_2D) { Texture2D *tex = static_cast(a.tex); w = max(tex->get_width()>>a.level, 1U); h = max(tex->get_height()>>a.level, 1U); } - else if(type==GL_TEXTURE_2D_MULTISAMPLE) + else if(a.tex->target==GL_TEXTURE_2D_MULTISAMPLE) { Texture2DMultisample *tex = static_cast(a.tex); w = tex->get_width(); h = tex->get_height(); } - else if(type==GL_TEXTURE_3D || type==GL_TEXTURE_2D_ARRAY) + else if(a.tex->target==GL_TEXTURE_3D || a.tex->target==GL_TEXTURE_2D_ARRAY) { Texture3D *tex = static_cast(a.tex); w = max(tex->get_width()>>a.level, 1U); h = max(tex->get_height()>>a.level, 1U); } - else if(type==GL_TEXTURE_CUBE_MAP) + else if(a.tex->target==GL_TEXTURE_CUBE_MAP) { w = max(static_cast(a.tex)->get_size()>>a.level, 1U); h = w;