Commit c45e6e8c authored by Marc R.'s avatar Marc R.

fixed vertex buffer release in pole and skew-T actors

parent 3ab0a4c2
......@@ -146,6 +146,14 @@ MMovablePoleActor::MMovablePoleActor()
MMovablePoleActor::~MMovablePoleActor()
{
// Release all vertex buffers.
MGLResourcesManager *glRM = MGLResourcesManager::getInstance();
const QString axisRequestKey = "axis_vertices_actor#"
+ QString::number(getID());
glRM->releaseAllGPUItemReferences(axisRequestKey);
const QString poleRequestKey = "pole_vertices_actor#"
+ QString::number(getID());
glRM->releaseAllGPUItemReferences(poleRequestKey);
}
......@@ -760,11 +768,13 @@ void MMovablePoleActor::dragEvent(MSceneViewGLWidget *sceneView,
const QString poleRequestKey = "pole_vertices_actor#"
+ QString::number(getID());
// NOTE: needs to be released in destructor.
uploadVec3ToVertexBuffer(poleVertices, poleRequestKey, &poleVertexBuffer,
sceneView);
const QString axisRequestKey = "axis_vertices_actor#"
+ QString::number(getID());
// NOTE: needs to be released in destructor.
uploadVec3ToVertexBuffer(axisTicks, axisRequestKey, &axisVertexBuffer,
sceneView);
......@@ -1129,10 +1139,12 @@ void MMovablePoleActor::generateGeometry()
const QString poleRequestKey = "pole_vertices_actor#"
+ QString::number(getID());
// NOTE: needs to be released in destructor.
uploadVec3ToVertexBuffer(poleVertices, poleRequestKey, &poleVertexBuffer);
const QString axisRequestKey = "axis_vertices_actor#"
+ QString::number(getID());
// NOTE: needs to be released in destructor.
uploadVec3ToVertexBuffer(axisTicks, axisRequestKey, &axisVertexBuffer);
}
......
......@@ -187,21 +187,18 @@ MSkewTActor::MSkewTActor() : MNWPMultiVarActor(),
MSkewTActor::~MSkewTActor()
{
if (vbDiagramGeometry)
{
delete vbDiagramGeometry;
}
if (vbFullscreenMouseOverGeometry)
{
delete vbFullscreenMouseOverGeometry;
}
if (vbWyomingProfiles)
{
delete vbWyomingProfiles;
}
// Release all vertex buffers.
MGLResourcesManager *glRM = MGLResourcesManager::getInstance();
glRM->releaseAllGPUItemReferences(
QString("skewTDiagramVertices_actor#%2").arg(myID));
glRM->releaseAllGPUItemReferences(
QString("skewTMouseOverVertices_actor#%2").arg(myID));
glRM->releaseAllGPUItemReferences(
QString("wyomingVertices_actor#%1").arg(myID));
//TODO (mr, 20Feb2019) -- Deleting the poleActor causes a segmentation fault.. why?
// This currently results in the pole actor's vertex buffer remaining in
// GPU memory.. :/
// delete poleActor;
removeAllSkewTLabels();
......@@ -1106,9 +1103,10 @@ void MSkewTActor::generateDiagramGeometry(
- config->coordinateGeometryDrawRanges.moistAdiabates.startIndex;
// Upload geometry to vertex buffer.
// NOTE: needs to be released in destructor!
config->recomputeAdiabateGeometries = false;
uploadVec2ToVertexBuffer(
vertexArray, QString("skewTDiagramVertices%1_actor#%2").arg(myID),
vertexArray, QString("skewTDiagramVertices_actor#%2").arg(myID),
vbDiagramVertices);
LOG4CPLUS_DEBUG(mlog, "Generation of Skew-T diagram geometry finished.");
......@@ -1272,8 +1270,9 @@ void MSkewTActor::generateFullScreenMouseOverGeometry(
- config->mouseOverGeometryDrawRanges.moistAdiabates.startIndex;
// Upload geometry to vertex buffer.
// NOTE: needs to be released in destructor!
uploadVec2ToVertexBuffer(
vertexArray, QString("skewTHighlightVertices%1_actor#%2").arg(myID),
vertexArray, QString("skewTMouseOverVertices_actor#%2").arg(myID),
vbDiagramVertices);
}
......
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