move the ui/shaders reload into the ui thread, add rtt region copy, add box/rect conversion

This commit is contained in:
2019-07-17 07:04:44 +02:00
parent 6a0b654228
commit 4b73647c98
5 changed files with 64 additions and 13 deletions

View File

@@ -103,7 +103,27 @@ void RTT::copy(const RTT & source)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboID);
glBindFramebuffer(GL_READ_FRAMEBUFFER, source.fboID);
glBlitFramebuffer(0, 0, source.w, source.h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_LINEAR);
glBlitFramebuffer(0, 0, source.w, source.h, 0, 0, w, h,
GL_COLOR_BUFFER_BIT, GL_LINEAR);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, oldDFboID);
glBindFramebuffer(GL_READ_FRAMEBUFFER, oldRFboID);
});
}
void RTT::copy(const RTT& source, const glm::vec4& rect)
{
App::I->render_task([&]
{
auto r = rect_intersection(rect, { 0, 0, w, h });
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldDFboID);
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &oldRFboID);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboID);
glBindFramebuffer(GL_READ_FRAMEBUFFER, source.fboID);
glBlitFramebuffer(r.x, r.y, r.z, r.w, r.x, r.y, r.z, r.w,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, oldDFboID);
glBindFramebuffer(GL_READ_FRAMEBUFFER, oldRFboID);