blur_shdata[i].uniform(loc, 0);
tex[i].set_min_filter(NEAREST);
tex[i].storage(RGB16F, w, h);
- tex[i].image(0, RGB, UNSIGNED_BYTE, 0);
}
combine_shdata.uniform(combine_shader.get_uniform_location("source"), 1);
if(attch.type==GL_RENDERBUFFER_EXT)
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attch.attachment, GL_RENDERBUFFER_EXT, attch.rbuf->get_id());
else if(attch.type==GL_TEXTURE_2D)
+ {
+ static_cast<Texture2D *>(attch.tex)->allocate(attch.level);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attch.attachment, attch.type, attch.tex->get_id(), attch.level);
+ }
else
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attch.attachment, 0, 0);
}
check_size();
}
-void Framebuffer::attach(FramebufferAttachment attch, Texture2D &tex, int level)
+void Framebuffer::attach(FramebufferAttachment attch, Texture2D &tex, unsigned level)
{
if(!id)
throw InvalidState("Can't attach to system framebuffer");
level = 0;
}
-void Framebuffer::Attachment::set(Texture &t, int l)
+void Framebuffer::Attachment::set(Texture &t, unsigned l)
{
type = t.get_target();
tex = &t;
Renderbuffer *rbuf;
Texture *tex;
};
- int level;
+ unsigned level;
Attachment(FramebufferAttachment);
void set(Renderbuffer &);
- void set(Texture &, int);
+ void set(Texture &, unsigned);
void clear();
};
void check_size();
public:
void attach(FramebufferAttachment attch, Renderbuffer &rbuf);
- void attach(FramebufferAttachment attch, Texture2D &tex, int level);
+ void attach(FramebufferAttachment attch, Texture2D &tex, unsigned level);
void detach(FramebufferAttachment attch);
/**
static Framebuffer &system();
private:
unsigned get_attachment_index(FramebufferAttachment);
-
-public:
-
};
inline BufferBits operator|(BufferBits a, BufferBits b)
color_buf->set_min_filter(NEAREST);
color_buf->set_mag_filter(NEAREST);
color_buf->storage((hdr ? RGB16F : RGB), width, height);
- color_buf->image(0, RGB, UNSIGNED_BYTE, 0);
fbo->attach(COLOR_ATTACHMENT0, *color_buf, 0);
depth_buf = new Renderbuffer;
depth_buf->storage(DEPTH_COMPONENT, width, height);
depth_buf.set_compare_func(LEQUAL);
depth_buf.set_wrap(CLAMP_TO_EDGE);
depth_buf.storage(DEPTH_COMPONENT, size, size);
- depth_buf.image(0, DEPTH_COMPONENT, UNSIGNED_BYTE, 0);
fbo.attach(DEPTH_ATTACHMENT, depth_buf, 0);
}
height = h;
depth = d;
ifmt = f;
-
- image(0, ifmt, UNSIGNED_BYTE, 0);
}
void Texture3D::allocate(unsigned level)