Skip to content

Commit

Permalink
HUD: add dispose to cleanup opengl textures - traced via GL Intercept
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Aug 18, 2023
1 parent e616554 commit 44c0b2f
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions ExtLibs/Controls/HUD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,30 @@ public HUD()
graphicsObjectGDIP = new GdiGraphics(Graphics.FromImage(objBitmap));
}

protected override void Dispose(bool disposing)
{
log.Info("HUD Dispose");

if (opengl)
{
foreach (character texid in _texture)
{
if (texid != null && texid.gltextureid != 0)
GL.DeleteTexture(texid.gltextureid);
}

this._texture = new character[_texture.Length];

foreach (character texid in charDict.Values)
{
if (texid.gltextureid != 0)
GL.DeleteTexture(texid.gltextureid);
}
}

base.Dispose(disposing);
}

private float _roll = 0;
private float _navroll = 0;
private float _pitch = 0;
Expand Down Expand Up @@ -1782,8 +1806,6 @@ public void FillRectangle(Brush brushh, RectangleF rectf)

GL.Begin(PrimitiveType.TriangleFan);

GL.LineWidth(0);

if (((Type) brushh.GetType()) == typeof(LinearGradientBrush))
{
LinearGradientBrush temp = (LinearGradientBrush) brushh;
Expand Down

0 comments on commit 44c0b2f

Please sign in to comment.