Skip to content
Snippets Groups Projects
Commit 775aa5b4 authored by Stuart Layton's avatar Stuart Layton
Browse files

added check to ProjectionAxes::createFBO() such that glDeleteFramebuffers and...

added check to ProjectionAxes::createFBO() such that glDeleteFramebuffers and glDeleteRenderbuffers are only called if the FBO and RBO have already been generated. OpenGL specs indicate it is fine to call these functions on non existant handles, like on the initial creation of the texture. This wasn't a problem on linux but it was for OSX. It was causing each projection plot to share a single texture and all spikes were going to a single plot. As when the 2nd projection plot called createFBO it deleted the FBO for projection plot 1 and 3 did it for 2, resulting in a single fbo for all plots.  This should resolve most of the projection plotting issues for mac
parent fac69f15
No related branches found
No related tags found
No related merge requests found
......@@ -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, &ampDim1, &ampDim2);
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;
......
......@@ -54,6 +54,7 @@ class ProjectionAxes: public GenericAxes{
bool clearOnNextDraw;
bool isTextureValid;
bool fboCreated;
void clearTexture();
void validateTexture();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment