implement document resize with menu and dialog

This commit is contained in:
2018-10-05 18:10:26 +02:00
parent 4723bedc31
commit 5baa807cce
14 changed files with 245 additions and 15 deletions

View File

@@ -15,6 +15,34 @@ RTT::~RTT()
//destroy();
}
void RTT::resize(int width, int height)
{
RTT new_rtt;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldDFboID);
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &oldRFboID);
new_rtt.create(width, height, -1, int_fmt);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, new_rtt.fboID);
glBindFramebuffer(GL_READ_FRAMEBUFFER, fboID);
glBlitFramebuffer(0, 0, w, h, 0, 0, new_rtt.w, new_rtt.h, GL_COLOR_BUFFER_BIT, GL_LINEAR);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, oldDFboID);
glBindFramebuffer(GL_READ_FRAMEBUFFER, oldRFboID);
destroy();
oldRFboID = 0;
oldDFboID = 0;
fboID = new_rtt.fboID;
rboID = new_rtt.rboID;
texID = new_rtt.texID;
int_fmt = new_rtt.int_fmt;
w = new_rtt.w;
h = new_rtt.h;
}
void RTT::destroy()
{
if (rboID)
@@ -47,6 +75,7 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format)
w = width;
h = height;
int_fmt = internal_format;
if (tex == -1)
{