combine_texturing.attach(0, depth);
combine_texturing.attach(1, color);
- BindRestore unbind_dtest(static_cast<DepthTest *>(0));
- BindRestore unbind_blend(static_cast<Blend *>(0));
Bind bind_mesh(quad);
{
void Bloom::render(const Texture2D &src, const Texture2D &)
{
- BindRestore unbind_dtest(static_cast<DepthTest *>(0));
- BindRestore unbind_blend(static_cast<Blend *>(0));
Bind bind_mesh(quad);
{
setup_frame();
const Framebuffer *out_fbo = Framebuffer::current();
- // This is a no-op but will ensure the FBO binding gets restored
+ // These is a no-ops but will ensure the related state gets restored
BindRestore restore_fbo(out_fbo);
+ BindRestore restore_depth_test(DepthTest::current());
+ BindRestore restore_blend(Blend::current());
if(target[0])
{
fbo.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
}
+
for(PassList::const_iterator i=passes.begin(); i!=passes.end(); ++i)
{
- Bind bind_depth_test(i->get_depth_test());
- Bind bind_blend(i->get_blend());
+ if(const DepthTest *dt = i->get_depth_test())
+ dt->bind();
+ else
+ DepthTest::unbind();
+
+ if(const Blend *b = i->get_blend())
+ b->bind();
+ else
+ Blend::unbind();
+
renderer.set_lighting(i->get_lighting());
renderer.set_clipping(i->get_clipping());
if(target[0])
{
+ BindRestore unbind_depth_test(static_cast<DepthTest *>(0));
+ BindRestore unbind_blend(static_cast<Blend *>(0));
+
if(samples)
target[0]->fbo.blit_from(target_ms->fbo, COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT, false);