This avoids silent failures due to an unsupported framebuffer
configuration.
occlusion.set_mag_filter(NEAREST);
occlusion.set_wrap(CLAMP_TO_EDGE);
fbo.attach(COLOR_ATTACHMENT0, occlusion, 0);
occlusion.set_mag_filter(NEAREST);
occlusion.set_wrap(CLAMP_TO_EDGE);
fbo.attach(COLOR_ATTACHMENT0, occlusion, 0);
+ fbo.require_complete();
combine_texturing.attach(2, occlusion);
combine_texturing.attach(2, occlusion);
tex[i].set_min_filter(NEAREST);
tex[i].set_wrap(CLAMP_TO_EDGE);
tex[i].storage(RGB16F, w, h);
tex[i].set_min_filter(NEAREST);
tex[i].set_wrap(CLAMP_TO_EDGE);
tex[i].storage(RGB16F, w, h);
+ fbo[i].attach(COLOR_ATTACHMENT0, tex[i], 0);
+ fbo[i].require_complete();
}
combine_shdata.uniform("source", 1);
}
combine_shdata.uniform("source", 1);
{
Bind bind_shader(blur_shader);
blur_shdata_common.apply();
{
Bind bind_shader(blur_shader);
blur_shdata_common.apply();
- Bind bind_fbo(fbo, true);
for(unsigned i=0; i<2; ++i)
{
for(unsigned i=0; i<2; ++i)
{
+ Bind bind_fbo(fbo[i], true);
Bind bind_tex(i ? tex[0] : src);
Bind bind_tex(i ? tex[0] : src);
- fbo.attach(COLOR_ATTACHMENT0, tex[i], 0);
blur_shdata[i].apply();
quad.draw();
}
blur_shdata[i].apply();
quad.draw();
}
class Bloom: public PostProcessor
{
private:
class Bloom: public PostProcessor
{
private:
Texture2D tex[2];
Program blur_shader;
ProgramData blur_shdata_common;
Texture2D tex[2];
Program blur_shader;
ProgramData blur_shdata_common;
{
fbo[i].attach(COLOR_ATTACHMENT0, env_tex, TextureCube::enumerate_faces(i), 0);
fbo[i].attach(DEPTH_ATTACHMENT, depth_buf);
{
fbo[i].attach(COLOR_ATTACHMENT0, env_tex, TextureCube::enumerate_faces(i), 0);
fbo[i].attach(DEPTH_ATTACHMENT, depth_buf);
+ fbo[i].require_complete();
}
// XXX Make the depth range configurable
}
// XXX Make the depth range configurable
depth_buf.set_wrap(CLAMP_TO_EDGE);
depth_buf.storage(DEPTH_COMPONENT, size, size);
fbo.attach(DEPTH_ATTACHMENT, depth_buf, 0);
depth_buf.set_wrap(CLAMP_TO_EDGE);
depth_buf.storage(DEPTH_COMPONENT, size, size);
fbo.attach(DEPTH_ATTACHMENT, depth_buf, 0);
+ fbo.require_complete();
set_darkness(0.7);
set_texture_unit(3);
set_darkness(0.7);
set_texture_unit(3);