diff --git a/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp b/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp index ca7561395fbdeae9ffb01dc8da1266baf992b31e..e96d43132687c31facac8c6e59a0ae19ba33999c 100644 --- a/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp +++ b/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp @@ -8,7 +8,8 @@ ProjectionAxes::ProjectionAxes(): buffIdx(-1), totalSpikes(0), newSpike(false), - isTextureValid(false), + isTextureValid(false), + fboCreated(false), allSpikesNextRender(false) { GenericAxes::type = PROJ1x2; @@ -20,6 +21,7 @@ ProjectionAxes::ProjectionAxes(): n2ProjIdx(type, &Dim1, &Dim2); clearOnNextDraw = false; + } ProjectionAxes::ProjectionAxes(int x, int y, double w, double h, int t): @@ -31,6 +33,7 @@ ProjectionAxes::ProjectionAxes(int x, int y, double w, double h, int t): totalSpikes(0), newSpike(false), isTextureValid(false), + fboCreated(false), allSpikesNextRender(false) { GenericAxes::gotFirstSpike = false; @@ -216,13 +219,15 @@ void ProjectionAxes::createTexture(){ } void ProjectionAxes::createFBO(){ - std::cout<<"Creating a new frame buffer object";//<<std::endl; + std::cout<<"Creating a new FBO, is already created?:"<<fboCreated<<" ";//<<std::endl; // if (!isTextureValid) // createTexture(); // Delete the old frame buffer, render buffer - glDeleteFramebuffers(1, &fboId); - glDeleteRenderbuffers(1, &rboId); + if (fboCreated){ + glDeleteFramebuffers(1, &fboId); + glDeleteRenderbuffers(1, &rboId); + } // Generate and Bind the frame buffer glGenFramebuffersEXT(1, &fboId); @@ -251,8 +256,10 @@ void ProjectionAxes::createFBO(){ glClear(GL_COLOR_BUFFER_BIT); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + fboCreated = true; } + void ProjectionAxes::drawSpikesToTexture(bool allSpikes){ //std::cout<<"ProjectionAxes::drawSpikesToTexture() plotting all spikes:"<<allSpikes<<std::endl; diff --git a/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.h b/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.h index f3fdfd0c1b65fc75e6bb76c82ae518449fc86c67..045ff811ffcc4494c5b4abc18ea031dcefc43601 100644 --- a/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.h +++ b/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.h @@ -54,6 +54,7 @@ class ProjectionAxes: public GenericAxes{ bool clearOnNextDraw; bool isTextureValid; + bool fboCreated; void clearTexture(); void validateTexture();