Commit 29a340d5 authored by Ken Martin's avatar Ken Martin

Fix some issues with release graphics resources that PV exposed

Fix some issues with release graphics resources that PV exposed
parent 206f12ac
......@@ -1627,6 +1627,26 @@ void vtkScalarBarActor::ConfigureAnnotations()
void vtkScalarBarActor::FreeLayoutStorage()
{
// Delete previously constructed objects
if (this->P->Viewport && this->P->Viewport->GetVTKWindow())
{
vtkWindow *win = this->P->Viewport->GetVTKWindow();
if (!this->P->TextActors.empty())
{
vtkScalarBarActorInternal::ActorVector::iterator it;
for (
it = this->P->TextActors.begin();
it != this->P->TextActors.end();
++it)
{
(*it)->ReleaseGraphicsResources(win);
}
}
for (vtkScalarBarActorInternal::ActorVector::size_type i = 0; i < this->P->AnnotationLabels.size(); ++ i )
{
this->P->AnnotationLabels[i]->ReleaseGraphicsResources(win);
}
}
this->P->TextActors.clear();
this->P->AnnotationLabels.clear();
this->P->AnnotationAnchors.clear();
......
......@@ -144,6 +144,10 @@ void vtkViewport::RemoveViewProp(vtkProp *p)
{
if (p && this->HasViewProp(p))
{
if (this->VTKWindow)
{
this->VTKWindow->MakeCurrent();
}
p->ReleaseGraphicsResources(this->VTKWindow);
p->RemoveConsumer(this);
this->Props->RemoveItem(p);
......
......@@ -669,6 +669,11 @@ void vtkGenericCompositePolyDataMapper2::FreeGenericStructures()
//-----------------------------------------------------------------------------
void vtkGenericCompositePolyDataMapper2::ReleaseGraphicsResources(vtkWindow* win)
{
std::map<const vtkDataSet*, vtkCompositeMapperHelper *>::iterator miter = this->Helpers.begin();
for (;miter != this->Helpers.end(); miter++)
{
miter->second->ReleaseGraphicsResources(win);
}
this->FreeGenericStructures();
this->Superclass::ReleaseGraphicsResources(win);
}
......
......@@ -89,12 +89,15 @@ void vtkOpenGLRenderUtilities::RenderTriangles(
glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_INT,
reinterpret_cast<const GLvoid *>(NULL));
ibo->Release();
ibo->ReleaseGraphicsResources();
vao->RemoveAttributeArray("vertexMC");
vao->RemoveAttributeArray("tcoordMC");
vao->Release();
vbo->Release();
vbo->ReleaseGraphicsResources();
if (tcoords)
{
tvbo->Release();
tvbo->ReleaseGraphicsResources();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment