depth_buf.storage(DEPTH_COMPONENT, size, size, 0);
depth_buf.image(0, DEPTH_COMPONENT, UNSIGNED_BYTE, 0);
fbo.attach(DEPTH_ATTACHMENT, depth_buf, 0);
- draw_buffer(NO_BUFFER);
- Framebuffer::unbind();
}
void ShadowMap::set_target(const Vector3 &t, float r)
push_matrix();
load_matrix(matrix);
- const Framebuffer *old_fbo = Framebuffer::current();
- fbo.bind();
- clear(DEPTH_BUFFER_BIT);
+ Bind bind_fbo(fbo, true);
+ fbo.clear(DEPTH_BUFFER_BIT);
scene.render("shadow");
matrix_mode(PROJECTION);
pop_matrix();
matrix_mode(MODELVIEW);
pop_matrix();
- if(old_fbo)
- old_fbo->bind();
- else
- Framebuffer::unbind();
}
depth_buf.bind_to(unit);