+ else if(attch.type==GL_TEXTURE_2D)
+ {
+ static_cast<Texture2D *>(attch.tex)->allocate(attch.level);
+ if(ARB_direct_state_access)
+ glNamedFramebufferTexture(id, attch.attachment, attch.tex->get_id(), attch.level);
+ else
+ glFramebufferTexture2D(GL_FRAMEBUFFER, attch.attachment, attch.type, attch.tex->get_id(), attch.level);
+ }
+ else if(attch.type==GL_TEXTURE_3D || attch.type==GL_TEXTURE_2D_ARRAY)
+ {
+ static_cast<Texture3D *>(attch.tex)->allocate(attch.level);
+ if(ARB_direct_state_access)
+ glNamedFramebufferTextureLayer(id, attch.attachment, attch.tex->get_id(), attch.level, attch.layer);
+ else if(attch.type==GL_TEXTURE_2D_ARRAY)
+ glFramebufferTextureLayer(GL_FRAMEBUFFER, attch.attachment, attch.tex->get_id(), attch.level, attch.layer);
+ else
+ glFramebufferTexture3D(GL_FRAMEBUFFER, attch.attachment, attch.type, attch.tex->get_id(), attch.level, attch.layer);
+ }
+ else if(attch.type==GL_TEXTURE_CUBE_MAP)
+ {
+ static_cast<TextureCube *>(attch.tex)->allocate(attch.level);
+ if(ARB_direct_state_access)
+ glNamedFramebufferTextureLayer(id, attch.attachment, attch.tex->get_id(), attch.level, attch.layer);
+ else
+ glFramebufferTexture2D(GL_FRAMEBUFFER, attch.attachment, TextureCube::enumerate_faces(attch.layer), attch.tex->get_id(), attch.level);
+ }
+ else if(ARB_direct_state_access)
+ glNamedFramebufferRenderbuffer(id, attch.attachment, 0, 0);
+ else
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, attch.attachment, 0, 0);