Move cleanup methods
This commit is contained in:
parent
fdd8aa60d2
commit
79804f354b
1 changed files with 22 additions and 22 deletions
|
|
@ -70,28 +70,6 @@ namespace MatterHackers.GCodeVisualizer
|
|||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (myVertexId != -1)
|
||||
{
|
||||
int holdVertexId = myVertexId;
|
||||
int holdIndexId = myIndexId;
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
GL.DeleteBuffers(1, ref holdVertexId);
|
||||
GL.DeleteBuffers(1, ref holdIndexId);
|
||||
});
|
||||
|
||||
myVertexId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
~GCodeVertexBuffer()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public void renderRange(int offset, int count)
|
||||
{
|
||||
GL.EnableClientState(ArrayCap.ColorArray);
|
||||
|
|
@ -127,5 +105,27 @@ namespace MatterHackers.GCodeVisualizer
|
|||
GL.DisableClientState(ArrayCap.NormalArray);
|
||||
GL.DisableClientState(ArrayCap.ColorArray);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (myVertexId != -1)
|
||||
{
|
||||
int holdVertexId = myVertexId;
|
||||
int holdIndexId = myIndexId;
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
GL.DeleteBuffers(1, ref holdVertexId);
|
||||
GL.DeleteBuffers(1, ref holdIndexId);
|
||||
});
|
||||
|
||||
myVertexId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
~GCodeVertexBuffer()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue