- unsigned i = get_attachment_index(attch);
- attachments[i].set(rbuf);
- update_attachment(1<<i);
- check_size();
-}
-
-void Framebuffer::attach(FramebufferAttachment attch, Texture2D &tex, unsigned level)
-{
- tex.allocate(level);
- set_texture_attachment(attch, tex, level, 0);
-}
-
-void Framebuffer::attach(FramebufferAttachment attch, Texture3D &tex, unsigned layer, unsigned level)
-{
- tex.allocate(level);
- set_texture_attachment(attch, tex, level, layer);
-}
-
-void Framebuffer::attach(FramebufferAttachment attch, TextureCube &tex, TextureCubeFace face, unsigned level)
-{
- tex.allocate(level);
- set_texture_attachment(attch, tex, level, TextureCube::get_face_index(face));
-}
-
-void Framebuffer::attach_layered(FramebufferAttachment attch, Texture3D &tex, unsigned level)
-{
- static Require _req(ARB_geometry_shader4);
- tex.allocate(level);
- set_texture_attachment(attch, tex, level, -1);
-}
-
-void Framebuffer::attach_layered(FramebufferAttachment attch, TextureCube &tex, unsigned level)
-{
- static Require _req(ARB_geometry_shader4);
- tex.allocate(level);
- set_texture_attachment(attch, tex, level, -1);
-}
-
-void Framebuffer::detach(FramebufferAttachment attch)
-{
- if(!id)
- throw invalid_operation("Framebuffer::detach");
-
- unsigned i = get_attachment_index(attch);
- attachments[i].clear();
- update_attachment(1<<i);
- check_size();
-}