From ccbb3324248f6e01489126349c3f7b4fecd9d3f2 Mon Sep 17 00:00:00 2001 From: kmkolasinski Date: Wed, 1 Apr 2015 21:10:26 +0200 Subject: [PATCH] small fix to memory managment --- .gitignore | 3 ++- Sources/CommonObjects.h | 2 +- Sources/glimageeditor.cpp | 22 +++++++++++----------- Sources/mainwindow.cpp | 7 ++++--- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 114789b..3bcf386 100644 --- a/.gitignore +++ b/.gitignore @@ -172,4 +172,5 @@ log.txt .merge_file_Gs5ohI -Sources/AwesomeBump.pro.user.d869918 \ No newline at end of file +Sources/AwesomeBump.pro.user.d869918 +Sources/AwesomeBump.pro.user.1ac2611 \ No newline at end of file diff --git a/Sources/CommonObjects.h b/Sources/CommonObjects.h index 99fd0c1..a752de3 100644 --- a/Sources/CommonObjects.h +++ b/Sources/CommonObjects.h @@ -21,7 +21,7 @@ #define AB_LOG_ALT "log.txt" #endif -#define AWESOME_BUMP_VERSION "AwesomeBump v3.0.2 " +#define AWESOME_BUMP_VERSION "AwesomeBump v3.0.3 " using namespace std; diff --git a/Sources/glimageeditor.cpp b/Sources/glimageeditor.cpp index f3f4090..641f835 100644 --- a/Sources/glimageeditor.cpp +++ b/Sources/glimageeditor.cpp @@ -221,11 +221,7 @@ void GLImage::render(){ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbos[2]); QGLFramebufferObject* activeFBO = activeImage->fbo; - // create or resize when image was changed - FBOImages::resize(auxFBO1,activeFBO); - FBOImages::resize(auxFBO2,activeFBO); - FBOImages::resize(auxFBO3,activeFBO); - FBOImages::resize(auxFBO4,activeFBO); + bool bTransformUVs = true; // images which depend on others will not be affected by UV changes again @@ -247,16 +243,20 @@ void GLImage::render(){ activeImage->resizeFBO(resize_width,resize_height); // pointers were changed in resize function activeFBO = activeImage->fbo; - FBOImages::resize(auxFBO1,activeFBO); - FBOImages::resize(auxFBO2,activeFBO); - FBOImages::resize(auxFBO3,activeFBO); - FBOImages::resize(auxFBO4,activeFBO); + bSkipStandardProcessing = true; break; default: break; } + + // create or resize when image was changed + FBOImages::resize(auxFBO1,activeFBO->width(),activeFBO->height()); + FBOImages::resize(auxFBO2,activeFBO->width(),activeFBO->height()); + FBOImages::resize(auxFBO3,activeFBO->width(),activeFBO->height()); + FBOImages::resize(auxFBO4,activeFBO->width(),activeFBO->height()); + GLCHK( program->bind() ); GLCHK( program->setUniformValue("gui_image_type", activeImage->imageType) ); GLCHK( program->setUniformValue("gui_depth", float(1.0)) ); @@ -844,8 +844,8 @@ void GLImage::resizeFBO(int width, int height){ conversionType = CONVERT_RESIZE; resize_width = width; resize_height = height; - updateGL(); - conversionType = CONVERT_NONE; + //updateGL(); + //conversionType = CONVERT_NONE; } void GLImage::resetView(){ diff --git a/Sources/mainwindow.cpp b/Sources/mainwindow.cpp index 3144bdd..249d5b8 100644 --- a/Sources/mainwindow.cpp +++ b/Sources/mainwindow.cpp @@ -1015,8 +1015,9 @@ void MainWindow::applyResizeImage(){ FBOImageProporties* lastActive = glImage->getActiveImage(); glImage->enableShadowRender(true); for(int i = 0 ; i < MAX_TEXTURES_TYPE ; i++){ - updateImage(i); glImage->resizeFBO(width,height); + updateImage(i); + } glImage->enableShadowRender(false); glImage->setActiveImage(lastActive); @@ -1034,8 +1035,8 @@ void MainWindow::applyResizeImage(int width, int height){ FBOImageProporties* lastActive = glImage->getActiveImage(); glImage->enableShadowRender(true); for(int i = 0 ; i < MAX_TEXTURES_TYPE ; i++){ - updateImage(i); glImage->resizeFBO(width,height); + updateImage(i); } glImage->enableShadowRender(false); glImage->setActiveImage(lastActive); @@ -1067,8 +1068,8 @@ void MainWindow::applyScaleImage(){ FBOImageProporties* lastActive = glImage->getActiveImage(); glImage->enableShadowRender(true); for(int i = 0 ; i < MAX_TEXTURES_TYPE ; i++){ - updateImage(i); glImage->resizeFBO(width,height); + updateImage(i); } glImage->enableShadowRender(false); glImage->setActiveImage(lastActive);