mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-24 12:57:00 +00:00
Check that OpenGL resources have really been allocated, before deleting them in Unload().
This commit is contained in:
parent
6e5eaf4653
commit
37755cb398
|
@ -206,11 +206,14 @@ namespace Examples.Tutorial
|
||||||
public override void OnUnload(EventArgs e)
|
public override void OnUnload(EventArgs e)
|
||||||
{
|
{
|
||||||
// Clean up what we allocated before exiting
|
// Clean up what we allocated before exiting
|
||||||
|
if (ColorTexture != 0)
|
||||||
GL.DeleteTextures(1, ref ColorTexture);
|
GL.DeleteTextures(1, ref ColorTexture);
|
||||||
GL.DeleteTextures(1, ref DepthTexture);
|
|
||||||
GL.Ext.DeleteFramebuffers(1, ref FBOHandle);
|
|
||||||
|
|
||||||
base.OnUnload(e);
|
if (DepthTexture != 0)
|
||||||
|
GL.DeleteTextures(1, ref DepthTexture);
|
||||||
|
|
||||||
|
if (FBOHandle != 0)
|
||||||
|
GL.Ext.DeleteFramebuffers(1, ref FBOHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResize(OpenTK.Platform.ResizeEventArgs e)
|
protected override void OnResize(OpenTK.Platform.ResizeEventArgs e)
|
||||||
|
|
|
@ -191,11 +191,14 @@ namespace Examples.Tutorial
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region OnUnLoad
|
#region OnUnload
|
||||||
|
|
||||||
public override void OnUnload(EventArgs e)
|
public override void OnUnload(EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (TextureObject != 0)
|
||||||
GL.DeleteTextures(1, ref TextureObject);
|
GL.DeleteTextures(1, ref TextureObject);
|
||||||
|
|
||||||
|
if (ProgramObject != 0)
|
||||||
GL.DeleteProgram(ProgramObject); // implies deleting the previously flagged ShaderObjects
|
GL.DeleteProgram(ProgramObject); // implies deleting the previously flagged ShaderObjects
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue